[PATCH build 1/6] []/test consistency

Peter Hutterer peter.hutterer at who-t.net
Wed Sep 8 17:15:01 PDT 2010


On Wed, Sep 08, 2010 at 10:34:10AM -0400, Trevor Woerner wrote:
> From: Trevor Woerner <twoerner at gmail.com>
> 
> Build script cleanup. Make the use of '[ ... ]' and 'test'
> consistent throughout.

please don't mix up whitespace changes and code changes in a single patch.
it's distracting during code review and errors can get missed easily.

Acked-by: Peter Hutterer <peter.hutterer at who-t.net> if split up though.

Cheers,
  Peter

> Signed-off-by: Trevor Woerner <twoerner at gmail.com>
> ---
>  build.sh |   51 +++++++++++++++++++++++++--------------------------
>  1 files changed, 25 insertions(+), 26 deletions(-)
> 
> diff --git a/build.sh b/build.sh
> index 4d8956f..1a5c522 100755
> --- a/build.sh
> +++ b/build.sh
> @@ -32,7 +32,7 @@ setup_buildenv() {
>      export HOST_OS=`uname -s`
>      export HOST_CPU=`uname -m`
>  
> -    if test x$LIBDIR = x ; then
> +    if test x$LIBDIR = x; then
>  	export LIBDIR=lib
>      fi
>  
> @@ -93,7 +93,7 @@ checkfortars() {
>              esac
>              ;;
>          "font")
> -            if [ "$C" != "encodings" ]; then
> +            if test "$C" != "encodings"; then
>                  C="font-$C"
>              fi
>              ;;
> @@ -132,11 +132,11 @@ checkfortars() {
>      for ii in $M .; do
>          for jj in bz2 gz; do
>              TARFILE=`ls -1rt $ii/$C-*.tar.$jj 2> /dev/null | tail -n 1`
> -            if [ -n "$TARFILE" ]; then
> +            if test -n "$TARFILE"; then
>                  SRCDIR=`echo $TARFILE | sed "s,.tar.$jj,,"`
> -                if [ ! -d $SRCDIR ]; then
> +                if test ! -d $SRCDIR; then
>                      TAROPTS=xjf
> -                    if [ "$jj" = "gz" ]; then
> +                    if test "$jj" = "gz"; then
>                          TAROPTS=xzf
>                      fi
>                      tar $TAROPTS $TARFILE -C $ii || failed tar $1 $2
> @@ -186,13 +186,13 @@ clone() {
>  }
>  
>  build() {
> -    if [ -n "$LISTONLY" ]; then
> +    if test -n "$LISTONLY"; then
>  	echo "$1/$2"
>  	return 0
>      fi
>  
> -    if [ -n "$RESUME" ]; then
> -	if [ "$RESUME" = "$1/$2" ]; then
> +    if test -n "$RESUME"; then
> +	if test "$RESUME" = "$1/$2"; then
>  	    unset RESUME
>  	    # Resume build at this module
>  	else
> @@ -203,12 +203,12 @@ build() {
>  
>      SRCDIR=""
>      CONFCMD=""
> -    if [ -f $1/$2/autogen.sh ]; then
> +    if test -f $1/$2/autogen.sh; then
>          SRCDIR="$1/$2"
>          CONFCMD="autogen.sh"
> -    elif [ "x$CLONE" != "x" ]; then
> +    elif test "x$CLONE" != "x"; then
>          clone $1 $2
> -        if [ $? -ne 0 ]; then
> +        if test $? -ne 0; then
>              echo "Failed to clone $1 module component $2. Ignoring."
>              clonefailed_components="$clonefailed_components $1/$2"
>              if test x"$BUILD_ONE" = x1; then
> @@ -223,7 +223,7 @@ build() {
>          CONFCMD="configure"
>      fi
>  
> -    if [ -z $SRCDIR ]; then
> +    if test -z $SRCDIR; then
>          echo "$1 module component $2 does not exist, skipping."
>          nonexistent_components="$nonexistent_components $1/$2"
>          return
> @@ -243,7 +243,7 @@ build() {
>      fi
>  
>      # Build outside source directory
> -    if [ "x$DIR_ARCH" != x ] ; then
> +    if test "x$DIR_ARCH" != x; then
>  	mkdir -p "$DIR_ARCH" || failed mkdir $1 $2
>  	if cd "$DIR_ARCH" ; then :; else
>  	    failed cd2 $1 $2
> @@ -260,12 +260,12 @@ build() {
>      fi
>  
>      LIB_FLAGS=
> -    if test x$LIBDIR != x ; then
> +    if test x$LIBDIR != x; then
>          LIB_FLAGS="--libdir=${PREFIX}/${LIBDIR}"
>      fi
>  
>      # Use "sh autogen.sh" since some scripts are not executable in CVS
> -    if test "x$NOAUTOGEN" != x1 ; then
> +    if test "x$NOAUTOGEN" != x1; then
>          sh ${DIR_CONFIG}/${CONFCMD} --prefix=${PREFIX} ${LIB_FLAGS} \
>  	    ${MOD_SPECIFIC} ${QUIET:+--quiet} \
>  	    ${CACHE:+--cache-file=}${CACHE} ${CONFFLAGS} "$CONFCFLAGS" || \
> @@ -331,7 +331,7 @@ build_proto() {
>      build proto xf86driproto
>      build proto xf86vidmodeproto
>      build proto xineramaproto
> -    if test x"$USE_XCB" != xNO ; then
> +    if test x"$USE_XCB" != xNO; then
>  	build xcb proto
>      fi
>  }
> @@ -365,7 +365,7 @@ build_lib() {
>      build lib libxtrans
>      build lib libXau
>      build lib libXdmcp
> -    if test x"$USE_XCB" != xNO ; then
> +    if test x"$USE_XCB" != xNO; then
>          build xcb pthread-stubs
>  	build xcb libxcb
>          build xcb util
> @@ -759,8 +759,7 @@ DIR_CONFIG="."
>  LIB_ONLY=0
>  
>  # Process command line args
> -while test $# != 0
> -do
> +while test $# != 0; do
>      case $1 in
>      -a)
>  	NOAUTOGEN=1
> @@ -822,7 +821,7 @@ do
>      --autoresume)
>  	shift
>  	BUILT_MODULES_FILE=$1
> -	[ -f $1 ] && RESUME=`tail -n 1 $1`
> +	test -f $1 && RESUME=`tail -n 1 $1`
>  	;;
>      -s)
>  	shift
> @@ -839,12 +838,12 @@ do
>      shift
>  done
>  
> -if test x"${PREFIX}" = x && test -z "$LISTONLY" ; then
> +if test x"${PREFIX}" = x && test -z "$LISTONLY"; then
>      usage
>      exit
>  fi
>  
> -if test -z "$LISTONLY" ; then
> +if test -z "$LISTONLY"; then
>      setup_buildenv
>      echo "Building to run $HOST_OS / $HOST_CPU ($HOST)"
>      date
> @@ -869,27 +868,27 @@ if test $LIB_ONLY -eq 0; then
>      build_util
>  fi
>  
> -if test -n "$LISTONLY" ; then
> +if test -n "$LISTONLY"; then
>      exit 0
>  fi
>  
>  date
>  
> -if test "x$nonexistent_components" != x ; then
> +if test "x$nonexistent_components" != x; then
>      echo ""
>      echo "***** Skipped components (not available) *****"
>      echo "$nonexistent_components"
>      echo ""
>  fi
>  
> -if test "x$failed_components" != x ; then
> +if test "x$failed_components" != x; then
>      echo ""
>      echo "***** Failed components *****"
>      echo "$failed_components"
>      echo ""
>  fi
>  
> -if test "x$CLONE" != x && test "x$clonefailed_components" != x ;  then
> +if test "x$CLONE" != x && test "x$clonefailed_components" != x;  then
>      echo ""
>      echo "***** Components failed to clone *****"
>      echo "$clonefailed_components"
> -- 
> 1.7.1
> 
> _______________________________________________


More information about the xorg-devel mailing list