bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] bootstrap: handle perl-5.11's changed --version output


From: Pádraig Brady
Subject: Re: [PATCH] bootstrap: handle perl-5.11's changed --version output
Date: Mon, 30 Nov 2009 12:33:25 +0000
User-agent: Thunderbird 2.0.0.6 (X11/20071008)

Jim Meyering wrote:
> with F12's 5.10.0, I see this:
> 
>     $ perl -le 'print $]'
>     5.010000

I didn't use $] in the adjusted get_version() I sent :)

> So $^V appears to be out.
> 
> Want to write the patch?
> There must be something canonical and "easy" in Perl itself, considering
> the prevalence of the desired version string, e.g. in perl's own search path.

Well I couldn't see any and just resorted to parsing
`perl --version` as before. So the attached patch just
uses the get_version() I previously sent in this thread
(which also handles the output from 5.11.2-81...)

cheers,
Pádraig.
>From 85495fa62a21455f3a89184a929e59ab45c12d37 Mon Sep 17 00:00:00 2001
From: =?utf-8?q?P=C3=A1draig=20Brady?= <address@hidden>
Date: Mon, 30 Nov 2009 12:29:03 +0000
Subject: [PATCH] bootstrap: fix handling of various perl --version formats

* build-aux/bootstrap (get_version): Don't use perl's $] special
variable, as that requires updating all bootstrap.conf files to
use perl's x.yyyzzz version format.  Instead make the regular
expression more general to support version formats from older
perl-5.005_002 (5.5.2) and perl-5.11 which has other numbers
in the version line.
---
 build-aux/bootstrap |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 7c4882d..dd21325 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -311,20 +311,23 @@ sort_ver() { # sort -V is not generally available
 get_version() {
   app=$1
 
-  # perl 5.11's --version output does not fit the mold,
-  # handle perl as a special case.
-  if test "_$app" = _perl; then
-      perl -le 'print $]' || return 1
-      return 0
-  fi
-
   $app --version >/dev/null 2>&1 || return 1
 
   $app --version 2>&1 |
-  sed -n 's/[^0-9.]*\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/p
+  sed -n '# extract version within line
+          s/.*[v ]\{1,\}\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
+          t done
+
+          # extract version at start of line
+          s/^\([0-9]\{1,\}\.[.a-z0-9-]*\).*/\1/
           t done
+
           d
+
           :done
+          #the following essentially does s/5.005/5.5/
+          s/\.0*\([1-9]\)/.\1/g
+          p
           q'
 }
 
-- 
1.6.2.5


reply via email to

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