Re: git-version-gen w/o git

2012-10-18 Thread Peter Rosin
Hi Eric!

On 2012-10-18 15:02, Eric Blake wrote:
> [adding-gnulib]

I'm not subscribed, please (continue to) keep me in CC.

> On 10/18/2012 06:50 AM, Peter Rosin wrote:
>> Hi!
>>
>> I used to use a libtool git checkout from a platform that lacks
>> git [MSYS], but that broke at some point. I would like something
>> like the below to unbreak my work flow.
>>
>> Please?
>>
>> Cheers,
>> Peter
>>
>> diff --git a/Makefile.am b/Makefile.am
>> index 176325c..3bcb419 100644
>> --- a/Makefile.am
>> +++ b/Makefile.am
>> @@ -46,7 +46,7 @@ EXTRA_LTLIBRARIES  =
>>  # Using `cd' in backquotes may print the directory name, use this instead:
>>  lt__cd  = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
>>  
>> -git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '.tarball-version'
>> +git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '--fallback' 
>> '$(VERSION)' '.tarball-version'
> 
> I'm not sure that makes sense - git-version-gen is ALREADY supposed to
> use the contents of .tarball-version as the fallback version.

No, .tarball-version is the primary source, or the "fallfront" as
some call it :-) Once you create that file you will no longer
attempt to run git, even if you switch back to the platform that
created the git checkout in the first place.

Here's an update of the gnulib parts, with long lines wrapped and
a scriptversion update.

--- gnulib/build-aux/git-version-gen.orig   2012-10-02 17:10:58.935840500 
+0200
+++ gnulib/build-aux/git-version-gen2012-10-18 15:47:40.711565800 +0200
@@ -1,6 +1,6 @@
 #!/bin/sh
 # Print a version string.
-scriptversion=2012-03-18.17; # UTC
+scriptversion=2012-10-18.13; # UTC
 
 # Copyright (C) 2007-2012 Free Software Foundation, Inc.
 #
@@ -86,6 +86,7 @@
 Options:
 
--prefix   prefix of git tags (default 'v')
+   --fallback fallback version to use if \"git --version\" fails
 
--help display this help and exit
--version  output version information and exit
@@ -93,12 +94,14 @@
 Running without arguments will suffice in most cases."
 
 prefix=v
+fallback=
 
 while test $# -gt 0; do
   case $1 in
 --help) echo "$usage"; exit 0;;
 --version) echo "$version"; exit 0;;
 --prefix) shift; prefix="$1";;
+--fallback) shift; fallback="$1";;
 -*)
   echo "$0: Unknown option '$1'." >&2
   echo "$0: Try '--help' for more information." >&2
@@ -184,8 +187,10 @@
 # Remove the "g" in git describe's output string, to save a byte.
 v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
 v_from_git=1
-else
+elif test -z "$fallback" || git --version >& /dev/null; then
 v=UNKNOWN
+else
+v=$fallback
 fi
 
 v=`echo "$v" |sed "s/^$prefix//"`
--- gnulib/top/maint.mk.orig2012-10-02 17:10:43.846614700 +0200
+++ gnulib/top/maint.mk 2012-10-18 15:26:50.200179600 +0200
@@ -1327,7 +1327,8 @@
 
 .PHONY: no-submodule-changes
 no-submodule-changes:
-   $(AM_V_GEN)if test -d $(srcdir)/.git; then  \
+   $(AM_V_GEN)if test -d $(srcdir)/.git\
+   && git --version >& /dev/null; then \   \
  diff=$$(cd $(srcdir) && git submodule -q foreach  \
  git diff-index --name-only HEAD)  \
|| exit 1;  \
@@ -1345,7 +1346,8 @@
 # cannot be built from a fresh clone.
 .PHONY: public-submodule-commit
 public-submodule-commit:
-   $(AM_V_GEN)if test -d $(srcdir)/.git; then  \
+   $(AM_V_GEN)if test -d $(srcdir)/.git\
+   && git --version >& /dev/null; then \
  cd $(srcdir) &&   \
  git submodule --quiet foreach test '$$(git rev-parse $$sha1)' \
  = '$$(git merge-base origin $$sha1)'  \




Re: git-version-gen w/o git

2012-10-18 Thread Peter Rosin
[dropping-gnulib for this part]

On 2012-10-18 15:02, Eric Blake wrote:
> [adding-gnulib]
> 
> On 10/18/2012 06:50 AM, Peter Rosin wrote:
>> @@ -128,8 +128,10 @@ $(ltversion_m4): $(ltversion_in) $(dotversion)
>>  done; \
>>  if $$rebuild; then \
>>rm -f '$@'; \
>> -  if test -f '$(srcdir)/.serial'; then \
>> -serial=`cat '$(srcdir)/.serial'`; \
>> +  if test -d '$(srcdir)/.git' && git --version >& /dev/null; then \
>> +$(git_commit_count) > '$(srcdir)/.serial'; \
>> +  fi; \
>> +  serial=`cat '$(srcdir)/.serial'`; \
> 
> However, something like this would be useful in libtool.

