]> Savannah Git Hosting - gnulib.git/commitdiff
bootstrap: avoid "cd"
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Nov 2024 21:13:47 +0000 (13:13 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Nov 2024 21:33:34 +0000 (13:33 -0800)
* top/bootstrap-funclib.sh: Avoid "cd".  This saves a few
subprocesses and is more likely to yield diagnostics that make
sense to the user.
* build-aux/bootstrap: Regenerate.

ChangeLog
build-aux/bootstrap
top/bootstrap-funclib.sh

index 213714cc52fa83daab90c00abe685ef57abc1230..9473f36f226465d86cbfab72d802dbbd5c7cf526 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2024-11-12  Paul Eggert  <eggert@cs.ucla.edu>
 
+       bootstrap: avoid "cd"
+       * top/bootstrap-funclib.sh: Avoid "cd".  This saves a few
+       subprocesses and is more likely to yield diagnostics that make
+       sense to the user.
+       * build-aux/bootstrap: Regenerate.
+
        bootstrap: go back to old non-submodule semantics
        * top/bootstrap-funclib.sh (prepare_GNULIB_SRCDIR):
        When cloning GNULIB_REFDIR and no submodule 'gnulib' is configured,
index 2e56c624d22963def8fac5990274475bd7034f77..94c07d15fe4b0d4bedd2f0c553475049f34fa5b8 100755 (executable)
@@ -37,7 +37,7 @@ medir=`dirname "$me"`
 
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-11-12.20; # UTC
+scriptlibversion=2024-11-12.21; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -505,11 +505,10 @@ prepare_GNULIB_SRCDIR ()
       # if the GNULIB_REVISION is a commit hash that only exists in
       # origin. In this case, we need a 'git fetch' and then retry
       # 'git checkout "$GNULIB_REVISION"'.
-      (cd "$GNULIB_SRCDIR" \
-       && { git checkout "$GNULIB_REVISION" 2>/dev/null \
-            || { git fetch origin && git checkout "$GNULIB_REVISION"; }
-          }
-      ) || exit $?
+      git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION" 2>/dev/null \
+      || { git -C "$GNULIB_SRCDIR" fetch origin \
+           && git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION"; } \
+      || exit $?
     fi
   else
     if ! $use_git; then
@@ -584,8 +583,7 @@ prepare_GNULIB_SRCDIR ()
             || git -C "$gnulib_path" fetch origin \
             || cleanup_gnulib
           git -C "$gnulib_path" reset --hard FETCH_HEAD
