bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] bootstrap: support a prereq of 'rpcgen -' on RHEL5


From: Eric Blake
Subject: [PATCH] bootstrap: support a prereq of 'rpcgen -' on RHEL5
Date: Wed, 11 May 2011 11:32:59 -0600

On RHEL 5, 'rpcgen --version' spews usage to stderr with status 1,
rather than a version string to stdout with status 0.  But libvirt
merely requires a prereq of 'rpcgen -' - that is, it must exist,
but need not have a well-behaved --version.

* build-aux/bootstrap (check_versions): When no specific version
is required, merely check that the app produces an exit status
that indicates its existence.

Signed-off-by: Eric Blake <address@hidden>
---
 ChangeLog           |    5 +++++
 build-aux/bootstrap |   31 +++++++++++++++++++++----------
 2 files changed, 26 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e26d257..f4d78dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2011-05-11  Eric Blake  <address@hidden>

+       bootstrap: support a prereq of 'rpcgen -' on RHEL5
+       * build-aux/bootstrap (check_versions): When no specific version
+       is required, merely check that the app produces an exit status
+       that indicates its existence.
+
        maint.mk: drop redundant check
        * top/maint.mk (sc_the_the): Delete; sc_prohibit_doubled_word does
        the same but better.
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index d91611b..d32db57 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2011-05-03.08; # UTC
+scriptversion=2011-05-11.17; # UTC

 # Bootstrap this package from checked-out sources.

@@ -425,17 +425,28 @@ check_versions() {
         GZIP) ;; # Do not use $GZIP:  it contains gzip options.
         *) eval "app=\${$appvar-$app}" ;;
     esac
-    inst_ver=$(get_version $app)
-    if [ ! "$inst_ver" ]; then
-      echo "$me: Error: '$app' not found" >&2
-      ret=1
-    elif [ ! "$req_ver" = "-" ]; then
-      latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
-      if [ ! "$latest_ver" = "$inst_ver" ]; then
-        echo "$me: Error: '$app' version == $inst_ver is too old" >&2
-        echo "       '$app' version >= $req_ver is required" >&2
+    if [ "$req_ver" = "-" ]; then
+      # Merely require app to exist; not all prereq apps are well-behaved
+      # so we have to rely on $? rather than get_version.
+      $app --version >/dev/null 2>&1
+      if [ 126 -le $? ]; then
+        echo "$me: Error: '$app' not found" >&2
         ret=1
       fi
+    else
+      # Require app to produce a new enough version string.
+      inst_ver=$(get_version $app)
+      if [ ! "$inst_ver" ]; then
+        echo "$me: Error: '$app' not found" >&2
+        ret=1
+      else
+        latest_ver=$(sort_ver $req_ver $inst_ver | cut -d' ' -f2)
+        if [ ! "$latest_ver" = "$inst_ver" ]; then
+          echo "$me: Error: '$app' version == $inst_ver is too old" >&2
+          echo "       '$app' version >= $req_ver is required" >&2
+          ret=1
+        fi
+      fi
     fi
   done

-- 
1.7.4.4




reply via email to

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