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

Re: version.h and ChangeLog



On Mon, 8 Apr 2013 20:34:13 +0100
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx> wrote:
> What should probably happen is that "make targz-src" should somehow
> freeze the contents of patchlevel.h so that making it when untarred
> doesn't update the header any further.

Here's one possible simple way of doing that, though it would be better
to move the code that generates the file contents into a script.

By the way, are we guaranteed that the output of 'git describe --tags
--long' is the same for everyone that has pulled the same code from the
server (and doesn't have local changes)?  If not, it would be worth a
bit of extra work to make it so: the whole point of the patchlevel is so
it consistently refers to a particular state of what's on the server for
reporting by users who are just tracking development.  Local changes are
really a special case here --- people developing the shell can be
assumed to be knowledgeable enough to make their own investigations ---
though if it's possible to indicate that there are changes not pushed to
the server in a way that sticks out, e.g. with something appended like
"-local-<ref>", that's useful, too.  This is definitely looking like a
script.

diff --git a/Makefile.in b/Makefile.in
index 5fb736f..a29ab78 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -160,6 +160,7 @@ targz-src: $(DISTNAME).tar.gz
 $(DISTNAME).tar.gz: FORCE
 	@$(sdir_top)/Util/mkdisttree.sh $(DISTNAME) $(sdir_top) $(dir_top) SRC \
 	    $(MAKE) $(MAKEDEFS)
+	echo '#define ZSH_PATCHLEVEL "'`git describe --tags --long`'"' >$(DISTNAME)/Src/patchlevel.h.release
 	tar cf - $(DISTNAME) | gzip -9 > $@
 	rm -rf $(DISTNAME)
 
diff --git a/Src/zsh.mdd b/Src/zsh.mdd
index 420e8fc..0fec5c3 100644
--- a/Src/zsh.mdd
+++ b/Src/zsh.mdd
@@ -40,8 +40,12 @@ version.h: $(sdir_top)/Config/version.mk zshcurses.h zshterm.h
 	echo '#define ZSH_VERSION "'$(VERSION)'"' > $@
 
 patchlevel.h: FORCE
-	echo '#define ZSH_PATCHLEVEL "'`git describe --tags --long`'"' > $@.tmp
-	cmp $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@
+	@if [ -f $(sdir)/$@.release ]; then \
+	  cp -f $(sdir)/$@.release $@; \
+	else \
+	  echo '#define ZSH_PATCHLEVEL "'`git describe --tags --long`'"' > $@.tmp; \
+	  cmp $@ $@.tmp && rm -f $@.tmp || mv $@.tmp $@; \
+	fi
 FORCE:
 
 zshcurses.h: ../config.h

-- 
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/



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