bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 5/6] Support packages with just 'bootstrap'


From: Paul Eggert
Subject: [PATCH 5/6] Support packages with just 'bootstrap'
Date: Tue, 27 Dec 2022 11:00:01 -0800

* top/bootstrap: With --version, also output library version.
Support update of package that has only the bootstrap script,
and not the other three files.
* top/bootstrap-funclib.sh (scriptlibversion): Rename
from scriptversion.  All uses changed.  This way we
can distinguish script from script library versions.
(upgrade_bootstrap): If the package currently has only
the bootstrap script, just update that.
---
 ChangeLog                | 10 +++++++++
 build-aux/bootstrap      | 46 +++++++++++++++++++++-------------------
 top/bootstrap            | 10 ++-------
 top/bootstrap-funclib.sh | 34 ++++++++++++++++++-----------
 top/gen-bootstrap.sed    |  4 ----
 5 files changed, 58 insertions(+), 46 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 53c645a55f..331e31a68b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2022-12-27  Paul Eggert  <eggert@cs.ucla.edu>
 
+       Support packages with just 'bootstrap'
+       * top/bootstrap: With --version, also output library version.
+       Support update of package that has only the bootstrap script,
+       and not the other three files.
+       * top/bootstrap-funclib.sh (scriptlibversion): Rename
+       from scriptversion.  All uses changed.  This way we
+       can distinguish script from script library versions.
+       (upgrade_bootstrap): If the package currently has only
+       the bootstrap script, just update that.
+
        Bootstrap with functions, not scripts
        * top/bootstrap: Use autopull and autogen functions, not
        shell scripts.  This lets build-aux/bootstrap become a
diff --git a/build-aux/bootstrap b/build-aux/bootstrap
index 2c81b0f26e..d40cd01162 100755
--- a/build-aux/bootstrap
+++ b/build-aux/bootstrap
@@ -1,11 +1,9 @@
 #! /bin/sh
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
-# This script is only a trampoline that fetches the companion scripts
-# (bootstrap-funclib.sh, autopull.sh, autogen.sh).
 
 # Bootstrap this package from checked-out sources.
 
-scriptversion=2022-12-27.04; # UTC
+scriptversion=2022-12-27.05; # UTC
 
 # Copyright (C) 2003-2022 Free Software Foundation, Inc.
 #
@@ -39,7 +37,7 @@ medir=`dirname "$me"`
 
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptversion=2022-12-27.16; # UTC
+scriptlibversion=2022-12-27.16; # UTC
 
 # Copyright (C) 2003-2022 Free Software Foundation, Inc.
 #
@@ -77,7 +75,7 @@ PERL="${PERL-perl}"
 default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
 
 # Copyright year, for the --version output.
-copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright_year=`echo "$scriptlibversion" | sed -e 's/[^0-9].*//'`
 copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
 This is free software: you are free to change and redistribute it.
@@ -593,18 +591,28 @@ prepare_GNULIB_SRCDIR ()
 
 upgrade_bootstrap ()
 {
-  { cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \
-    && cmp -s "$medir"/bootstrap-funclib.sh 
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \
-    && cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \
-    && cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \
-  } || {
-    echo "$0: updating bootstrap & companions and restarting..."
+  if test -f "$medir"/bootstrap-funclib.sh; then
+    update_lib=true
+    { cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \
+      && cmp -s "$medir"/bootstrap-funclib.sh 
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \
+      && cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \
+      && cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \
+    }
+  else
+    update_lib=false
+    cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/build-aux/bootstrap"
+  fi || {
+    if $update_lib; then
+      echo "$0: updating bootstrap & companions and restarting..."
+    else
+      echo "$0: updating bootstrap and restarting..."
+    fi
     case $(sh -c 'echo "$1"' -- a) in
       a) ignored=--;;
       *) ignored=ignored;;
     esac
     exec sh -c \
-      '{ if test -f "$1"; then cp "$1" "$3"; else cp "$2" "$3"; fi; } && { if 
test -f "$4"; then cp "$4" "$5"; else rm -f "$5"; fi; } && { if test -f "$6"; 
then cp "$6" "$7"; else rm -f "$7"; fi; } && { if test -f "$8"; then cp "$8" 
"$9"; else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && 
shift && shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
+      '{ if '$update_lib' && test -f "$1"; then cp "$1" "$3"; else cp "$2" 
"$3"; fi; } && { if '$update_lib' && test -f "$4"; then cp "$4" "$5"; else rm 
-f "$5"; fi; } && { if '$update_lib' && test -f "$6"; then cp "$6" "$7"; else 
rm -f "$7"; fi; } && { if '$update_lib' && test -f "$8"; then cp "$8" "$9"; 
else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && shift && 
shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
       $ignored \
       "$GNULIB_SRCDIR/top/bootstrap" "$GNULIB_SRCDIR/build-aux/bootstrap" 
"$medir/bootstrap" \
       "$GNULIB_SRCDIR/top/bootstrap-funclib.sh" "$medir/bootstrap-funclib.sh" \
@@ -719,7 +727,7 @@ autopull()
       return;;
     --version)
       set -e
