From: Paul Eggert Date: Tue, 12 Nov 2024 21:13:47 +0000 (-0800) Subject: bootstrap: avoid "cd" X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=fd902a8e3911ff6eee2f42c6809b965f877a398f;p=gnulib.git 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. --- diff --git a/ChangeLog b/ChangeLog index 213714cc52..9473f36f22 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2024-11-12 Paul Eggert + 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, diff --git a/build-aux/bootstrap b/build-aux/bootstrap index 2e56c624d2..94c07d15fe 100755 --- a/build-aux/bootstrap +++ b/build-aux/bootstrap @@ -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 diff --git a/top/bootstrap-funclib.sh b/top/bootstrap-funclib.sh index fb2039876f..569ab728d0 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. -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