bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib-tool: new options --verbose, --quiet


From: Bruno Haible
Subject: gnulib-tool: new options --verbose, --quiet
Date: Sun, 9 Sep 2007 13:49:24 +0200
User-agent: KMail/1.5.4

Jim Meyering wrote on 2007-09-04:
> Currently, gnulib-tool emits so much output that
> a few new diagnostics may easily go by unnoticed.

This has been mentioned several times lately. I'm adding an option --quiet
that decreases the verbosity and an option --verbose that cancels --quiet
(and vice versa).


2007-09-09  Bruno Haible  <address@hidden>

        * gnulib-tool: New options --verbose, --quiet.
        (func_usage): Document them.
        (verbose): New variable.
        (func_execute_command): New function.
        (func_import): Don't show the module list and the file list if
        $verbose < 0.
        (func_create_testdir): Likewise. Use func_execute_command.
        (func_create_megatestdir): Use func_execute_command.

*** gnulib-tool 8 Sep 2007 23:07:48 -0000       1.255
--- gnulib-tool 9 Sep 2007 11:45:20 -0000
***************
*** 132,137 ****
--- 132,139 ----
                              directory.
        --local-dir=DIRECTORY  Specify a local override directory where to look
                              up files before looking in gnulib's directory.
+       --verbose             Increase verbosity. May be repeated.
+       --quiet               Decrease verbosity. May be repeated.
  
  Options for --import:
        --lib=LIBRARY         Specify the library name.  Defaults to 'libgnu'.
***************
*** 568,573 ****
--- 570,576 ----
  # - mode            list or import or create-testdir or create-megatestdir
  # - destdir         from --dir
  # - local_gnulib_dir  from --local-dir
+ # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
  # - libname, supplied_libname  from --lib
  # - sourcebase      from --source-base
  # - m4base          from --m4-base
***************
*** 594,599 ****
--- 597,603 ----
    mode=
    destdir=
    local_gnulib_dir=
+   verbose=0
    libname=libgnu
    supplied_libname=
    sourcebase=
***************
*** 663,668 ****
--- 667,678 ----
        --local-dir=* )
          local_gnulib_dir=`echo "X$1" | sed -e 's/^X--local-dir=//'`
          shift ;;
+       --verbose | --verbos | --verbo | --verb )
+         verbose=`expr $verbose + 1`
+         shift ;;
+       --quiet | --quie | --qui | --qu | --q )
+         verbose=`expr $verbose - 1`
+         shift ;;
        --lib )
          shift
          if test $# = 0; then
***************
*** 807,813 ****
        --help | --hel | --he | --h )
          func_usage
          func_exit $? ;;
!       --version | --versio | --versi | --vers | --ver | --ve | --v )
          func_version
          func_exit $? ;;
        -- )
--- 817,823 ----
        --help | --hel | --he | --h )
          func_usage
          func_exit $? ;;
!       --version | --versio | --versi | --vers )
          func_version
          func_exit $? ;;
        -- )
***************
*** 1453,1458 ****
--- 1463,1494 ----
    files=`for f in $files; do echo $f; done | LC_ALL=C sort -u`
  }
  
+ 
+ # func_execute_command command [args...]
+ # Executes a command.
+ # Uses also the variables
+ # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
+ func_execute_command ()
+ {
+   if test $verbose -ge 0; then
+     echo "executing $*"
+     "$@"
+   else
+     # Commands like automake produce output to stderr even when the succeed.
+     # Turn this output off if the command succeeds.
+     "$@" > "$tmp"/cmdout 2>&1
+     cmdret=$?
+     if test $cmdret = 0; then
+       rm -f "$tmp"/cmdout
+     else
+       echo "executing $*"
+       cat "$tmp"/cmdout 1>&2
+       rm -f "$tmp"/cmdout
+       (exit $cmdret)
+     fi
+   fi
+ }
+ 
  # func_emit_lib_Makefile_am
  # emits the contents of library makefile to standard output.
  # Input:
