All of lore.kernel.org
 help / color / mirror / Atom feed
* bug: build from tarball uses git-describe
@ 2007-02-13 22:59 Han-Wen Nienhuys
  2007-02-14  1:00 ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Han-Wen Nienhuys @ 2007-02-13 22:59 UTC (permalink / raw)
  To: git



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.

-- 
 Han-Wen Nienhuys - hanwen@xs4all.nl - http://www.xs4all.nl/~hanwen

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bug: build from tarball uses git-describe
  2007-02-13 22:59 bug: build from tarball uses git-describe Han-Wen Nienhuys
@ 2007-02-14  1:00 ` Johannes Schindelin
  2007-02-14  1:04   ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-02-14  1:00 UTC (permalink / raw)
  To: Han-Wen Nienhuys; +Cc: git

Hi,

On Tue, 13 Feb 2007, Han-Wen Nienhuys wrote:

> 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(-)

diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 7a10b60..e6f89cb 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -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 ;;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: bug: build from tarball uses git-describe
  2007-02-14  1:00 ` Johannes Schindelin
@ 2007-02-14  1:04   ` Junio C Hamano
  2007-02-14  1:10     ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2007-02-14  1:04 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Han-Wen Nienhuys, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Does this (totally untested) patch help?
>
> --
>
>  GIT-VERSION-GEN |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
> index 7a10b60..e6f89cb 100755
> --- a/GIT-VERSION-GEN
> +++ b/GIT-VERSION-GEN
> @@ -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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bug: build from tarball uses git-describe
  2007-02-14  1:04   ` Junio C Hamano
@ 2007-02-14  1:10     ` Johannes Schindelin
  2007-02-14 19:26       ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Johannes Schindelin @ 2007-02-14  1:10 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Han-Wen Nienhuys, git

Hi,

On Tue, 13 Feb 2007, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > Does this (totally untested) patch help?
> >
> > --
> >
> >  GIT-VERSION-GEN |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
> > index 7a10b60..e6f89cb 100755
> > --- a/GIT-VERSION-GEN
> > +++ b/GIT-VERSION-GEN
> > @@ -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?

It checks if the file "version" exists, and takes the contents of that as 
version, otherwise $DEF_VER.

> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: bug: build from tarball uses git-describe
  2007-02-14  1:10     ` Johannes Schindelin
@ 2007-02-14 19:26       ` Junio C Hamano
  2007-02-14 19:30         ` Johannes Schindelin
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2007-02-14 19:26 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Han-Wen Nienhuys, git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> It checks if the file "version" exists, and takes the contents of that as 
> version, otherwise $DEF_VER.
>
>> 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. 

diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index febacd2..6abde8d 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: bug: build from tarball uses git-describe
  2007-02-14 19:26       ` Junio C Hamano
@ 2007-02-14 19:30         ` Johannes Schindelin
  0 siblings, 0 replies; 6+ messages in thread
From: Johannes Schindelin @ 2007-02-14 19:30 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Han-Wen Nienhuys, git

Hi,

On Wed, 14 Feb 2007, Junio C Hamano wrote:

> 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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-02-14 19:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-13 22:59 bug: build from tarball uses git-describe Han-Wen Nienhuys
2007-02-14  1:00 ` Johannes Schindelin
2007-02-14  1:04   ` Junio C Hamano
2007-02-14  1:10     ` Johannes Schindelin
2007-02-14 19:26       ` Junio C Hamano
2007-02-14 19:30         ` Johannes Schindelin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.