feat: better log messages
This commit is contained in:
parent
00d7fdace6
commit
833280f1a9
1 changed files with 26 additions and 1 deletions
27
apatch
27
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"
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue