feat: allow updating a patch #1

Merged
ptrcnull merged 1 commit from :overwrite-patch into master 2022-04-29 06:28:40 +00:00
Showing only changes of commit a065129fdb - Show all commits

6
apatch Normal file → Executable file
View file

@ -1,7 +1,10 @@
#!/bin/sh #!/bin/sh
startdir="$PWD"
patch_exists=0
[ -f APKBUILD ] || ( echo "please run this in a package directory"; exit 1 ) [ -f APKBUILD ] || ( echo "please run this in a package directory"; exit 1 )
[ ! -f "$1" ] || ( echo "patch $1 already exists"; exit 1 ) [ -f "$1" ] && patch_exists=1
[ "$1" != "" ] || ( echo "usage: apatch <patch name>"; exit 1 ) [ "$1" != "" ] || ( echo "usage: apatch <patch name>"; exit 1 )
abuild clean fetch unpack prepare abuild clean fetch unpack prepare
@ -13,6 +16,7 @@ abuild clean fetch unpack prepare
cp -r src src-old cp -r src src-old
( (
cd "src$builddir" cd "src$builddir"
[ "$patch_exists" -eq 1 ] && patch -p1 < "$startdir/$1"
$SHELL $SHELL
) )
busybox diff -U3 -r "src-old$builddir" "src$builddir" | sed "s|src-old$builddir|a|g;s|src$builddir|b|g" > $1 busybox diff -U3 -r "src-old$builddir" "src$builddir" | sed "s|src-old$builddir|a|g;s|src$builddir|b|g" > $1