From: Paul Eggert <eggert@cs.ucla.edu>
To: bug-gnulib@gnu.org
Cc: Paul Eggert <eggert@cs.ucla.edu>
Subject: [PATCH 5/6] Support packages with just 'bootstrap'
Date: Tue, 27 Dec 2022 11:00:01 -0800 [thread overview]
Message-ID: <20221227190002.5660-7-eggert@cs.ucla.edu> (raw)
In-Reply-To: <20221227190002.5660-1-eggert@cs.ucla.edu>
* 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
next prev parent reply other threads:[~2022-12-27 19:01 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-27 18:59 [PATCH 0/6] build-aux/bootstrap that doesn't need to replace itself Paul Eggert
2022-12-27 18:59 ` [PATCH 1/6] Move scriptversion= lines up in scripts Paul Eggert
2022-12-27 18:59 ` [PATCH] stdnoreturn: deprecate Paul Eggert
2022-12-27 18:59 ` [PATCH 2/6] Make autogen a shell function too Paul Eggert
2022-12-27 18:59 ` [PATCH 3/6] Make autopull " Paul Eggert
2022-12-27 19:00 ` [PATCH 4/6] Bootstrap with functions, not scripts Paul Eggert
2022-12-27 19:00 ` Paul Eggert [this message]
2022-12-27 19:00 ` [PATCH 6/6] Add --pull, --gen options to build-aux/bootstrap Paul Eggert
2022-12-27 21:09 ` [PATCH 0/6] build-aux/bootstrap that doesn't need to replace itself Bruno Haible
2022-12-28 2:16 ` Paul Eggert
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221227190002.5660-7-eggert@cs.ucla.edu \
--to=eggert@cs.ucla.edu \
--cc=bug-gnulib@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).