On 08/09/2013 01:55 PM, Mike Miller wrote:
> On Fri, Aug 09, 2013 at 04:52:40AM +0100, Pádraig Brady wrote:
>> On 08/09/2013 03:23 AM, Mike Miller wrote:
>>> Thanks for the suggestion. I did try SHA1SUM=sha1, but that still
>>> won't work with bootstrap since find_tool() requires that $tool
>>> understand the --version option. That was mentioned earlier in the
>>> bug
>>> report linked above.
>>
>> Oh that's a bit of a buglet then, as --version isn't required
>> unless a version is specified in the requirements.
>>
>> Does SHA1SUM=sha1 work after applying...
>>
>> commit 2c519cd635d46d314cd991b1a011464f7345c5fa
>> [...]
> 
> Yes, that works perfectly. Of course, the code that uses sha1sum isn't
> being exercised on my project. I ran it against bison instead and it
> looks like it works now with sha1.
> 
> Another fix might be to move "find_tool SHA1SUM" into the narrow case
> where it's actually used. It is not required unless a project has a po
> directory.

Excellent. I intend to push the attached change to bootstrap so,
that includes sha1 in the list now it's compatible, so therefore
not requiring one to set SHA1SUM on BSD at all.

Also I've implemented the optimization not to look for sha1sum
at all, when not updating po files.

thanks,
Pádraig.
>From ad454d54bb631c2ce5db560e1283364f43461cfe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Thu, 8 Aug 2013 11:08:49 +0100
Subject: [PATCH] bootstrap: support checksum utils having -c but not --status

* build-aux/bootstrap: Only look for sha1sum if updating po files.
(update_po_files): Remove the use of --status
in a way that will suppress all error messages, but since this is
only used to minimize updates, it shouldn't cause an issue.
Also exit early if there is a problem updating the po file checksums.
(find_tool): Remove the check for --version support as this
is optional as per commit 86186b17
Prompt when a tool isn't found, that one can define an environment
variable to add to the hardcoded search list.
---
 build-aux/bootstrap |   35 +++++++++++++++++------------------
 1 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 9c52204..8d2487a 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2013-07-03.20; # UTC
+scriptversion=2013-08-09.15; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -224,27 +224,21 @@ find_tool ()
   find_tool_names=$@
   eval "find_tool_res=\$$find_tool_envvar"
   if test x"$find_tool_res" = x; then
-    for i
-    do
+    for i; do
       if ($i --version </dev/null) >/dev/null 2>&1; then
-       find_tool_res=$i
-       break
+        find_tool_res=$i
+        break
       fi
     done
-  else
-    find_tool_error_prefix="\$$find_tool_envvar: "
   fi
-  test x"$find_tool_res" != x \
-    || die "one of these is required: $find_tool_names"
-  ($find_tool_res --version </dev/null) >/dev/null 2>&1 \
-    || die "${find_tool_error_prefix}cannot run $find_tool_res --version"
+  if test x"$find_tool_res" = x; then
+    warn_ "one of these is required: $find_tool_names;"
+    die   "alternatively set $find_tool_envvar to a compatible tool"
+  fi
   eval "$find_tool_envvar=\$find_tool_res"
   eval "export $find_tool_envvar"
 }
 
-# Find sha1sum, named gsha1sum on MacPorts, and shasum on Mac OS X 10.6.
-find_tool SHA1SUM sha1sum gsha1sum shasum
-
 # Override the default configuration, if necessary.
 # Make sure that bootstrap.conf is sourced from the current directory
 # if we were invoked as "sh bootstrap".
@@ -469,7 +463,7 @@ check_versions() {
     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
+      $app --version >/dev/null 2>&1 </dev/null
       if [ 126 -le $? ]; then
         warn_ "Error: '$app' not found"
         ret=1
@@ -503,6 +497,12 @@ print_versions() {
   # can't depend on column -t
 }
 
+# Find sha1sum, named gsha1sum on MacPorts, shasum on Mac OS X 10.6.
+# Also find the compatible sha1 utility on the BSDs
+if test x"$SKIP_PO" = x; then
+  find_tool SHA1SUM sha1sum gsha1sum shasum sha1
+fi
+
 use_libtool=0
 # We'd like to use grep -E, to see if any of LT_INIT,
 # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac,
@@ -692,11 +692,10 @@ update_po_files() {
     cksum_file="$ref_po_dir/$po.s1"
     if ! test -f "$cksum_file" ||
         ! test -f "$po_dir/$po.po" ||
-        ! $SHA1SUM -c --status "$cksum_file" \
-            < "$new_po" > /dev/null; then
+        ! $SHA1SUM -c "$cksum_file" < "$new_po" > /dev/null 2>&1; then
       echo "$me: updated $po_dir/$po.po..."
       cp "$new_po" "$po_dir/$po.po" \
-          && $SHA1SUM < "$new_po" > "$cksum_file"
+          && $SHA1SUM < "$new_po" > "$cksum_file" || return
     fi
   done
 }
-- 
1.7.7.6

Reply via email to