bug: build from tarball uses git-describe
while building GIT from tarball inside a GUB checkout (GUB is a build environment , now using GIT for version control):
sed -e '1s|#!.*/sh|#!/bin/sh|' \
-e 's|@@PERL@@|/usr/bin/perl|g' \
-e 's/@@GIT_VERSION@@/release_2.11.17.1_of_lilypond_release/2.11.16.1.g3abe43a66cf3655e5ec5486c3001ac2ac479433.3.gdb02-dirty/g' \
-e 's/@@NO_CURL@@//g' \apparently, the makefile blindly uses the output of
git describe
without checking whether there is a .git directory.
Signature · 1 line
Han-Wen Nienhuys - [email protected] - http://www.xs4all.nl/~hanwen
Hi,
Quoted 5 lines · Han-Wen Nienhuys
apparently, the makefile blindly uses the output of
git describe
without checking whether there is a .git directory.
Does this (totally untested) patch help?
--
GIT-VERSION-GEN | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
GIT-VERSION-GEN +1 -1
@@ -8,7 +8,7 @@ LF=' # First try git-describe, then see if there is a version file # (included in release tarballs), then default -if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && +if test -d .git && VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && case "$VN" in *$LF*) (exit 1) ;; v[0-9]*) : happy ;;
Quoted 12 lines · Johannes Schindelin
Does this (totally untested) patch help?
--
GIT-VERSION-GEN | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)GIT-VERSION-GEN +0
-0
GIT-VERSION-GEN LF=' · line 14
Quoted 8 lines
GIT-VERSION-GEN +1
-1@@ -8,7 +8,7 @@ LF=' # First try git-describe, then see if there is a version file # (included in release tarballs), then default -if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && +if test -d .git && VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && case "$VN" in *$LF*) (exit 1) ;; v[0-9]*) : happy ;;
Have you checked what the elif part does in the if statement you are patching?
After all fresh tarball is how we build rpm packages and we do not have .git in that build environment, so I am quite puzzled.
Hi,
Quoted 15 lines · Junio C Hamano
Quoted 13 lines · Johannes Schindelin
Does this (totally untested) patch help?
--
GIT-VERSION-GEN | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)GIT-VERSION-GEN +0
-0@@ -8,7 +8,7 @@ LF='
Quoted 10 lines
GIT-VERSION-GEN LF=' · line 14
Quoted 7 lines
GIT-VERSION-GEN +1
-1# First try git-describe, then see if there is a version file # (included in release tarballs), then default -if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && +if test -d .git && VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && case "$VN" in *$LF*) (exit 1) ;; v[0-9]*) : happy ;;Have you checked what the elif part does in the if statement you are patching?
It checks if the file "version" exists, and takes the contents of that as version, otherwise $DEF_VER.
Quoted 2 lines
After all fresh tarball is how we build rpm packages and we do not have .git in that build environment, so I am quite puzzled.
Yes, the idea was: if there is no .git, do not even bother checking the output of git-describe (it might find a .git directory in a parent directory, after all).
Ciao,
Dscho
Quoted 9 lines · Johannes Schindelin
It checks if the file "version" exists, and takes the contents of that as version, otherwise $DEF_VER.
Quoted 2 lines
After all fresh tarball is how we build rpm packages and we do not have .git in that build environment, so I am quite puzzled.
Yes, the idea was: if there is no .git, do not even bother checking the output of git-describe (it might find a .git directory in a parent directory, after all).
Ok, then let's do this. Our tarballs do have version file, and if the upperlevel Makefile wants to set a different version it can drop 'version' file before descending into us.
GIT-VERSION-GEN +11 -10
@@ -6,18 +6,19 @@ DEF_VER=v1.5.0.GIT LF=' ' -# First try git-describe, then see if there is a version file -# (included in release tarballs), then default -if VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && - case "$VN" in - *$LF*) (exit 1) ;; - v[0-9]*) : happy ;; - esac -then - VN=$(echo "$VN" | sed -e 's/-/./g'); -elif test -f version +# First see if there is a version file (included in release tarballs), +# then try git-describe, then default. +if test -f version then VN=$(cat version) || VN="$DEF_VER" +elif test -d .git && + VN=$(git describe --abbrev=4 HEAD 2>/dev/null) && + case "$VN" in + *$LF*) (exit 1) ;; + v[0-9]*) : happy ;; + esac +then + VN=$(echo "$VN" | sed -e 's/-/./g'); else VN="$DEF_VER" fi
Hi,
Quoted 3 lines · Junio C Hamano
Ok, then let's do this. Our tarballs do have version file, and if the upperlevel
Makefilewants to set a different version it can drop 'version' file before descending into us.
Okay. But I started hacking git by getting it, compiling it, doing "git init", a "git fetch origin", "git read-tree HEAD" and "git update-index --refresh". In that case, .git is there, but also the file "version".
But that's too obscure a case as to care about, so I am okay with your patch.
Ciao,
Dscho