summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2010-05-18 09:42:04 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2010-05-18 09:42:53 +0000
commite9509e5ffe767888a2d5c738818ff31eaa8fa3a8 (patch)
tree886719e46b893175843266ab95eb9e0f4d73eed8
parent072e93458d554ee22c74c97a3b23d0a24d99d0c9 (diff)
downloadabuild-e9509e5ffe767888a2d5c738818ff31eaa8fa3a8.tar.bz2
abuild-e9509e5ffe767888a2d5c738818ff31eaa8fa3a8.tar.xz
abuild: support for -c and -m options to enable/disable colors
and make sure those options are passed over when building recursively Based on patch from Andrew Manison. Thanks!
-rwxr-xr-xabuild.in30
1 files changed, 24 insertions, 6 deletions
diff --git a/abuild.in b/abuild.in
index 21b1b43..775469d 100755
--- a/abuild.in
+++ b/abuild.in
@@ -26,15 +26,27 @@ APK=${APK:-apk}
ABUILD_CONF=${ABUILD_CONF:-"$sysconfdir/abuild.conf"}
[ -f "$ABUILD_CONF" ] && . "$ABUILD_CONF"
-
-#colors
-if [ -n "$USE_COLORS" ]; then
+default_colors() {
NORMAL="\033[1;0m"
STRONG="\033[1;1m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
+}
+
+monochrome() {
+ NORMAL=""
+ STRONG=""
+ RED=""
+ GREEN=""
+ YELLOW=""
+ BLUE=""
+}
+
+#colors
+if [ -n "$USE_COLORS" ]; then
+ default_colors
fi
@@ -663,7 +675,7 @@ rootpkg() {
fi
cd "$startdir"
[ -n "$FAKEROOT" ] && msg "Entering fakeroot..."
- $FAKEROOT "$abuild_path" $do_build \
+ $FAKEROOT -- "$abuild_path" $color_opt $do_build \
prepare_subpackages \
prepare_package \
create_apks
@@ -873,7 +885,7 @@ builddeps() {
msg "Entering $dir"
cd "$dir" && $0 $forceroot $keep $quiet $install_deps \
- $recursive $upgrade abuildindex || return 1
+ $recursive $upgrade $color_opt abuildindex || return 1
done
$SUDO $APK add -u --repository "$abuildrepo" \
--wait 30 \
@@ -1016,12 +1028,14 @@ usage() {
echo " [-s SRCDEST] [cmd] ..."
echo " $program [-c] -n PKGNAME[-PKGVER]"
echo "Options:"
+ echo " -c Enable colored output"
echo " -d Disable dependency checking"
echo " -f Force specified cmd, even if they are already done"
echo " -F Force run as root"
echo " -h Show this help"
echo " -i Install PKG after successul build"
echo " -k Keep built packages, even if APKBUILD or sources are newer"
+ echo " -m Disable colors (monochrome)"
echo " -p Set package destination directory"
echo " -P Set PKGDEST to REPODEST/<repo>, where repo is the parents dir name"
echo " -q Quiet"
@@ -1055,14 +1069,18 @@ usage() {
APKBUILD="${APKBUILD:-./APKBUILD}"
unset force
unset recursive
-while getopts "dfFhi:kinp:P:qrRs:u" opt; do
+while getopts "cdfFhi:kimnp:P:qrRs:u" opt; do
case $opt in
+ 'c') default_colors
+ color_opt="-c";;
'd') nodeps=1;;
'f') force="-f";;
'F') forceroot="-F";;
'h') usage;;
'i') install_after="$install_after $OPTARG";;
'k') keep="-k";;
+ 'm') monochrome
+ color_opt="-m";;
'n') die "Use newapkbuild to create new aports";;
'p') PKGDEST=$OPTARG;;
'P') REPODEST=$OPTARG;;