That hunk was wrong, this is what I meant:

@@ -128,11 +128,10 @@ $(ltversion_m4): $(ltversion_in) $(dotversion)
done; \
if $$rebuild; then \
  rm -f '$@'; \
- if test -f '$(srcdir)/.serial'; then \
-   serial=`cat '$(srcdir)/.serial'`; \
- else \
-   serial=`$(git_commit_count)`; \
+ if test -d '$(srcdir)/.git' && git --version >& /dev/null; then \
+   $(git_commit_count) > '$(srcdir)/.serial'; \
  fi; \
+ serial=`cat '$(srcdir)/.serial'`; \
  if test 0 = '$(V)'; then echo "  GEN   " $@; \
  else echo $(bootstrap_edit) "'$(ltversion_in)' > '$@'"; fi; \
  $(bootstrap_edit) '$(ltversion_in)' > '$@'; \



>>else \
>>  serial=`$(git_commit_count)`; \
>>fi; \


Sorry for the noise.

Cheers,
Peter




Re: git-version-gen w/o git

2012-10-18 Thread Gary V. Vaughan
On Oct 18, 2012, at 7:50 PM, Peter Rosin  wrote:
> Hi!

Hi Peter,

> I used to use a libtool git checkout from a platform that lacks
> git [MSYS], but that broke at some point. I would like something
> like the below to unbreak my work flow.
> 
> Please?
> [[patches snipped]]

That looks like a reasonable request, useful to more folks than
just you.  You should propose your patches to bug-gnu...@gnu.org,
and when accepted, add the extra support on this side if necessary.

Cheers,
-- 
Gary V. Vaughan (gary AT gnu DOT org)



Re: git-version-gen w/o git

2012-10-18 Thread Eric Blake
[adding-gnulib]

On 10/18/2012 06:50 AM, Peter Rosin wrote:
> Hi!
> 
> I used to use a libtool git checkout from a platform that lacks
> git [MSYS], but that broke at some point. I would like something
> like the below to unbreak my work flow.
> 
> Please?
> 
> Cheers,
> Peter
> 
> diff --git a/Makefile.am b/Makefile.am
> index 176325c..3bcb419 100644
> --- a/Makefile.am
> +++ b/Makefile.am
> @@ -46,7 +46,7 @@ EXTRA_LTLIBRARIES   =
>  # Using `cd' in backquotes may print the directory name, use this instead:
>  lt__cd   = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
>  
> -git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '.tarball-version'
> +git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '--fallback' 
> '$(VERSION)' '.tarball-version'

I'm not sure that makes sense - git-version-gen is ALREADY supposed to
use the contents of .tarball-version as the fallback version.

