zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@zsh.org>
Subject: PATCH: dependency of patchlevel.h
Date: Fri, 31 Aug 2018 16:35:39 +0200	[thread overview]
Message-ID: <25962-1535726139.113636@Sr-t.fdMJ.mNaM> (raw)

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:
 


                 reply	other threads:[~2018-08-31 14:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=25962-1535726139.113636@Sr-t.fdMJ.mNaM \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).