***************
*** 1874,1879 ****
--- 1910,1916 ----
  # Uses also the variables
  # - destdir         target directory
  # - local_gnulib_dir  from --local-dir
+ # - verbose         integer, default 0, inc/decremented by --verbose/--quiet
  # - libname         library name
  # - sourcebase      directory relative to destdir where to place source code
  # - m4base          directory relative to destdir where to place *.m4 macros
***************
*** 2091,2098 ****
    # Determine final module list.
    modules="$specified_modules"
    func_modules_transitive_closure
!   echo "Module list with included dependencies:"
!   echo "$modules" | sed -e 's/^/  /'
  
    # Add the dummy module if needed.
    func_modules_add_dummy
--- 2128,2137 ----
    # Determine final module list.
    modules="$specified_modules"
    func_modules_transitive_closure
!   if test $verbose -ge 0; then
!     echo "Module list with included dependencies:"
!     echo "$modules" | sed -e 's/^/  /'
!   fi
  
    # Add the dummy module if needed.
    func_modules_add_dummy
***************
*** 2132,2139 ****
  
    # Determine final file list.
    func_modules_to_filelist
!   echo "File list:"
!   echo "$files" | sed -e 's/^/  /'
  
    test -n "$files" \
      || func_fatal_error "refusing to do nothing"
--- 2171,2180 ----
  
    # Determine final file list.
    func_modules_to_filelist
!   if test $verbose -ge 0; then
!     echo "File list:"
!     echo "$files" | sed -e 's/^/  /'
!   fi
  
    test -n "$files" \
      || func_fatal_error "refusing to do nothing"
***************
*** 3019,3034 ****
  
    # Determine final module list.
    func_modules_transitive_closure
!   echo "Module list with included dependencies:"
!   echo "$modules" | sed -e 's/^/  /'
  
    # Add the dummy module if needed.
    func_modules_add_dummy
  
    # Determine final file list.
    func_modules_to_filelist
!   echo "File list:"
!   echo "$files" | sed -e 's/^/  /'
  
    sed_rewrite_files="\
      s,^build-aux/,$auxdir/,
--- 3060,3079 ----
  
    # Determine final module list.
    func_modules_transitive_closure
!   if test $verbose -ge 0; then
!     echo "Module list with included dependencies:"
!     echo "$modules" | sed -e 's/^/  /'
!   fi
  
    # Add the dummy module if needed.
    func_modules_add_dummy
  
    # Determine final file list.
    func_modules_to_filelist
!   if test $verbose -ge 0; then
!     echo "File list:"
!     echo "$files" | sed -e 's/^/  /'
!   fi
  
    sed_rewrite_files="\
      s,^build-aux/,$auxdir/,
***************
*** 3328,3351 ****
     # Do not use "${AUTORECONF} --force --install", because it may invoke
     # autopoint, which brings in older versions of some of our .m4 files.
     if test -f $m4base/gettext.m4; then
