# HG changeset patch # User Mike Miller # Date 1455676560 28800 # Node ID 1bca6c72d2b1fe750459484a292f1ddfc283835a # Parent 3b4bb843ffcdeea09b1a44bc75b403ef1b069c71 maint: Use consistent coding style for build helper shell scripts * mk-octave-config-h.sh: Keep if-then on a single line. * move-if-change: Insert a space in interpreter directive for consistency. * build-env-features.sh, config-images.sh, config-module.sh, config-ops.sh, find-defun-files.sh, find-files-with-tests.sh, mk-errno-list, libinterp/mk-pkg-add, scripts/mk-pkg-add, mkbuiltins, mkdefs, mkdocs, mkf77def.in, mkops: Initialize environment variable defaults consistently. Use shift only when the argument list is not empty. Remove unnecessary quotes and semicolons on variable assignments. Insert/remove blank lines for consistency. diff -r 3b4bb843ffcd -r 1bca6c72d2b1 build-aux/find-files-with-tests.sh --- a/build-aux/find-files-with-tests.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/build-aux/find-files-with-tests.sh Tue Feb 16 18:36:00 2016 -0800 @@ -1,11 +1,14 @@ #! /bin/sh set -e + GREP=${GREP:-grep} SED=${SED:-sed} srcdir="$1" -shift +if [ "$1" ]; then + shift +fi for arg do diff -r 3b4bb843ffcd -r 1bca6c72d2b1 build-aux/mk-octave-config-h.sh --- a/build-aux/mk-octave-config-h.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/build-aux/mk-octave-config-h.sh Tue Feb 16 18:36:00 2016 -0800 @@ -136,8 +136,7 @@ EOF -if grep "#define OCTAVE_ENABLE_FLOAT_TRUNCATE 1" $config_h_file > /dev/null; -then +if grep "#define OCTAVE_ENABLE_FLOAT_TRUNCATE 1" $config_h_file > /dev/null; then echo "#define OCTAVE_FLOAT_TRUNCATE volatile" else echo "#define OCTAVE_FLOAT_TRUNCATE" @@ -148,8 +147,7 @@ grep "#\(undef\|define\) OCTAVE_ENABLE_BOUNDS_CHECK" $config_h_file grep "#\(undef\|define\) OCTAVE_ENABLE_OPENMP" $config_h_file -if grep "#undef HAVE_DEV_T" $config_h_file > /dev/null; -then +if grep "#undef HAVE_DEV_T" $config_h_file > /dev/null; then cat << EOF typedef short dev_t; @@ -163,8 +161,7 @@ EOF fi -if grep "#undef HAVE_INO_T" $config_h_file > /dev/null; -then +if grep "#undef HAVE_INO_T" $config_h_file > /dev/null; then cat << EOF typedef unsigned long ino_t; @@ -179,8 +176,7 @@ fi have_roundl=no -if grep "#define HAVE_ROUNDL" $config_h_file > /dev/null; -then +if grep "#define HAVE_ROUNDL" $config_h_file > /dev/null; then have_roundl=yes fi diff -r 3b4bb843ffcd -r 1bca6c72d2b1 build-aux/move-if-change --- a/build-aux/move-if-change Tue Feb 16 17:57:07 2016 -0800 +++ b/build-aux/move-if-change Tue Feb 16 18:36:00 2016 -0800 @@ -1,4 +1,4 @@ -#!/bin/sh +#! /bin/sh # # Like mv $1 $2, but if the files are the same, just delete $1. # Status is 0 if $2 is changed, 1 otherwise. diff -r 3b4bb843ffcd -r 1bca6c72d2b1 doc/interpreter/config-images.sh --- a/doc/interpreter/config-images.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/doc/interpreter/config-images.sh Tue Feb 16 18:36:00 2016 -0800 @@ -2,10 +2,10 @@ set -e -: ${AWK=awk} +AWK=${AWK:-awk} if [ $# -eq 1 ]; then - top_srcdir="$1"; + top_srcdir="$1" else top_srcdir="../.." fi diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/build-env-features.sh --- a/libinterp/build-env-features.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/build-env-features.sh Tue Feb 16 18:36:00 2016 -0800 @@ -1,10 +1,11 @@ #! /bin/sh ## Attempt to get traditional sort behavior based on byte values. -LC_ALL="C" +LC_ALL=C export LC_ALL set -e + AWK=${AWK:-awk} conffile=$1 diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/dldfcn/config-module.sh --- a/libinterp/dldfcn/config-module.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/dldfcn/config-module.sh Tue Feb 16 18:36:00 2016 -0800 @@ -2,10 +2,10 @@ set -e -: ${AWK=awk} +AWK=${AWK:-awk} if [ $# -eq 1 ]; then - top_srcdir="$1"; + top_srcdir="$1" else top_srcdir="../.." fi diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/find-defun-files.sh --- a/libinterp/find-defun-files.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/find-defun-files.sh Tue Feb 16 18:36:00 2016 -0800 @@ -1,6 +1,7 @@ #! /bin/sh set -e + SED=${SED:-sed} EGREP=${EGREP:-egrep} @@ -11,7 +12,9 @@ DEFUN_PATTERN="^[ \t]*DEF(CONSTFUN|CMD|UN|UN_DLD|UNX_DLD|UN_TEXT)[ \t]*\\(" srcdir="$1" -shift +if [ "$1" ]; then + shift +fi for arg do diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/mk-errno-list --- a/libinterp/mk-errno-list Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/mk-errno-list Tue Feb 16 18:36:00 2016 -0800 @@ -24,7 +24,7 @@ fi if [ $1 = "--perl" ]; then - PERL="$2"; + PERL="$2" $PERL -e 'foreach $key (keys(%!)) { $x .= "#if defined ($key)\n { \"$key\", $key, },\n#endif\n"; } @@ -34,7 +34,7 @@ }' elif [ $1 = "--python" ]; then - PYTHON="$2"; + PYTHON="$2" $PYTHON -c ' from errno import errorcode from sys import stdin diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/mk-pkg-add --- a/libinterp/mk-pkg-add Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/mk-pkg-add Tue Feb 16 18:36:00 2016 -0800 @@ -20,7 +20,7 @@ set -e -SED=${SED:-'sed'} +SED=${SED:-sed} for f in "$@"; do if [ -f $f ]; then diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/mkbuiltins --- a/libinterp/mkbuiltins Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/mkbuiltins Tue Feb 16 18:36:00 2016 -0800 @@ -23,7 +23,7 @@ exit 1 fi -SED=${SED:-'sed'} +SED=${SED:-sed} make_header=false make_source=false diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/mkdefs --- a/libinterp/mkdefs Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/mkdefs Tue Feb 16 18:36:00 2016 -0800 @@ -18,7 +18,7 @@ # along with Octave; see the file COPYING. If not, see # . -SED=${SED:-'sed'} +SED=${SED:-sed} if [ $# -ne 2 ]; then echo "usage: mkdefs srcdir file < preprocessed-file-contents" 1>&2 @@ -26,7 +26,7 @@ fi srcdir="$1" -file="$2"; +file="$2" echo "// DO NOT EDIT! Generated automatically by mkdefs." case "$file" in diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/mkdocs --- a/libinterp/mkdocs Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/mkdocs Tue Feb 16 18:36:00 2016 -0800 @@ -18,7 +18,7 @@ # along with Octave; see the file COPYING. If not, see # . -SED=${SED:-'sed'} +SED=${SED:-sed} $SED -n -e '/^BEGIN_DOC_STRING/{ : loop diff -r 3b4bb843ffcd -r 1bca6c72d2b1 libinterp/mkops --- a/libinterp/mkops Tue Feb 16 17:57:07 2016 -0800 +++ b/libinterp/mkops Tue Feb 16 18:36:00 2016 -0800 @@ -18,7 +18,7 @@ # along with Octave; see the file COPYING. If not, see # . -SED=${SED:-'sed'} +SED=${SED:-sed} cat << \EOF // DO NOT EDIT! Generated automatically by mkops. diff -r 3b4bb843ffcd -r 1bca6c72d2b1 liboctave/cruft/mkf77def.in --- a/liboctave/cruft/mkf77def.in Tue Feb 16 17:57:07 2016 -0800 +++ b/liboctave/cruft/mkf77def.in Tue Feb 16 18:36:00 2016 -0800 @@ -18,23 +18,23 @@ # along with Octave; see the file COPYING. If not, see # . -SED=${SED:-'sed'} -AWK=${AWK:-'awk'} +SED=${SED:-sed} +AWK=${AWK:-awk} F77_TOLOWER="@F77_APPEND_UNDERSCORE@" F77_APPEND_UNDERSCORE="@F77_APPEND_UNDERSCORE@" F77_APPEND_EXTRA_UNDERSCORE="@F77_APPEND_EXTRA_UNDERSCORE@" if test x$F77_TOLOWER = xyes; then - case_cmd="tolower"; + case_cmd=tolower else - case_cmd="toupper"; + case_cmd=toupper fi if test x$F77_APPEND_UNDERSCORE = xyes; then - uscore="_"; + uscore=_ else - uscore=""; + uscore= fi if test x$F77_APPEND_EXTRA_UNDERSCORE = xyes; then diff -r 3b4bb843ffcd -r 1bca6c72d2b1 liboctave/operators/config-ops.sh --- a/liboctave/operators/config-ops.sh Tue Feb 16 17:57:07 2016 -0800 +++ b/liboctave/operators/config-ops.sh Tue Feb 16 18:36:00 2016 -0800 @@ -2,7 +2,7 @@ set -e -: ${AWK=awk} +AWK=${AWK:-awk} if [ $# -lt 3 ]; then src_type="all" @@ -99,8 +99,3 @@ esac ;; esac - - - - - diff -r 3b4bb843ffcd -r 1bca6c72d2b1 scripts/mk-pkg-add --- a/scripts/mk-pkg-add Tue Feb 16 17:57:07 2016 -0800 +++ b/scripts/mk-pkg-add Tue Feb 16 18:36:00 2016 -0800 @@ -24,10 +24,12 @@ set -e -SED=${SED:-'sed'} +SED=${SED:-sed} prefix="$1/" -shift +if [ "$1" ]; then + shift +fi for arg do