changeset 21277:1bca6c72d2b1

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.
author Mike Miller <mtmiller@octave.org>
date Tue, 16 Feb 2016 18:36:00 -0800
parents 3b4bb843ffcd
children 48d82f74243e
files build-aux/find-files-with-tests.sh build-aux/mk-octave-config-h.sh build-aux/move-if-change doc/interpreter/config-images.sh libinterp/build-env-features.sh libinterp/dldfcn/config-module.sh libinterp/find-defun-files.sh libinterp/mk-errno-list libinterp/mk-pkg-add libinterp/mkbuiltins libinterp/mkdefs libinterp/mkdocs libinterp/mkops liboctave/cruft/mkf77def.in liboctave/operators/config-ops.sh scripts/mk-pkg-add
diffstat 16 files changed, 38 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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
 
--- 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.
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
--- 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
 # <http://www.gnu.org/licenses/>.
 
-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
--- 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
 # <http://www.gnu.org/licenses/>.
 
-SED=${SED:-'sed'}
+SED=${SED:-sed}
 
 $SED -n -e '/^BEGIN_DOC_STRING/{
   : loop
--- 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
 # <http://www.gnu.org/licenses/>.
 
-SED=${SED:-'sed'}
+SED=${SED:-sed}
 
 cat << \EOF
 // DO NOT EDIT!  Generated automatically by mkops.
--- 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
 # <http://www.gnu.org/licenses/>.
 
-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
--- 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
-
-
-
-
-
--- 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