bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Patch to check for required programs when building from source check


From: Eric Blake
Subject: Re: Patch to check for required programs when building from source checkout
Date: Tue, 21 Oct 2008 19:00:27 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.17) Gecko/20080914 Thunderbird/2.0.0.17 Mnenhy/0.7.5.666

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Pádraig Brady on 10/21/2008 4:04 PM:
>     echo "$ver" | sed '
>       s/^\([0-9]\{,\}\)\.\([0-9]\{,\}\)[.0]*$/\1.\2.0/;         #1.10  -> 
> 1.10.0
>       s/^\([0-9]\{,\}\)\.\([0-9]\{,\}\)\([a-z]\)/\1.\2.99\3/;   #1.10a -> 
> 1.10.99a

For what it's worth, Autoconf does this by converting \([0-9]+\)\([a-z]+\)
to \1+1, -1, radix36(\2).  In other words, 1.10a becomes 1.11.-1.10.

- From there, it is a simple numerical comparison, supplying a 0 for any
implicit field, and declaring results at the left-most field that differs:
 1.10.x < 1.11.-1.x, but 1.11.-1 < 1.11.0

Hmm.  Since bootstrap requires the existence of autoconf, why not just use
autoconf, instead of reimplementing this in sed?

echo 'm4_divert(0)m4_version_compare('$ver,$prereq')' \
  | autom4te --language=m4sugar -

outputs -1 if $ver is smaller, 0 if equal, 1 if greater than $prereq.

- --
Don't work too hard, make some time for fun as well!

Eric Blake             address@hidden
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkj+eysACgkQ84KuGfSFAYDRIgCfac1TIX15RSd3k2x7m9Run/VZ
OZUAniSlTlfS0PsVNXO5iH8DZaw5FGMY
=4hbV
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]