bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] bootstrap: add bootstrap_sync option.


From: Joel E. Denny
Subject: Re: [PATCH] bootstrap: add bootstrap_sync option.
Date: Fri, 19 Nov 2010 23:27:08 -0500 (EST)
User-agent: Alpine 1.00 (DEB 882 2007-12-20)

Hi,

On Wed, 17 Nov 2010, Ralf Wildenhues wrote:

> * Paolo Bonzini wrote on Wed, Nov 17, 2010 at 01:22:25PM CET:
> > On 11/15/2010 11:06 PM, Ralf Wildenhues wrote:
> > >What might work is have bootstrap exec a temporary script that updates
> > >bootstrap then exec's that again.
> > 
> > Something like this
> > 
> > exec sh -c 'mv tmp-script this-script; exec sh this-script "$@"' -- "$@"
> 
> That looks good to me, with '&&' instead of ';'.

Thanks to everyone for the input.  How about the following patch?  I 
foresee two minor issues:

1. If someone does "bash bootstrap", I'm not sure how to detect that in 
order to do it again in the exec.

2. As Paul mentioned, if a project's bootstrap is a sym link, the target 
of the sym link will be overwritten.  If that's not the desired behavior, 
then I'm not sure what the right behavior is, and that project can just 
leave bootstrap_sync disabled.

>From 17fdf63c0175e872a6f5167c03bb2a0b0dfd0582 Mon Sep 17 00:00:00 2001
From: Joel E. Denny <address@hidden>
Date: Fri, 19 Nov 2010 22:19:59 -0500
Subject: [PATCH] bootstrap: add bootstrap_sync option.

See discussion at
<http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00369.html>,
<http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00200.html>.
* build-aux/bootstrap: Accept --bootstrap-sync to update
bootstrap if it is not identical to the local gnulib's
bootstrap.  Accept bootstrap_sync=true in bootstrap.conf to
enable this by default.  Accept --no-bootstrap-sync to disable
it.
---
 ChangeLog           |   12 ++++++++++++
 build-aux/bootstrap |   22 +++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9dbc0c2..58e4e20 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2010-11-19  Joel E. Denny  <address@hidden>
+
+       bootstrap: add bootstrap_sync option.
+       See discussion at
+       <http://lists.gnu.org/archive/html/bug-gnulib/2010-10/msg00369.html>,
+       <http://lists.gnu.org/archive/html/bug-gnulib/2010-11/msg00200.html>.
+       * build-aux/bootstrap: Accept --bootstrap-sync to update
+       bootstrap if it is not identical to the local gnulib's
+       bootstrap.  Accept bootstrap_sync=true in bootstrap.conf to
+       enable this by default.  Accept --no-bootstrap-sync to disable
+       it.
+
 2010-11-19  Paul Eggert  <address@hidden>
 
        ftoastr: don't assume snprintf
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 12fec20..1aed793 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Print a version string.
-scriptversion=2010-11-12.21; # UTC
+scriptversion=2010-11-20.03; # UTC
 
 # Bootstrap this package from checked-out sources.
 
@@ -54,6 +54,10 @@ Options:
                           have gnulib sources on your machine, and
                           do not want to waste your bandwidth downloading
                           them again.  Defaults to \$GNULIB_SRCDIR.
+ --bootstrap-sync         If this bootstrap script is not identical to
+                          the version in the local gnulib sources,
+                          update this script and restart it.
+ --no-bootstrap-sync      Do not check whether bootstrap is out of sync.
  --copy                   Copy files instead of creating symbolic links.
  --force                  Attempt to bootstrap even if the sources seem
                           not to have been checked out.
@@ -168,6 +172,10 @@ copy=false
 # on which version control system (if any) is used in the source directory.
 vc_ignore=auto
 
+# Set this to true in bootstrap.conf to enable --bootstrap-sync by
+# default.
+bootstrap_sync=false
+
 # find_tool ENVVAR NAMES...
 # -------------------------
 # Search for a required program.  Use the value of ENVVAR, if set,
@@ -239,6 +247,10 @@ do
     checkout_only_file=;;
   --copy)
     copy=true;;
+  --bootstrap-sync)
+    bootstrap_sync=true;;
+  --no-bootstrap-sync)
+    bootstrap_sync=false;;
   *)
     echo >&2 "$0: $option: unknown option"
     exit 1;;
@@ -501,6 +513,14 @@ case ${GNULIB_SRCDIR--} in
   ;;
 esac
 
+if $bootstrap_sync; then
+  cmp -s "$0" "$GNULIB_SRCDIR/build-aux/bootstrap" || {
+    echo "$0: updating bootstrap and restarting..."
+    exec sh -c 'cp "$1" "$2" && shift && exec /bin/sh "$@"' -- \
+      "$GNULIB_SRCDIR/build-aux/bootstrap" "$0" "$@"
+  }
+fi
+
 gnulib_tool=$GNULIB_SRCDIR/gnulib-tool
 <$gnulib_tool || exit
 
-- 
1.7.0.4





reply via email to

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