Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/build-packages32
-rwxr-xr-xlib/common-functions17
2 files changed, 47 insertions, 2 deletions
diff --git a/bin/build-packages b/bin/build-packages
index fc61e78..4fb9d88 100755
--- a/bin/build-packages
+++ b/bin/build-packages
@@ -17,6 +17,12 @@ usage() {
>&2 echo 'build-packages: build package(s) on the build-list'
>&2 echo ''
>&2 echo 'possible options:'
+ >&2 echo ' -d|--diff source-directory:'
+ >&2 echo ' Apply the diff between $source-directory/PKGBUILD and'
+ >&2 echo ' $source-directory/../../trunk/PKGBUILD before building.'
+ >&2 echo ' This option is intended for building from trunk where minor'
+ >&2 echo ' fixes did not get released yet. Hence, it conflicts intentionally'
+ >&2 echo ' with -n, -l, -t or -x and it requires -p.'
>&2 echo ' -h|--help: Show this help and exit.'
>&2 echo ' -l|--local pkgname.git-revision.git-mod-revision.repository:'
>&2 echo ' Build the given package without asking / reporting to the'
@@ -61,7 +67,8 @@ usage() {
}
eval set -- "$(
- getopt -o hl:n:p:s:t:ux \
+ getopt -o d:hl:n:p:s:t:ux \
+ --long diff: \
--long help \
--long local: \
--long prefer: \
@@ -72,6 +79,7 @@ eval set -- "$(
)"
unset count
+unset diff_source_dir
unset forced_package
unset forced_straws
unset prefered_package
@@ -81,6 +89,14 @@ timeout=0
while true
do
case "$1" in
+ -d|--diff)
+ shift
+ if [ -n "${diff_source_dir}" ]; then
+ >&2 echo 'Option -d, --diff can be given only once.'
+ usage
+ fi
+ diff_source_dir="$1"
+ ;;
-h|--help)
usage 0
;;
@@ -134,6 +150,17 @@ if [ $# -ne 0 ]; then
usage
fi
+if [ -n "${diff_source_dir}" ]; then
+ if [ -n "${count}" ] || \
+ [ -n "${forced_package}" ] || \
+ [ "${timeout}" -ne 0 ] || \
+ ${exit_after_failure} || \
+ [ -z "${prefered_package}" ]; then
+ >&2 echo 'Conflicting flags.'
+ usage
+ fi
+fi
+
if [ -n "${forced_package}" ]; then
if [ -n "${count}" ] || \
[ "${timeout}" -ne 0 ] || \
@@ -319,7 +346,8 @@ while [ "${count}" -ne 0 ] && \
if ! git_repo=$(find_repository_with_commit "${git_revision}") || \
[ -z "${git_repo}" ] || \
! find_pkgbuilds "${package}" "${repository}" "${git_repo}" "${git_revision}" "${mod_git_revision}" || \
- ! extract_source_directory "${git_repo}" "${git_revision}" "${mod_git_revision}" "${tmp_dir}" "${sub_pkgrel}"; then
+ ! extract_source_directory "${git_repo}" "${git_revision}" "${mod_git_revision}" "${tmp_dir}" "${sub_pkgrel}" || \
+ ! apply_trunk_patch "${tmp_dir}" "${diff_source_dir}"; then
# report local failure (probably a missing commit) to build-master
# shellcheck disable=SC2029
ssh \
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"
+}