Blame SOURCES/mcelog-patch-0755b55af.patch

bef633
From: Prarit Bhargava <prarit@redhat.com>
bef633
bef633
Subject: Makefile: Make `git` check portable (POSIX compatible)
bef633
bef633
commit 0755b55afbf76fcacc31e98bb8c163c8e055ccb2
bef633
Author: Paul Menzel <pmenzel@molgen.mpg.de>
bef633
Date:   Mon Jan 30 15:56:41 2017 +0100
bef633
bef633
    Makefile: Make `git` check portable (POSIX compatible)
bef633
    
bef633
    On systems using not the *GNU Bourne-Again SHell* (bash) as shell, the
bef633
    git check might fail. This happens on Debian systems where the *Debian
bef633
    Almquist Shell* (dash) is used by default for `/bin/sh`.
bef633
    
bef633
    As a result, after running `make` the file `version.c` always contains
bef633
    `unknown` instead of the correct version.
bef633
    
bef633
    The problem is, that `type -p git` is not portable. Use `command -v`
bef633
    instead [1][2].
bef633
    
bef633
    > Where bash is your shell/hashbang, consistently use hash (for
bef633
    > commands) or type (to consider built-ins & keywords).
bef633
    >
bef633
    > When writing a POSIX script, use command -v.
bef633
    
bef633
    Fixes: #42
bef633
    
bef633
    [1] https://stackoverflow.com/questions/592620/check-if-a-program-exists-from-a-bash-script
bef633
        "Check if a program exists from a Bash script"
bef633
    [2] https://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
bef633
        "Why not use “which”? What to use then?"
bef633
bef633
diff --git a/Makefile b/Makefile
bef633
index 9dbbdbf8eb97e21a6d2efee7f308c1e7e742845b..e4341fceb882597ceebb56883625338c89923ee0 100644
bef633
--- a/Makefile
bef633
+++ b/Makefile
bef633
@@ -82,7 +82,7 @@ depend: .depend
bef633
 
bef633
 version.tmp: FORCE
bef633
 	( echo -n "char version[] = \"" ; 	\
bef633
-	if type -p git >/dev/null; then 	\
bef633
+	if command -v git >/dev/null; then 	\
bef633
 	if [ -d .git ] ; then 			\
bef633
 		git describe --tags HEAD | tr -d '\n'; 	\
bef633
 	else 					\