From: Michael Tremer Date: Thu, 8 Dec 2011 21:48:27 +0000 (+0100) Subject: Fix applying fixed list of patches. X-Git-Tag: 0.9.19~12^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=24992eabaf8adefcd2ed661ee61488d7b116413b;p=pakfire.git Fix applying fixed list of patches. --- diff --git a/macros/build.macro b/macros/build.macro index f822adb38..fae499a10 100644 --- a/macros/build.macro +++ b/macros/build.macro @@ -58,7 +58,7 @@ MACRO_PERL_CLEANUP xargs --no-run-if-empty rm -f end -MACRO_PATCHES = /usr/lib/pakfire/patch %{patches} +MACRO_PATCHES = /usr/lib/pakfire/patch --search-path=%{DIR_PATCHES} %{patches} # Pre-defined build scripts. build diff --git a/macros/constants.macro b/macros/constants.macro index 8a9121d27..80ca85373 100644 --- a/macros/constants.macro +++ b/macros/constants.macro @@ -16,7 +16,7 @@ configure_options = \ # By default, take all patches from the patches directory # in alphabetical order. -patches = $(find %{DIR_PATCHES} -not -type d 2>/dev/null | sort) +patches = $(find . -not -type d 2>/dev/null | sort) sources = %{thisapp}.tar.gz # Macro definitions diff --git a/scripts/patch b/scripts/patch index dd8f2b9a2..32ddb390c 100755 --- a/scripts/patch +++ b/scripts/patch @@ -1,12 +1,40 @@ #!/bin/bash # Script that automatically applies patches. -if [ -n "${1}" ]; then +paths= +patches= + +while [ $# -gt 0 ]; do + case "${1}" in + --search-path=*) + paths="${paths} ${1#--search-path=}" + ;; + *) + patches="${patches} ${1}" + ;; + esac + shift +done + +if [ -n "${patches}" ]; then echo "Applying patches..." fi # Apply all patches given on command line. -for patch in $@; do +for patch in ${patches}; do + case "${patch}" in + /*) + ;; + *) + for path in ${paths}; do + if [ -e "${path}/${patch}" ]; then + patch="${path}/${patch}" + break + fi + done + ;; + esac + # Check if patch file does exist. if ! [ -e "${patch}" ]; then echo >&2 " ERROR: Patch file does not exist: ${patch}"