-          (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") \
-            || cleanup_gnulib
+          git -C "$gnulib_path" checkout "$GNULIB_REVISION" || cleanup_gnulib
         fi
         trap - HUP INT PIPE TERM
       else
@@ -598,11 +596,10 @@ prepare_GNULIB_SRCDIR ()
             # if the GNULIB_REVISION is a commit hash that only exists in
             # origin. In this case, we need a 'git fetch' and then retry
             # 'git checkout "$GNULIB_REVISION"'.
-            (cd "$gnulib_path" \
-             && { git checkout "$GNULIB_REVISION" 2>/dev/null \
-                  || { git fetch origin && git checkout "$GNULIB_REVISION"; }
-                }
-            ) || exit $?
+            git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \
+            || { git -C "$gnulib_path" fetch origin \
+                 && git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } \
+            || exit $?
           else
             die "Error: GNULIB_REVISION is specified in bootstrap.conf," \
                 "but '$gnulib_path' contains no git history"
@@ -901,9 +898,7 @@ update_po_files() {
     && ls "$ref_po_dir"/*.po 2>/dev/null |
       sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
 
-  langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
-  test "$langs" = '*' && langs=x
-  for po in $langs; do
+  for po in x $(ls $ref_po_dir | sed -n 's/\.po$//p'); do
     case $po in x) continue;; esac
     new_po="$ref_po_dir/$po.po"
     cksum_file="$ref_po_dir/$po.s1"
@@ -1366,7 +1361,7 @@ autogen()
       || die 'cannot generate runtime-po/Makevars'
 
       # Copy identical files from po to runtime-po.
-      (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
+      cp -p po/Makefile.in.in po/*-quot po/*.header po/*.sed po/*.sin runtime-po
     fi
   fi
 
index fb2039876febc1ac1712cef22b0812349e46a3aa..569ab728d0cbc50dfa9f58e49c430d43f30e69e4 100644 (file)
@@ -1,6 +1,6 @@
 # A library of shell functions for autopull.sh, autogen.sh, and bootstrap.
 
-scriptlibversion=2024-11-12.20; # UTC
+scriptlibversion=2024-11-12.21; # UTC
 
 # Copyright (C) 2003-2024 Free Software Foundation, Inc.
 #
@@ -468,11 +468,10 @@ prepare_GNULIB_SRCDIR ()
       # if the GNULIB_REVISION is a commit hash that only exists in
       # origin. In this case, we need a 'git fetch' and then retry
       # 'git checkout "$GNULIB_REVISION"'.
-      (cd "$GNULIB_SRCDIR" \
-       && { git checkout "$GNULIB_REVISION" 2>/dev/null \
-            || { git fetch origin && git checkout "$GNULIB_REVISION"; }
-          }
-      ) || exit $?
+      git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION" 2>/dev/null \
+      || { git -C "$GNULIB_SRCDIR" fetch origin \
+           && git -C "$GNULIB_SRCDIR" checkout "$GNULIB_REVISION"; } \
+      || exit $?
     fi
   else
     if ! $use_git; then
@@ -547,8 +546,7 @@ prepare_GNULIB_SRCDIR ()
             || git -C "$gnulib_path" fetch origin \
             || cleanup_gnulib
           git -C "$gnulib_path" reset --hard FETCH_HEAD
-          (cd "$gnulib_path" && git checkout "$GNULIB_REVISION") \
-            || cleanup_gnulib
+          git -C "$gnulib_path" checkout "$GNULIB_REVISION" || cleanup_gnulib
         fi
         trap - HUP INT PIPE TERM
       else
@@ -561,11 +559,10 @@ prepare_GNULIB_SRCDIR ()
             # if the GNULIB_REVISION is a commit hash that only exists in
             # origin. In this case, we need a 'git fetch' and then retry
             # 'git checkout "$GNULIB_REVISION"'.
-            (cd "$gnulib_path" \
-             && { git checkout "$GNULIB_REVISION" 2>/dev/null \
-                  || { git fetch origin && git checkout "$GNULIB_REVISION"; }
-                }
-            ) || exit $?
+            git -C "$gnulib_path" checkout "$GNULIB_REVISION" 2>/dev/null \
+            || { git -C "$gnulib_path" fetch origin \
+                 && git -C "$gnulib_path" checkout "$GNULIB_REVISION"; } \
+            || exit $?
           else
             die "Error: GNULIB_REVISION is specified in bootstrap.conf," \
                 "but '$gnulib_path' contains no git history"
@@ -864,9 +861,7 @@ update_po_files() {
     && ls "$ref_po_dir"/*.po 2>/dev/null |
       sed 's|.*/||; s|\.po$||' > "$po_dir/LINGUAS" || return
 
-  langs=$(cd $ref_po_dir && echo *.po | sed 's/\.po//g')
-  test "$langs" = '*' && langs=x
-  for po in $langs; do
+  for po in x $(ls $ref_po_dir | sed -n 's/\.po$//p'); do
     case $po in x) continue;; esac
     new_po="$ref_po_dir/$po.po"
     cksum_file="$ref_po_dir/$po.s1"
@@ -1329,7 +1324,7 @@ autogen()
       || die 'cannot generate runtime-po/Makevars'
 
       # Copy identical files from po to runtime-po.
-      (cd po && cp -p Makefile.in.in *-quot *.header *.sed *.sin ../runtime-po)
+      cp -p po/Makefile.in.in po/*-quot po/*.header po/*.sed po/*.sin runtime-po
     fi
   fi