feat: better log messages

This commit is contained in:
ptrcnull 2022-07-30 02:32:11 +02:00
parent 00d7fdace6
commit 833280f1a9

27
apatch
View file

@ -1,6 +1,29 @@
#!/bin/sh #!/bin/sh
startdir="$PWD" # output functions from abuild/functions.sh
NORMAL="\033[1;0m"
STRONG="\033[1;1m"
RED="\033[1;31m"
GREEN="\033[1;32m"
YELLOW="\033[1;33m"
BLUE="\033[1;34m"
_prefix="${BLUE}${STRONG}apatch${NORMAL}:"
msg() {
local prompt="$GREEN>>> ${_prefix}"
printf "${prompt} %s\n" "$1" >&2
}
warning() {
local prompt="${YELLOW}>>> WARNING: ${_prefix}"
printf "${prompt} %s\n" "$1" >&2
}
error() {
local prompt="${RED}>>> ERROR: ${_prefix}"
printf "${prompt} %s\n" "$1" >&2
}
if [ ! -f APKBUILD ]; then if [ ! -f APKBUILD ]; then
error "please run this in a package directory" error "please run this in a package directory"
@ -14,6 +37,7 @@ fi
set -e set -e
msg "running abuild"
abuild clean fetch unpack default_prepare abuild clean fetch unpack default_prepare
# obtain builddir # obtain builddir
@ -30,6 +54,7 @@ for patch in $source; do
# but we want the original src to not have it, so we can get a full diff of # but we want the original src to not have it, so we can get a full diff of
# its original changes + our new ones # its original changes + our new ones
( (
msg "reversing $patch"
cd "$builddir" cd "$builddir"
patch -R -p1 < "$patchpath" patch -R -p1 < "$patchpath"
) )