git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <junkio@cox.net>
To: git@vger.kernel.org
Subject: [PATCH] GIT-VERSION-GEN: allow overriding from Makefile
Date: Mon, 09 Jan 2006 15:01:04 -0800	[thread overview]
Message-ID: <7vpsn1f1lb.fsf@assigned-by-dhcp.cox.net> (raw)

The RPM building procedure relied on being able to build from a
freshly untarred tarball, so there is no way "git describe"
could figure out from which commit it is building (there was no
HEAD).

This still does not allow you to build RPM binary package from
an untagged interim version because RPM does not like '-' in
version number, but that probably is a blessing.

Signed-off-by: Junio C Hamano <junkio@cox.net>

---

 * For 1.1.1; the binary in 1.1.0 RPM was affected with this bug.

 GIT-VERSION-GEN |   13 +++++++++----
 Makefile        |    2 +-
 2 files changed, 10 insertions(+), 5 deletions(-)

1900d64cbecf46844dd7910d78676e0cace7139e
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 845b9dc..c878819 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -2,8 +2,15 @@
 
 GVF=GIT-VERSION-FILE
 
-VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT
-VN=$(expr "$VN" : v'\(.*\)')
+case "${VN+set}" in
+set)
+	;;
+*)
+	VN=$(git-describe --abbrev=4 HEAD 2>/dev/null) || VN=v1.0.GIT
+	VN=$(expr "$VN" : v'\(.*\)')
+	;;
+esac
+
 if test -r $GVF
 then
 	VC=$(sed -e 's/^GIT_VERSION = //' <$GVF)
@@ -14,5 +21,3 @@ test "$VN" = "$VC" || {
 	echo >&2 "GIT_VERSION = $VN"
 	echo "GIT_VERSION = $VN" >$GVF
 }
-
-
diff --git a/Makefile b/Makefile
index c9c15b5..0bbb5b8 100644
--- a/Makefile
+++ b/Makefile
@@ -494,7 +494,7 @@ dist: git.spec git-tar-tree
 	gzip -f -9 $(GIT_TARNAME).tar
 
 rpm: dist
-	$(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
+	VN=$(GIT_VERSION) $(RPMBUILD) -ta $(GIT_TARNAME).tar.gz
 
 ### Cleaning rules
 
-- 
1.1.0

             reply	other threads:[~2006-01-09 23:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-09 23:01 Junio C Hamano [this message]
2006-01-10  2:07 ` [PATCH] For release tarballs, include the proper version H. Peter Anvin

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=7vpsn1f1lb.fsf@assigned-by-dhcp.cox.net \
    --to=junkio@cox.net \
    --cc=git@vger.kernel.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.
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).