>  rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | 
> sed 's|-.*$$||g'`
>  
>  
> @@ -128,8 +128,10 @@ $(ltversion_m4): $(ltversion_in) $(dotversion)
>   done; \
>   if $$rebuild; then \
> rm -f '$@'; \
> -   if test -f '$(srcdir)/.serial'; then \
> - serial=`cat '$(srcdir)/.serial'`; \
> +   if test -d '$(srcdir)/.git' && git --version >& /dev/null; then \
> + $(git_commit_count) > '$(srcdir)/.serial'; \
> +   fi; \
> +   serial=`cat '$(srcdir)/.serial'`; \

However, something like this would be useful in libtool.

> else \
>   serial=`$(git_commit_count)`; \
> fi; \
> 
> 
> 
> And then some support for that in gnulib:
> 
> --- gnulib/build-aux/git-version-gen.orig 2012-10-02 17:10:58.935840500 
> +0200
> +++ gnulib/build-aux/git-version-gen  2012-10-18 14:41:57.45846 +0200
> @@ -86,6 +86,7 @@
>  Options:
>  
> --prefix   prefix of git tags (default 'v')
> +   --fallback fallback version to use if \"git --version\" fails
>  
> --help display this help and exit
> --version  output version information and exit
> @@ -93,12 +94,14 @@
>  Running without arguments will suffice in most cases."
>  
>  prefix=v
> +fallback=
>  
>  while test $# -gt 0; do
>case $1 in
>  --help) echo "$usage"; exit 0;;
>  --version) echo "$version"; exit 0;;
>  --prefix) shift; prefix="$1";;
> +--fallback) shift; fallback="$1";;
>  -*)
>echo "$0: Unknown option '$1'." >&2
>echo "$0: Try '--help' for more information." >&2
> @@ -184,8 +187,10 @@
>  # Remove the "g" in git describe's output string, to save a byte.
>  v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
>  v_from_git=1
> -else
> +elif test -z "$fallback" || git --version >& /dev/null; then
>  v=UNKNOWN
> +else
> +v=$fallback

Again, I'm not sure if $fallback makes sense, since the .tarball-version
file is already supposed to provide that.

>  fi
>  
>  v=`echo "$v" |sed "s/^$prefix//"`
> --- gnulib/top/maint.mk.orig  2012-10-02 17:10:43.846614700 +0200
> +++ gnulib/top/maint.mk   2012-10-18 14:41:53.433652900 +0200
> @@ -1327,7 +1327,7 @@
>  
>  .PHONY: no-submodule-changes
>  no-submodule-changes:
> - $(AM_V_GEN)if test -d $(srcdir)/.git; then  \
> + $(AM_V_GEN)if test -d $(srcdir)/.git && git --version >& /dev/null; 
> then \
> diff=$$(cd $(srcdir) && git submodule -q foreach  \

However, this change probably makes sense in gnulib.

> git diff-index --name-only HEAD)  \
>   || exit 1;  \
> @@ -1345,7 +1345,7 @@
>  # cannot be built from a fresh clone.
>  .PHONY: public-submodule-commit
>  public-submodule-commit:
> - $(AM_V_GEN)if test -d $(srcdir)/.git; then  \
> + $(AM_V_GEN)if test -d $(srcdir)/.git && git --version >& /dev/null; 
> then \

As does this (although wrapping both changes to avoid long lines would
be preferable).

> cd $(srcdir) &&   \
> git submodule --quiet foreach test '$$(git rev-parse $$sha1)' \
> = '$$(git merge-base origin $$sha1)'  \
> 
> 
> 

-- 
Eric Blake   ebl...@redhat.com+1-919-301-3266
Libvirt virtualization library http://libvirt.org



signature.asc
Description: OpenPGP digital signature


git-version-gen w/o git

2012-10-18 Thread Peter Rosin
Hi!

I used to use a libtool git checkout from a platform that lacks
git [MSYS], but that broke at some point. I would like something
like the below to unbreak my work flow.

Please?

Cheers,
Peter

diff --git a/Makefile.am b/Makefile.am
index 176325c..3bcb419 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -46,7 +46,7 @@ EXTRA_LTLIBRARIES =
 # Using `cd' in backquotes may print the directory name, use this instead:
 lt__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
 
-git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '.tarball-version'
+git_version_gen = '$(SHELL)' '$(aux_dir)/git-version-gen' '--fallback' 
'$(VERSION)' '.tarball-version'
 rebuild = rebuild=:; revision=`$(lt__cd) $(srcdir) && $(git_version_gen) | sed 
's|-.*$$||g'`
 
 
@@ -128,8 +128,10 @@ $(ltversion_m4): $(ltversion_in) $(dotversion)
done; \
if $$rebuild; then \
  rm -f '$@'; \
- if test -f '$(srcdir)/.serial'; then \
-   serial=`cat '$(srcdir)/.serial'`; \
+ if test -d '$(srcdir)/.git' && git --version >& /dev/null; then \
+   $(git_commit_count) > '$(srcdir)/.serial'; \
+ fi; \
+ serial=`cat '$(srcdir)/.serial'`; \
  else \
serial=`$(git_commit_count)`; \
  fi; \



And then some support for that in gnulib:

--- gnulib/build-aux/git-version-gen.orig   2012-10-02 17:10:58.935840500 
+0200
+++ gnulib/build-aux/git-version-gen2012-10-18 14:41:57.45846 +0200
@@ -86,6 +86,7 @@
 Options:
 
--prefix   prefix of git tags (default 'v')
+   --fallback fallback version to use if \"git --version\" fails
 
--help display this help and exit
--version  output version information and exit
@@ -93,12 +94,14 @@
 Running without arguments will suffice in most cases."
 
 prefix=v
+fallback=
 
 while test $# -gt 0; do
   case $1 in
 --help) echo "$usage"; exit 0;;
 --version) echo "$version"; exit 0;;
 --prefix) shift; prefix="$1";;
+--fallback) shift; fallback="$1";;
 -*)
   echo "$0: Unknown option '$1'." >&2
   echo "$0: Try '--help' for more information." >&2
@@ -184,8 +187,10 @@
 # Remove the "g" in git describe's output string, to save a byte.
 v=`echo "$v" | sed 's/-/./;s/\(.*\)-g/\1-/'`;
 v_from_git=1
-else
+elif test -z "$fallback" || git --version >& /dev/null; then
 v=UNKNOWN
