diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt index 198aa95..2e2b8ee 100644 --- a/doc/makepkg.8.txt +++ b/doc/makepkg.8.txt @@ -142,6 +142,14 @@ Options such as a chroot or remote builder. It will also satisfy requirements of the GPL when distributing binary packages. +*\--altmsg*:: + Switch message behavior so that messages printed by makepkg behave like + one would expect, printing normal messages to stdout while printing errors + to stderr. The standard behavior for makepkg is to print every message + to stderr except for messages generated by the actual build procedure or by + `-g` so that this output can be conveniently redirected into a PKGBUILD + for updating the md5sums. + *\--source*:: Do not actually build the package, but build a source-only tarball that does not include sources that can be fetched via a download URL. This is diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 3d776f0..a37f246 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -68,6 +68,7 @@ RMDEPS=0 REPKG=0 LOGGING=0 SOURCEONLY=0 +ALTMSG=0 IGNOREARCH=0 HOLDVER=0 BUILDFUNC=0 @@ -84,22 +85,38 @@ PACMAN_OPTS= plain() { local mesg=$1; shift - printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + if (( ${ALTMSG} )); then + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 + else + printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + fi } msg() { local mesg=$1; shift - printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + if (( ${ALTMSG} )); then + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 + else + printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + fi } msg2() { local mesg=$1; shift - printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + if (( ${ALTMSG} )); then + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 + else + printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + fi } warning() { local mesg=$1; shift - printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + if (( ${ALTMSG} )); then + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&1 + else + printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2 + fi } error() { @@ -1453,6 +1470,7 @@ usage() { echo "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")" echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")" echo "$(gettext " --allsource Generate a source-only tarball including downloaded sources")" + echo "$(gettext " --altmsg Switch message behavior (see man for details")" echo "$(gettext " --asroot Allow makepkg to run as root user")" printf "$(gettext " --config Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf" echo "$(gettext " --holdver Prevent automatic version bumping for development PKGBUILDs")" @@ -1490,7 +1508,7 @@ ARGLIST=("$@") # Parse Command Line Options. OPT_SHORT="AcCdefFghiLmop:rRsV" -OPT_LONG="allsource,asroot,ignorearch,clean,cleancache,nodeps" +OPT_LONG="allsource,altmsg,asroot,ignorearch,clean,cleancache,nodeps" OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver" OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,skipinteg" OPT_LONG="$OPT_LONG,source,syncdeps,version,config:" @@ -1512,6 +1530,7 @@ while true; do # Makepkg Options --allsource) SOURCEONLY=2 ;; + --altmsg) ALTMSG=1 ;; --asroot) ASROOT=1 ;; -A|--ignorearch) IGNOREARCH=1 ;; -c|--clean) CLEANUP=1 ;;