[spice-gtk] build: Generate correct version when spice-gtk is a submodule

Submitted by Christophe de Dinechin on April 18, 2018, 2:22 p.m.

Details

Message ID 20180418142223.78426-1-christophe@dinechin.org
State New
Headers show
Series "build: Generate correct version when spice-gtk is a submodule" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Christophe de Dinechin April 18, 2018, 2:22 p.m.
From: Christophe de Dinechin <dinechin@redhat.com>

When spice-gtk is a submodule, .git is not a directory but a file.
Testing for a file avoids an "UNKNOWN" version

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
---
 build-aux/git-version-gen | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
index 5617eb8..f8e8b23 100755
--- a/build-aux/git-version-gen
+++ b/build-aux/git-version-gen
@@ -1,6 +1,6 @@ 
 #!/bin/sh
 # Print a version string.
-scriptversion=2010-06-14.19; # UTC
+scriptversion=2018-04-17.14; # UTC
 
 # Copyright (C) 2007-2010 Free Software Foundation, Inc.
 #
@@ -98,7 +98,7 @@  fi
 if test -n "$v"
 then
     : # use $v
-elif test -d .git \
+elif test -d .git -o -f .git \
     && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
 	  || git describe --abbrev=4 HEAD 2>/dev/null` \
     && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \

Comments

Hey,

This script comes from https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=build-aux/git-version-gen;h=6d073fcaddd827a396af4c52f1bf00bdd84a9f66;hb=HEAD
where this issue might already be fixed, the line that you changed seems
to be replaced by:
elif test "`git log -1 --pretty=format:x . 2>&1`" = x \

So I'd suggest updating the script to the latest version if this fixes
the problem that you were seeing.

Christophe

On Wed, Apr 18, 2018 at 04:22:23PM +0200, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin@redhat.com>
> 
> When spice-gtk is a submodule, .git is not a directory but a file.
> Testing for a file avoids an "UNKNOWN" version
> 
> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
> ---
>  build-aux/git-version-gen | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
> index 5617eb8..f8e8b23 100755
> --- a/build-aux/git-version-gen
> +++ b/build-aux/git-version-gen
> @@ -1,6 +1,6 @@
>  #!/bin/sh
>  # Print a version string.
> -scriptversion=2010-06-14.19; # UTC
> +scriptversion=2018-04-17.14; # UTC
>  
>  # Copyright (C) 2007-2010 Free Software Foundation, Inc.
>  #
> @@ -98,7 +98,7 @@ fi
>  if test -n "$v"
>  then
>      : # use $v
> -elif test -d .git \
> +elif test -d .git -o -f .git \
>      && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
>  	  || git describe --abbrev=4 HEAD 2>/dev/null` \
>      && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
> -- 
> 2.13.5 (Apple Git-94)
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> On 18 Apr 2018, at 16:43, Christophe Fergeau <cfergeau@redhat.com> wrote:
> 
> Hey,
> 
> This script comes from https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=blob;f=build-aux/git-version-gen;h=6d073fcaddd827a396af4c52f1bf00bdd84a9f66;hb=HEAD
> where this issue might already be fixed, the line that you changed seems
> to be replaced by:
> elif test "`git log -1 --pretty=format:x . 2>&1`" = x \
> 
> So I'd suggest updating the script to the latest version if this fixes
> the problem that you were seeing.

Good idea. It does. I think we may want to do that for all components. I like the way they test, it clearly also covers subtle cases such as .git being in a parent directory, etc ;-)

(I noticed that with my top-level spice build, where all the components are submodules).


Thanks
Chirstophe

> 
> Christophe
> 
> On Wed, Apr 18, 2018 at 04:22:23PM +0200, Christophe de Dinechin wrote:
>> From: Christophe de Dinechin <dinechin@redhat.com>
>> 
>> When spice-gtk is a submodule, .git is not a directory but a file.
>> Testing for a file avoids an "UNKNOWN" version
>> 
>> Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
>> ---
>> build-aux/git-version-gen | 4 ++--
>> 1 file changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/build-aux/git-version-gen b/build-aux/git-version-gen
>> index 5617eb8..f8e8b23 100755
>> --- a/build-aux/git-version-gen
>> +++ b/build-aux/git-version-gen
>> @@ -1,6 +1,6 @@
>> #!/bin/sh
>> # Print a version string.
>> -scriptversion=2010-06-14.19; # UTC
>> +scriptversion=2018-04-17.14; # UTC
>> 
>> # Copyright (C) 2007-2010 Free Software Foundation, Inc.
>> #
>> @@ -98,7 +98,7 @@ fi
>> if test -n "$v"
>> then
>>     : # use $v
>> -elif test -d .git \
>> +elif test -d .git -o -f .git \
>>     && v=`git describe --abbrev=4 --match='v*' HEAD 2>/dev/null \
>> 	  || git describe --abbrev=4 HEAD 2>/dev/null` \
>>     && v=`printf '%s\n' "$v" | sed "$tag_sed_script"` \
>> -- 
>> 2.13.5 (Apple Git-94)
>> 
>> _______________________________________________
>> Spice-devel mailing list
>> Spice-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/spice-devel