From 833280f1a90863d06907024145484d5e348d1d01 Mon Sep 17 00:00:00 2001 From: ptrcnull Date: Sat, 30 Jul 2022 02:32:11 +0200 Subject: [PATCH] feat: better log messages --- apatch | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/apatch b/apatch index c2b9601..8417de8 100755 --- a/apatch +++ b/apatch @@ -1,6 +1,29 @@ #!/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 error "please run this in a package directory" @@ -14,6 +37,7 @@ fi set -e +msg "running abuild" abuild clean fetch unpack default_prepare # 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 # its original changes + our new ones ( + msg "reversing $patch" cd "$builddir" patch -R -p1 < "$patchpath" )