!      echo "executing ${AUTOPOINT} --force"
!      ${AUTOPOINT} --force || func_exit 1
       for f in $m4base/*.m4~; do
         mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
       done
     fi
!    echo "executing ${ACLOCAL} -I $m4base"
!    ${ACLOCAL} -I $m4base || func_exit 1
     if ! test -d build-aux; then
!      echo "executing mkdir build-aux"
!      mkdir build-aux || func_exit 1
     fi
!    echo "executing ${AUTOCONF}"
!    ${AUTOCONF} || func_exit 1
!    echo "executing ${AUTOHEADER}"
!    ${AUTOHEADER} || func_exit 1
!    echo "executing ${AUTOMAKE} --add-missing --copy"
!    ${AUTOMAKE} --add-missing --copy || func_exit 1
    ) || func_exit 1
    if test -n "$inctests"; then
      # Create autogenerated files.
--- 3373,3390 ----
     # Do not use "${AUTORECONF} --force --install", because it may invoke
     # autopoint, which brings in older versions of some of our .m4 files.
     if test -f $m4base/gettext.m4; then
!      func_execute_command ${AUTOPOINT} --force || func_exit 1
       for f in $m4base/*.m4~; do
         mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
       done
     fi
!    func_execute_command ${ACLOCAL} -I $m4base || func_exit 1
     if ! test -d build-aux; then
!      func_execute_command mkdir build-aux || func_exit 1
     fi
!    func_execute_command ${AUTOCONF} || func_exit 1
!    func_execute_command ${AUTOHEADER} || func_exit 1
!    func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
    ) || func_exit 1
    if test -n "$inctests"; then
      # Create autogenerated files.
***************
*** 3353,3376 ****
       # Do not use "${AUTORECONF} --force --install", because it may invoke
       # autopoint, which brings in older versions of some of our .m4 files.
       if test -f ../$m4base/gettext.m4; then
!        echo "executing ${AUTOPOINT} --force"
!        ${AUTOPOINT} --force || func_exit 1
         for f in ../$m4base/*.m4~; do
           mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
         done
       fi
!      echo "executing ${ACLOCAL} -I ../$m4base"
!      ${ACLOCAL} -I ../$m4base || func_exit 1
       if ! test -d ../build-aux; then
!        echo "executing mkdir ../build-aux"
!        mkdir ../build-aux
       fi
!      echo "executing ${AUTOCONF}"
!      ${AUTOCONF} || func_exit 1
!      echo "executing ${AUTOHEADER}"
!      ${AUTOHEADER} || func_exit 1
!      echo "executing ${AUTOMAKE} --add-missing --copy"
!      ${AUTOMAKE} --add-missing --copy || func_exit 1
      ) || func_exit 1
    fi
    # Need to run configure and make once, to create built files that are to be
--- 3392,3409 ----
       # Do not use "${AUTORECONF} --force --install", because it may invoke
       # autopoint, which brings in older versions of some of our .m4 files.
       if test -f ../$m4base/gettext.m4; then
!        func_execute_command ${AUTOPOINT} --force || func_exit 1
         for f in ../$m4base/*.m4~; do
           mv -f $f `echo $f | sed -e 's,~$,,'` || func_exit 1
         done
       fi
!      func_execute_command ${ACLOCAL} -I ../$m4base || func_exit 1
       if ! test -d ../build-aux; then
!        func_execute_command mkdir ../build-aux
       fi
!      func_execute_command ${AUTOCONF} || func_exit 1
!      func_execute_command ${AUTOHEADER} || func_exit 1
!      func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
      ) || func_exit 1
    fi
    # Need to run configure and make once, to create built files that are to be
***************
*** 3493,3506 ****
     # Do not use "${AUTORECONF} --install", because autoreconf operates
     # recursively, but the subdirectories are already finished, therefore
     # calling autoreconf here would only waste lots of CPU time.
!    echo "executing ${ACLOCAL}"
!    ${ACLOCAL} || func_exit 1
!    echo "executing mkdir build-aux"
!    mkdir build-aux
!    echo "executing ${AUTOCONF}"
!    ${AUTOCONF} || func_exit 1
!    echo "executing ${AUTOMAKE} --add-missing --copy"
!    ${AUTOMAKE} --add-missing --copy || func_exit 1
    ) || func_exit 1
  }
  
--- 3526,3535 ----
     # Do not use "${AUTORECONF} --install", because autoreconf operates
     # recursively, but the subdirectories are already finished, therefore
     # calling autoreconf here would only waste lots of CPU time.
!    func_execute_command ${ACLOCAL} || func_exit 1
!    func_execute_command mkdir build-aux
!    func_execute_command ${AUTOCONF} || func_exit 1
!    func_execute_command ${AUTOMAKE} --add-missing --copy || func_exit 1
    ) || func_exit 1
  }
  





reply via email to

[Prev in Thread] Current Thread [Next in Thread]