mirror of
https://gitlab.alpinelinux.org/alpine/abuild.git
synced 2024-12-22 07:00:28 +00:00
use colors on messages
This commit is contained in:
parent
e4a3c05d83
commit
d9f5462b34
33
abuild
33
abuild
@ -25,20 +25,41 @@ PKGDEST=${PKGDEST:-$startdir}
|
||||
|
||||
default_cmds="sanitycheck builddeps clean fetch md5check unpack rootpkg"
|
||||
|
||||
#colors
|
||||
if [ -n "$USE_COLORS" ]; then
|
||||
NORMAL="\033[1;0m"
|
||||
STRONG="\033[1;1m"
|
||||
RED="\033[1;31m"
|
||||
GREEN="\033[1;32m"
|
||||
YELLOW="\033[1;33m"
|
||||
BLUE="\033[1;34m"
|
||||
fi
|
||||
|
||||
|
||||
# functions
|
||||
msg() {
|
||||
local fake="${FAKEROOTKEY:+(fakeroot) }"
|
||||
local name="${subpkgname:-$pkgname}"
|
||||
[ -z "$quiet" ] && echo ">>> ${fake}${name}:" "$@" >&2
|
||||
local prompt="$GREEN>>>${NORMAL}"
|
||||
local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }"
|
||||
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||
[ -z "$quiet" ] && printf "${prompt} ${fake}${name}: $@\n" >&2
|
||||
}
|
||||
|
||||
warning() {
|
||||
echo ">>> Warning:" "$@" >&2
|
||||
local prompt="${YELLOW}>>> WARNING: ${NORMAL}"
|
||||
local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }"
|
||||
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||
printf "${prompt} ${fake}${name}: $@\n" >&2
|
||||
}
|
||||
|
||||
error() {
|
||||
local prompt="${RED}>>> ERROR: ${NORMAL}"
|
||||
local fake="${FAKEROOTKEY:+${BLUE}(fakeroot)${NORMAL} }"
|
||||
local name="${STRONG}${subpkgname:-$pkgname}${NORMAL}"
|
||||
printf "${prompt} ${fake}${name}: $@\n" >&2
|
||||
}
|
||||
|
||||
die() {
|
||||
quiet=
|
||||
msg "$@" >&2
|
||||
error "$@"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
@ -4,3 +4,6 @@ export CXXFLAGS="$CFLAGS"
|
||||
export PATH=:/usr/i386-gentoo-linux-uclibc/binutils-bin/2.18:$PATH
|
||||
|
||||
export MAKEFLAGS=-j2
|
||||
|
||||
# remove line below to disable colors
|
||||
USE_COLORS=1
|
||||
|
Loading…
Reference in New Issue
Block a user