Commit e9509e5f authored by Natanael Copa's avatar Natanael Copa

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!
parent 072e9345
......@@ -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;;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment