Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: dependency of patchlevel.h



In my own builds, I've been finding that make install needs to recompile
a few files and that $ZSH_PATCHLEVEL is generally empty. After looking
into the cause, it seems to be rather specific to my setup but I include
a patch, nevertheless.

In the Makefile, we force building patchlevel.h but use cmp to ensure it
is only updated when changed. But make install is normally run as root
and on my system, root is using an older version of git.

The older git outputs a 7 hex-digit hash while more recent git adapts it
based on the number of objects in the repository so I get 9 hex-digits.

By adding --abbrev=7, we can ensure consistency. Perhaps we should use a
bigger value than 7 - any thoughts on that? Currently, there are no
duplicates in the first 7 digits for the zsh repository.

Also, is there any objection to adding -f to the mv command. Running
make install as root tends to result in patchlevel.h being owned by root
and then the mv needs to prompt before overwriting it. 

Oliver

diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 324435d62..3e5788af5 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -53,8 +53,8 @@ patchlevel.h: FORCE
 	@if [ -f $(sdir)/$@.release ]; then \
 	  cp -f $(sdir)/$@.release $@; \
 	else \
-	  echo '#define ZSH_PATCHLEVEL "'`cd $(sdir) && git describe --tags --long`'"' > $@.tmp; \
-	  cmp $@ $@.tmp >/dev/null 2>&1 && rm -f $@.tmp || mv $@.tmp $@; \
+	  echo '#define ZSH_PATCHLEVEL "'`cd $(sdir) && git describe --tags --long --abbrev=7`'"' > $@.tmp; \
+	  cmp $@ $@.tmp >/dev/null 2>&1 && rm -f $@.tmp || mv -f $@.tmp $@; \
 	fi
 FORCE:
 



Messages sorted by: Reverse Date, Date, Thread, Author