At Thursday 10 June 2010, Ralf Wildenhues wrote: > Hi Stefano, > >> [CUT] > > Yes. The changes are ok if you split the patch into one purely > without semantic changes, and the rest (so that we don't need to > revert the former when the latter turns out to be bad); Seems sensible. Agreed. > and for setting the PATH separator, please use the code from > Autoconf. OK. > Bonus points for lower-casing the first words in error messages > and prepending (pre-set) `$me: '. ;-) Done too.
Since I was at it, I also wrote a third patch, which adds code (again stolen from autoconf) to ensure that the bootstap script is run in bourne-compatibility mode. Since the patches are very simple, I attach all the three of them to this message. I hope this is OK. Regards, Stefano
From 700c0eb3e974ded23c9c100c34aa5137f937d8aa Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Thu, 10 Jun 2010 00:49:26 +0200 Subject: [PATCH 1/3] Minor improvements in bootstrap script. * bootstrap: Consistently use two-spaces indentation. Cosmetic improvement to comments. ($me): New variable, containing program basename. Prepend it to all error messages. --- ChangeLog | 8 ++++++ bootstrap | 75 +++++++++++++++++++++++++++++++----------------------------- 2 files changed, 47 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8f33b63..98d7442 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2010-06-10 Stefano Lattarini <stefano.lattar...@gmail.com> + + Minor improvements in bootstrap script. + * bootstrap: Consistently use two-spaces indentation. Cosmetic + improvement to comments. + ($me): New variable, containing program basename. + Prepend it to all error messages. + 2010-06-09 Stefano Lattarini <stefano.lattar...@gmail.com> Modernize, improve and/or fix various test scripts. diff --git a/bootstrap b/bootstrap index 2a86345..2e4bedc 100755 --- a/bootstrap +++ b/bootstrap @@ -2,9 +2,9 @@ # This script helps bootstrap automake, when checked out from git. # -# Copyright (C) 2002, 2003, 2004, 2007, 2008 Free Software Foundation, -# Inc. -# written by Pavel Roskin <pro...@gnu.org> September 2002 +# Copyright (C) 2002, 2003, 2004, 2007, 2008, 2010 Free Software +# Foundation, Inc. +# Originally written by Pavel Roskin <pro...@gnu.org> September 2002. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -19,7 +19,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -# Find the path separator +# Find the path separator. echo "#! /bin/sh" >boot$$.sh echo "exit 0" >>boot$$.sh chmod +x boot$$.sh @@ -30,29 +30,32 @@ else fi rm -f boot$$.sh -# Don't ignore failures +# Don't ignore failures. set -e +# Set program basename. +me=`echo "$0" | sed 's,^.*/,,'` + # Find perl. Code based on Autoconf, but without non-POSIX support. if test -z "$PERL"; then - save_IFS=$IFS - IFS=$PATH_SEPARATOR - for dir in $PATH; do - IFS=$save_IFS - test -z "$dir" && dir=. - if test -x "$dir/perl" && test ! -d "$dir/perl"; then - PERL="$dir/perl" - break - fi - done + save_IFS=$IFS + IFS=$PATH_SEPARATOR + for dir in $PATH; do + IFS=$save_IFS + test -z "$dir" && dir=. + if test -x "$dir/perl" && test ! -d "$dir/perl"; then + PERL="$dir/perl" + break + fi + done fi if test -z "$PERL"; then - echo "Cannot find perl" >&2 - exit 1 + echo "$me: cannot find perl" >&2 + exit 1 fi -# Variables to substitute +# Variables to substitute. VERSION=`sed -ne '/AC_INIT/s/^[^[]*\[[^[]*\[\([^]]*\)\].*$/\1/p' configure.ac` PACKAGE=automake datadir=. @@ -62,35 +65,35 @@ PERL_THREADS=0 # uses bash, not COMMAND.COM which doesn't quote arguments properly. # It's not used otherwise. if test -n "$DJDIR"; then - BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe + BOOTSTRAP_SHELL=/dev/env/DJDIR/bin/bash.exe else - BOOTSTRAP_SHELL=/bin/sh + BOOTSTRAP_SHELL=/bin/sh fi -# Read the rule for calculating APIVERSION and execute it +# Read the rule for calculating APIVERSION and execute it. apiver_cmd=`sed -ne 's/\[\[/[/g;s/\]\]/]/g;/^APIVERSION=/p' configure.ac` eval $apiver_cmd -# Sanity checks +# Sanity checks. if test -z "$VERSION"; then - echo "Cannot find VERSION" >&2 - exit 1 + echo "$me: cannot find VERSION" >&2 + exit 1 fi if test -z "$APIVERSION"; then - echo "Cannot find VERSION" >&2 - exit 1 + echo "$me: cannot find VERSION" >&2 + exit 1 fi -# Make a dummy versioned directory for aclocal +# Make a dummy versioned directory for aclocal. rm -rf aclocal-$APIVERSION mkdir aclocal-$APIVERSION if test -d automake-$APIVERSION; then - find automake-$APIVERSION -exec chmod u+wx '{}' ';' + find automake-$APIVERSION -exec chmod u+wx '{}' ';' fi rm -rf automake-$APIVERSION -# Can't use `ln -s lib automake-$APIVERSION', -# that would create a lib.exe stub under DJGPP 2.03. +# Can't use `ln -s lib automake-$APIVERSION', that would create a +# lib.exe stub under DJGPP 2.03. mkdir automake-$APIVERSION cp -rf lib/* automake-$APIVERSION @@ -111,17 +114,17 @@ dosubst () } -# Create temporary replacement for lib/Automake/Config.pm +# Create temporary replacement for lib/Automake/Config.pm. dosubst automake-$APIVERSION/Automake/Config.in \ - automake-$APIVERSION/Automake/Config.pm + automake-$APIVERSION/Automake/Config.pm -# Create temporary replacement for aclocal +# Create temporary replacement for aclocal. dosubst aclocal.in aclocal.tmp -# Overwrite amversion.m4 +# Overwrite amversion.m4. dosubst m4/amversion.in m4/amversion.m4 -# Create temporary replacement for automake +# Create temporary replacement for automake. dosubst automake.in automake.tmp # Create tests/parallel-tests.am. @@ -134,7 +137,7 @@ $PERL ./aclocal.tmp -I m4 autoconf $PERL ./automake.tmp -# Remove temporary files and directories +# Remove temporary files and directories. rm -rf aclocal-$APIVERSION automake-$APIVERSION rm -f aclocal.tmp automake.tmp rm -f lib/Automake/Config.pm -- 1.6.5
From 8bb168f73faf85f97973cb60da831a451a3249f5 Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Thu, 10 Jun 2010 20:32:54 +0200 Subject: [PATCH 2/3] Improve determination of PATH separator in bootstrap script. * bootstrap: Detemine what the PATH separator is the same way autoconf does. --- ChangeLog | 4 ++++ bootstrap | 13 ++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 98d7442..6a37dfb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-06-10 Stefano Lattarini <stefano.lattar...@gmail.com> + Improve determination of PATH separator in bootstrap script. + * bootstrap: Detemine what the PATH separator is the same way + autoconf does. + Minor improvements in bootstrap script. * bootstrap: Consistently use two-spaces indentation. Cosmetic improvement to comments. diff --git a/bootstrap b/bootstrap index 2e4bedc..7766bd3 100755 --- a/bootstrap +++ b/bootstrap @@ -20,15 +20,14 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # Find the path separator. -echo "#! /bin/sh" >boot$$.sh -echo "exit 0" >>boot$$.sh -chmod +x boot$$.sh -if (PATH="/nonexistent;."; boot$$.sh) >/dev/null 2>&1; then - PATH_SEPARATOR=';' -else +# (Snippet copied from configure's initialization in Autoconf 2.65) +if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } fi -rm -f boot$$.sh # Don't ignore failures. set -e -- 1.6.5
From 835beeed84933e32d742cdeeff4903ab5c8ecbbe Mon Sep 17 00:00:00 2001 From: Stefano Lattarini <stefano.lattar...@gmail.com> Date: Thu, 10 Jun 2010 20:37:45 +0200 Subject: [PATCH 3/3] Ensure bootstrap script runs in Bourne-compatibility mode. * bootstrap: Likewise. --- ChangeLog | 3 +++ bootstrap | 14 ++++++++++++++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6a37dfb..6ceefc7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2010-06-10 Stefano Lattarini <stefano.lattar...@gmail.com> + Ensure bootstrap script runs in Bourne-compatibility mode. + * bootstrap: Likewise. + Improve determination of PATH separator in bootstrap script. * bootstrap: Detemine what the PATH separator is the same way autoconf does. diff --git a/bootstrap b/bootstrap index 7766bd3..31c973c 100755 --- a/bootstrap +++ b/bootstrap @@ -19,6 +19,20 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. +# Be more Bourne compatible. +# (Snippet copied from configure's initialization in Autoconf 2.64) +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi + # Find the path separator. # (Snippet copied from configure's initialization in Autoconf 2.65) if test "${PATH_SEPARATOR+set}" != set; then -- 1.6.5