[pacman-dev] Suggestion for a QUIET arg to makepkg

Mark Constable markc at renta.net
Wed Feb 20 11:19:15 EST 2008


When it comes to using makepkg from a wrapper script, to
build a series of packages, it would be good if there was
an option to send logging to a file and not to STDOUT at the
same time. This is just a suggestion and an example of one
place where I need to patch my local makepkg.

Perhaps this could be generalised via a VERBOSE arg instead
where, for instance, VERBOSE=9 could be noisier than VERBOSE=1
(rather than just an on/off toggle).

--markc

--- /usr/bin/makepkg.orig       2008-02-21 01:52:39.000000000 +1000
+++ /usr/bin/makepkg    2008-02-21 02:04:31.000000000 +1000
@@ -58,6 +58,7 @@
 SOURCEONLY=0
 IGNOREARCH=0
 HOLDVER=0
+QUIET=0

 # Forces the pkgver of the current PKGBUILD. Used by the fakeroot call
 # when dealing with svn/cvs/etc PKGBUILDs.
@@ -689,8 +690,11 @@
                        done
                        mv "$BUILDLOG" "$BUILDLOG.$i"
                fi
-
-               build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
+               if [ "$QUIET" = "1" ]; then
+                       build > "$BUILDLOG" 2>&1; ret=${PIPESTATUS[0]}
+               else
+                       build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
+               fi
        else
                build 2>&1 || ret=$?
        fi
@@ -1069,6 +1073,7 @@
        echo "$(gettext "  -m, --nocolor    Disable colorized output messages")"
        echo "$(gettext "  -o, --nobuild    Download and extract files only")"
        printf "$(gettext "  -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
+       echo "$(gettext "  -q, --quiet      Less verbose output to STDOUT")"
        echo "$(gettext "  -r, --rmdeps     Remove installed dependencies after a successful build")"
        # fix flyspray feature request #2978
        echo "$(gettext "  -R, --repackage  Repackage contents of pkg/ without building")"
@@ -1121,9 +1126,9 @@
 SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined

 # Parse Command Line Options.
-OPT_SHORT="AbcCdefFghiLmop:rRsSV"
+OPT_SHORT="AbcCdefFghiLmop:qrRsSV"
 OPT_LONG="ignorearch,asroot,builddeps,clean,cleancache,nodeps,noextract,force,forcever:,geninteg,help,holdver"
-OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,source,syncdeps,usesudo,version"
+OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,quiet,rmdeps,repackage,source,syncdeps,usesudo,version"
 # Pacman Options
 OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
 OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')"
@@ -1159,6 +1164,7 @@
                -m|--nocolor)     USE_COLOR='n' ;;
                -o|--nobuild)     NOBUILD=1 ;;
                -p)               shift; BUILDSCRIPT=$1 ;;
+               -q|--quiet)       QUIET=1 ;;
                -r|--rmdeps)      RMDEPS=1 ;;
                -R|--repackage)   REPKG=1 ;;
                --source)         SOURCEONLY=1 ;;




More information about the pacman-dev mailing list