+else
+v=$fallback
 fi
 
 v=`echo "$v" |sed "s/^$prefix//"`
--- gnulib/top/maint.mk.orig2012-10-02 17:10:43.846614700 +0200
+++ gnulib/top/maint.mk 2012-10-18 14:41:53.433652900 +0200
@@ -1327,7 +1327,7 @@
 
 .PHONY: no-submodule-changes
 no-submodule-changes:
-   $(AM_V_GEN)if test -d $(srcdir)/.git; then  \
+   $(AM_V_GEN)if test -d $(srcdir)/.git && git --version >& /dev/null; 
then \
  diff=$$(cd $(srcdir) && git submodule -q foreach  \
  git diff-index --name-only HEAD)  \
|| exit 1;  \
@@ -1345,7 +1345,7 @@
 # cannot be built from a fresh clone.
 .PHONY: public-submodule-commit
 public-submodule-commit:
-   $(AM_V_GEN)if test -d $(srcdir)/.git; then  \
+   $(AM_V_GEN)if test -d $(srcdir)/.git && git --version >& /dev/null; 
then \
  cd $(srcdir) &&   \
  git submodule --quiet foreach test '$$(git rev-parse $$sha1)' \
  = '$$(git merge-base origin $$sha1)'  \



libtool: fix spelling nit

2012-10-18 Thread Peter Rosin
Hi!

I have pushed the below patch.

Cheers,
Peter

>From cfcb7afd26a2c41f3dae62766002cac570417c77 Mon Sep 17 00:00:00 2001
From: Peter Rosin 
Date: Thu, 18 Oct 2012 14:27:10 +0200
Subject: [PATCH] libtool: fix spelling nit

* build-aux/ltmain.in (func_generate_dlsyms): Fix spelling nit.
* libltdl/libltdl/lt_system.h: Likewise.
* m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Likewise.

Signed-off-by: Peter Rosin 
---
 build-aux/ltmain.in |2 +-
 libltdl/libltdl/lt_system.h |2 +-
 m4/libtool.m4   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 7ea2995..e48e45f 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -2652,7 +2652,7 @@ extern \"C\" {
 
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  
*/
 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
 #elif defined __osf__
diff --git a/libltdl/libltdl/lt_system.h b/libltdl/libltdl/lt_system.h
index 1a0de98..f8aa732 100644
--- a/libltdl/libltdl/lt_system.h
+++ b/libltdl/libltdl/lt_system.h
@@ -78,7 +78,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  
*/
 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
 #elif defined __osf__
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index c234f16..2dac8a1 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3730,7 +3730,7 @@ _LT_EOF
  cat <<_LT_EOF > conftest.$ac_ext
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  
*/
 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT@&t@_DLSYM_CONST
 #elif defined __osf__
-- 
1.7.9

>From cfcb7afd26a2c41f3dae62766002cac570417c77 Mon Sep 17 00:00:00 2001
From: Peter Rosin 
Date: Thu, 18 Oct 2012 14:27:10 +0200
Subject: [PATCH] libtool: fix spelling nit

* build-aux/ltmain.in (func_generate_dlsyms): Fix spelling nit.
* libltdl/libltdl/lt_system.h: Likewise.
* m4/libtool.m4 (_LT_CMD_GLOBAL_SYMBOLS): Likewise.

Signed-off-by: Peter Rosin 
---
 build-aux/ltmain.in |2 +-
 libltdl/libltdl/lt_system.h |2 +-
 m4/libtool.m4   |2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
index 7ea2995..e48e45f 100644
--- a/build-aux/ltmain.in
+++ b/build-aux/ltmain.in
@@ -2652,7 +2652,7 @@ extern \"C\" {
 
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
 #elif defined __osf__
diff --git a/libltdl/libltdl/lt_system.h b/libltdl/libltdl/lt_system.h
index 1a0de98..f8aa732 100644
--- a/libltdl/libltdl/lt_system.h
+++ b/libltdl/libltdl/lt_system.h
@@ -78,7 +78,7 @@ or obtained by writing to the Free Software Foundation, Inc.,
 
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT_DLSYM_CONST
 #elif defined __osf__
diff --git a/m4/libtool.m4 b/m4/libtool.m4
index c234f16..2dac8a1 100644
--- a/m4/libtool.m4
+++ b/m4/libtool.m4
@@ -3730,7 +3730,7 @@ _LT_EOF
 	  cat <<_LT_EOF > conftest.$ac_ext
 /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests.  */
 #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
+/* DATA imports from DLLs on WIN32 can't be const, because runtime
relocations are performed -- see ld's documentation on pseudo-relocs.  */
 # define LT@&t@_DLSYM_CONST
 #elif defined __osf__
-- 
1.7.9