]> git.ipfire.org Git - pakfire.git/commitdiff
Fix applying fixed list of patches.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Dec 2011 21:48:27 +0000 (22:48 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 8 Dec 2011 22:44:03 +0000 (23:44 +0100)
macros/build.macro
macros/constants.macro
scripts/patch

index f822adb38036953320cfa84f31493a68b23e3aca..fae499a10bb4b98796906d679a982a53ecb0f9c8 100644 (file)
@@ -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
index 8a9121d27fa100bfb98741b241cae93bdd821794..80ca8537313f0460b632e3fd4f3143e09053afbb 100644 (file)
@@ -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
index dd8f2b9a219a089813c6e5beea3a9915ec59c1cb..32ddb390c3b65b71c4c643837f0d9aaaa9db20f6 100755 (executable)
@@ -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}"