[pacman-dev] [PATCHv2 02/10] makepkg: use output_format, add --quiet option
William Giokas
1007380 at gmail.com
Sun Mar 3 13:48:17 EST 2013
output_format.sh is now much the same as the original message
subroutines, so just use m4_include to pull that in. This also adds a
`(( QUIET )) && return` to the output format section, allowing for a
--quiet switch to suppress some output.
Signed-off-by: William Giokas <1007380 at gmail.com>
---
This patch isn't terribly important, since makepkg already prints in color,
I just thought consolidating the code for printing would make more sense.
doc/makepkg.8.txt | 4 ++++
scripts/makepkg.sh.in | 35 +++++++----------------------------
2 files changed, 11 insertions(+), 28 deletions(-)
diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 498c79b..94343b5 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -118,6 +118,10 @@ Options
Read the package script `buildscript` instead of the `PKGBUILD` default;
see linkman:PKGBUILD[5].
+*-q, \--quiet*::
+ Suppress makepkg messages. Does not change printing of commands in
+ PKGBUILD, error or warning messages.
+
*-r, \--rmdeps*::
Upon successful build, remove any dependencies installed by makepkg
during dependency auto-resolution and installation when using `-s`.
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index bd29d73..a90efe5 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -79,6 +79,7 @@ CHECKFUNC=0
PKGFUNC=0
PKGVERFUNC=0
SPLITPKG=0
+QUIET=0
PKGLIST=()
SIGNPKG=''
@@ -92,31 +93,7 @@ shopt -s extglob
### SUBROUTINES ###
-plain() {
- local mesg=$1; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg() {
- local mesg=$1; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg2() {
- local mesg=$1; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-warning() {
- local mesg=$1; shift
- printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-error() {
- local mesg=$1; shift
- printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
+m4_include(library/output_format.sh)
##
# Special exit call for traps, Don't print any error messages when inside,
@@ -2404,6 +2381,7 @@ usage() {
printf -- "$(gettext " -m, --nocolor Disable colorized output messages")\n"
printf -- "$(gettext " -o, --nobuild Download and extract files only")\n"
printf -- "$(gettext " -p <file> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
+ printf -- "$(gettext " -q, --quiet Suppress some makepkg output")\n"
printf -- "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")\n"
printf -- "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")\n"
printf -- "$(gettext " -s, --syncdeps Install missing dependencies with %s")\n" "pacman"
@@ -2454,11 +2432,11 @@ fi
ARGLIST=("$@")
# Parse Command Line Options.
-OPT_SHORT="AcdefFghiLmop:rRsSV"
+OPT_SHORT="AcdefFghiLmop:qrRsSV"
OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'config:' 'force' 'geninteg'
'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'nobuild' 'nocolor'
- 'nocheck' 'nodeps' 'noextract' 'nosign' 'pkg:' 'repackage' 'rmdeps'
- 'skipchecksums' 'skipinteg' 'skippgpcheck' 'skippgpcheck' 'sign'
+ 'nocheck' 'nodeps' 'noextract' 'nosign' 'pkg:' 'quiet' 'repackage'
+ 'rmdeps' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'skippgpcheck' 'sign'
'source' 'syncdeps' 'version')
# Pacman Options
@@ -2500,6 +2478,7 @@ while true; do
-o|--nobuild) NOBUILD=1 ;;
-p) shift; BUILDFILE=$1 ;;
--pkg) shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;;
+ -q|--quiet) QUIET=1 ;;
-r|--rmdeps) RMDEPS=1 ;;
-R|--repackage) REPKG=1 ;;
--skipchecksums) SKIPCHECKSUMS=1 ;;
--
1.8.2.rc1.24.g06d67b8
More information about the pacman-dev
mailing list