Discussion:
[PATCH] bootstrap: Fix get_version() for AIX 5.3
(too old to reply)
Eric Blake
2016-11-03 18:57:15 UTC
Permalink
Raw Message
* build-aux/bootstrap (get_version): Factor out sed script, since
indented comments choke AIX 5.3 sed.
Reported-by: Michael Felt <***@gmail.com>

Signed-off-by: Eric Blake <***@redhat.com>
---

Michael, can you confirm that this version of bootstrap works
for your environment? The next step is for me to push this commit
to gnulib, then update netcf to the latest gnulib.

ChangeLog | 7 +++++++
build-aux/bootstrap | 38 ++++++++++++++++++++------------------
2 files changed, 27 insertions(+), 18 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fecb478..de488ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2016-11-03 Eric Blake <***@redhat.com>
+
+ bootstrap: Fix get_version() for AIX 5.3
+ * build-aux/bootstrap (get_version): Factor out sed script, since
+ indented comments choke AIX 5.3 sed.
+ Reported-by: Michael Felt <***@gmail.com>
+
2016-11-02 Pádraig Brady <***@draigBrady.com>

backupfile: initialize default suffix within the implementation
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index f060bab..5d3c289 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
#! /bin/sh
# Print a version string.
-scriptversion=2016-01-24.06; # UTC
+scriptversion=2016-11-03.18; # UTC

# Bootstrap this package from checked-out sources.

@@ -418,28 +418,30 @@ sort_ver() { # sort -V is not generally available
done
}

+get_version_sed='
+# Move version to start of line.
+s/.*[v ]\([0-9]\)/\1/
+
+# Skip lines that do not start with version.
+/^[0-9]/!d
+
+# Remove characters after the version.
+s/[^.a-z0-9-].*//
+
+# The first component must be digits only.
+s/^\([0-9]*\)[a-z-].*/\1/
+
+#the following essentially does s/5.005/5.5/
+s/\.0*\([1-9]\)/.\1/g
+p
+q'
+
get_version() {
app=$1

$app --version >/dev/null 2>&1 || { $app --version; return 1; }

- $app --version 2>&1 |
- sed -n '# Move version to start of line.
- s/.*[v ]\([0-9]\)/\1/
-
- # Skip lines that do not start with version.
- /^[0-9]/!d
-
- # Remove characters after the version.
- s/[^.a-z0-9-].*//
-
- # The first component must be digits only.
- s/^\([0-9]*\)[a-z-].*/\1/
-
- #the following essentially does s/5.005/5.5/
- s/\.0*\([1-9]\)/.\1/g
- p
- q'
+ $app --version 2>&1 | sed -n "$get_version_sed"
}

check_versions() {
--
2.7.4
Loading...