Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/common-functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/common-functions')
-rwxr-xr-xlib/common-functions17
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/common-functions b/lib/common-functions
index b29379b..cd938f8 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -891,3 +891,20 @@ failsafe_rsync() {
done
return 1
}
+
+# apply_trunk_patch source_dir diff_source_dir
+# apply a patch between diff_source_dir/PKGBUILD and
+# diff_source_dir/../../trunk/PKGBUILD onto source_dir/PKGBUILD
+apply_trunk_patch() {
+ local source_dir="$1"
+ local diff_source_dir="$2"
+ if [ -z "${diff_source_dir}" ]; then
+ # no diff_source_dir => no action
+ return
+ fi
+ diff -u3 "${diff_source_dir}/PKGBUILD" "${diff_source_dir}/../../trunk/PKGBUILD" \
+ | sed '
+ 1,2 s#^\(\(+++\|---\)\s\+\)\S\+/\(PKGBUILD\s.*\)$#\1\3#
+ ' \
+ | patch -p0 "${source_dir}/PKGBUILD"
+}