Re: [PATCH v4 2/2] git-version-gen: add --fallback option to use if git is not present

Eric Blake <[email protected]>
Newsgroups gmane.comp.lib.gnulib.bugs,gmane.comp.gnu.libtool.patches
Organization Red Hat, Inc.
Message-ID <[email protected]>
On 12/28/2012 03:13 PM, Peter Rosin wrote:
> When building in a git checkout, but from a system lacking git, it
> is useful to fall back to the version determined when the git
> checkout was last used from a system sporting git.
> 
> * build-aux/git-version-gen: Add support for the new option --fallback,
> which comes into play when there is no $tarball_version_file and
> git is not working.

You didn't really document how to wire up makefiles to properly inject a
decent --fallback option into the script; but I'm at least satisfied
that this patch in isolation doesn't break existing packages that don't
use the --falback option, while leaving the door open for packages that
DO want to support the use of --fallback.

As I understand it, the idea is that you have a shared folder that can
be accessed via multiple machines; on some machines, you have git, and
can therefore do a git checkout that populates Makefile with the right
information for use as a fallback.  On other machines you lack git but
can see the .git directory in the shared directory; since it is still a
development build and you never ran 'make dist', you still want to have
the effect of a devel checkout, rather than building from a tarball, and
if all that git was needed for can be injected from the machine that has
git installed, then the other machine can benefit from the --falback.

I just now noticed v5, so I'll check that out before pushing anything.

I will point out that your script introduces yet another instance of a
non-portable construct:

test -z "$fallback"

Per the Autoconf manual:

     Posix also says that `test ! "STRING"', `test -n "STRING"' and
     `test -z "STRING"' work with any string, but many shells (such as
     Solaris, AIX 3.2, UNICOS 10.0.0.6, Digital Unix 4, etc.) get
     confused if STRING looks like an operator:

          $ test -n =
          test: argument expected
          $ test ! -n
          test: argument expected
          $ test -z ")"; echo $?
          0

However, this idiom is already in use elsewhere in git-version-gen, so
it should be fixed in an independent patch.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc (application/pgp-signature, 619 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBCAAGBQJQ4hWLAAoJEKeha0olJ0NqhGoH+wXypnRBQOWjqCGKssNvhVCq
2cs8wCVPmtmZJTfOePwv0EUfkt0YjcOUAF8uQ6aaaEHJLaUNUrNlsPkKDRxGV8ws
1g0gbtWkTcMayEOK9iMyennIu1MXJ3m1Wz0dS7/P7Mb6F1EdXSFfqT9j4i1cKzDZ
6jwMJYno8hq3s+EqGnVRuJQiN3c5k+kb4C1d07F//lAOKZKpIeO0cUcYDG/sJDy0
WJfjTlXZPCCLo5fiTr2Df7yH3s3ZrtT+S4XM0zluCl9KAwlwqbeDFGVsEm/y1NLg
pzXXCDMoB4bVZ0RsY3ij0V24WpUfZydqgt7R6jqzatkQLfEj6gEb2svh1FD7ixI=
=ygRf
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.