-      echo "autopull.sh $scriptversion"
+      echo "autopull.sh $scriptlibversion"
       echo "$copyright"
       return 0
       ;;
@@ -1051,7 +1059,7 @@ autogen()
       return;;
     --version)
       set -e
-      echo "autogen.sh $scriptversion"
+      echo "autogen.sh $scriptlibversion"
       echo "$copyright"
       return 0
       ;;
@@ -1307,7 +1315,7 @@ autogen()
 
 # Local Variables:
 # eval: (add-hook 'before-save-hook 'time-stamp)
-# time-stamp-start: "scriptversion="
+# time-stamp-start: "scriptlibversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
@@ -1411,7 +1419,7 @@ do
     exit;;
   --version)
     set -e
-    echo "bootstrap $scriptversion"
+    echo "bootstrap $scriptversion lib $scriptlibversion"
     echo "$copyright"
     exit 0
     ;;
@@ -1447,12 +1455,6 @@ fi
 
 check_build_prerequisites $use_git
 
-if ! test -f "$medir"/bootstrap-funclib.sh; then
-  # We have only completed the first phase of an upgrade from a bootstrap
-  # version < 2022-07-24. Need to do the second phase now.
-  bootstrap_sync=true
-fi
-
 if $bootstrap_sync; then
   prepare_GNULIB_SRCDIR
   upgrade_bootstrap
diff --git a/top/bootstrap b/top/bootstrap
index a4246c7e80..365c378d42 100755
--- a/top/bootstrap
+++ b/top/bootstrap
@@ -1,7 +1,7 @@
 #! /bin/sh
 # Bootstrap this package from checked-out sources.
 
-scriptversion=2022-12-27.04; # UTC
+scriptversion=2022-12-27.05; # UTC
 
 # Copyright (C) 2003-2022 Free Software Foundation, Inc.
 #
@@ -132,7 +132,7 @@ do
     exit;;
   --version)
     set -e
-    echo "bootstrap $scriptversion"
+    echo "bootstrap $scriptversion lib $scriptlibversion"
     echo "$copyright"
     exit 0
     ;;
@@ -168,12 +168,6 @@ fi
 
 check_build_prerequisites $use_git
 
-if ! test -f "$medir"/bootstrap-funclib.sh; then
-  # We have only completed the first phase of an upgrade from a bootstrap
-  # version < 2022-07-24. Need to do the second phase now.
-  bootstrap_sync=true
-fi
-
 if $bootstrap_sync; then
   prepare_GNULIB_SRCDIR
   upgrade_bootstrap
diff --git a/top/bootstrap-funclib.sh b/top/bootstrap-funclib.sh
index 802ef2ba92..76e5f30b19 100644
--- a/top/bootstrap-funclib.sh
+++ b/top/bootstrap-funclib.sh
@@ -1,6 +1,6 @@
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptversion=2022-12-27.16; # UTC
+scriptlibversion=2022-12-27.16; # UTC
 
 # Copyright (C) 2003-2022 Free Software Foundation, Inc.
 #
@@ -38,7 +38,7 @@ PERL="${PERL-perl}"
 default_gnulib_url=https://git.savannah.gnu.org/git/gnulib.git
 
 # Copyright year, for the --version output.
-copyright_year=`echo "$scriptversion" | sed -e 's/[^0-9].*//'`
+copyright_year=`echo "$scriptlibversion" | sed -e 's/[^0-9].*//'`
 copyright="Copyright (C) ${copyright_year} Free Software Foundation, Inc.
 License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>.
 This is free software: you are free to change and redistribute it.
@@ -554,18 +554,28 @@ prepare_GNULIB_SRCDIR ()
 
 upgrade_bootstrap ()
 {
-  { cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \
-    && cmp -s "$medir"/bootstrap-funclib.sh 
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \
-    && cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \
-    && cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \
-  } || {
-    echo "$0: updating bootstrap & companions and restarting..."
+  if test -f "$medir"/bootstrap-funclib.sh; then
+    update_lib=true
+    { cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/top/bootstrap" \
+      && cmp -s "$medir"/bootstrap-funclib.sh 
"$GNULIB_SRCDIR/top/bootstrap-funclib.sh" \
+      && cmp -s "$medir"/autopull.sh "$GNULIB_SRCDIR/top/autopull.sh" \
+      && cmp -s "$medir"/autogen.sh "$GNULIB_SRCDIR/top/autogen.sh"; \
+    }
+  else
+    update_lib=false
+    cmp -s "$medir"/bootstrap "$GNULIB_SRCDIR/build-aux/bootstrap"
+  fi || {
+    if $update_lib; then
+      echo "$0: updating bootstrap & companions and restarting..."
+    else
+      echo "$0: updating bootstrap and restarting..."
+    fi
     case $(sh -c 'echo "$1"' -- a) in
       a) ignored=--;;
       *) ignored=ignored;;
     esac
     exec sh -c \
-      '{ if test -f "$1"; then cp "$1" "$3"; else cp "$2" "$3"; fi; } && { if 
test -f "$4"; then cp "$4" "$5"; else rm -f "$5"; fi; } && { if test -f "$6"; 
then cp "$6" "$7"; else rm -f "$7"; fi; } && { if test -f "$8"; then cp "$8" 
"$9"; else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && 
shift && shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
+      '{ if '$update_lib' && test -f "$1"; then cp "$1" "$3"; else cp "$2" 
"$3"; fi; } && { if '$update_lib' && test -f "$4"; then cp "$4" "$5"; else rm 
-f "$5"; fi; } && { if '$update_lib' && test -f "$6"; then cp "$6" "$7"; else 
rm -f "$7"; fi; } && { if '$update_lib' && test -f "$8"; then cp "$8" "$9"; 
else rm -f "$9"; fi; } && shift && shift && shift && shift && shift && shift && 
shift && shift && shift && exec "${CONFIG_SHELL-/bin/sh}" "$@"' \
       $ignored \
       "$GNULIB_SRCDIR/top/bootstrap" "$GNULIB_SRCDIR/build-aux/bootstrap" 
"$medir/bootstrap" \
       "$GNULIB_SRCDIR/top/bootstrap-funclib.sh" "$medir/bootstrap-funclib.sh" \
@@ -680,7 +690,7 @@ autopull()
       return;;
     --version)
       set -e
-      echo "autopull.sh $scriptversion"
+      echo "autopull.sh $scriptlibversion"
       echo "$copyright"
       return 0
       ;;
@@ -1012,7 +1022,7 @@ autogen()
       return;;
     --version)
       set -e
-      echo "autogen.sh $scriptversion"
+      echo "autogen.sh $scriptlibversion"
       echo "$copyright"
       return 0
       ;;
@@ -1268,7 +1278,7 @@ autogen()
 
 # Local Variables:
 # eval: (add-hook 'before-save-hook 'time-stamp)
-# time-stamp-start: "scriptversion="
+# time-stamp-start: "scriptlibversion="
 # time-stamp-format: "%:y-%02m-%02d.%02H"
 # time-stamp-time-zone: "UTC0"
 # time-stamp-end: "; # UTC"
diff --git a/top/gen-bootstrap.sed b/top/gen-bootstrap.sed
index c182abfa50..434e6147fa 100644
--- a/top/gen-bootstrap.sed
+++ b/top/gen-bootstrap.sed
@@ -2,10 +2,6 @@
 a\
 # DO NOT EDIT! GENERATED AUTOMATICALLY!
 a\
-# This script is only a trampoline that fetches the companion scripts
-a\
-# (bootstrap-funclib.sh, autopull.sh, autogen.sh).
-a\
 
 }
 /^[.] "[$]medir"[/]bootstrap-funclib.sh/{
-- 
2.25.1




reply via email to

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