[Buildroot] [PATCH] apply-patches.sh: Use series.host for host package (if exists) instead of series
Kuldeep Singh Dhaka
kuldeepdhaka9 at gmail.com
Sat Jul 28 06:31:18 UTC 2018
This allow apply differential patching depending upon the package being compiled for (target or host)
Backward compatible: If series.host do not exists, it simply apply series (original behaviour)
Signed-off-by: Kuldeep Singh Dhaka <kuldeep at madresistor.com>
---
support/scripts/apply-patches.sh | 13 +++++++++++--
1 file changed, 11 insertions(+), 2 deletions(-)
diff --git a/support/scripts/apply-patches.sh b/support/scripts/apply-patches.sh
index 66fef262ee..81e8cec036 100755
--- a/support/scripts/apply-patches.sh
+++ b/support/scripts/apply-patches.sh
@@ -46,6 +46,8 @@ patchdir=${2-../kernel-patches}
shift 2
patchpattern=${@-*}
+case "$(basename ${builddir})" in host-*) hostpkg=y;; esac;
+
# use a well defined sorting order
export LC_COLLATE=C
@@ -131,15 +133,22 @@ function scan_patchdir {
shift 1
patches=${@-*}
+ # If there is a series.host file and the package is host, use it instead of series.
+ if [ -e "${path}/series.host" -a "${hostpkg}" ] ; then
+ series="${path}/series.host"
+ elif [ -e "${path}/series" ]; then
+ series="${path}/series"
+ fi
+
# If there is a series file, use it instead of using ls sort order
# to apply patches. Skip line starting with a dash.
- if [ -e "${path}/series" ] ; then
+ if [ -n "${series}" ] ; then
# The format of a series file accepts a second field that is
# used to specify the number of directory components to strip
# when applying the patch, in the form -pN (N an integer >= 0)
# We assume this field to always be -p1 whether it is present
# or missing.
- series_patches="`grep -Ev "^#" ${path}/series | cut -d ' ' -f1 2> /dev/null`"
+ series_patches="`grep -Ev "^#" ${series} | cut -d ' ' -f1 2> /dev/null`"
for i in $series_patches; do
apply_patch "$path" "$i" series
done
--
2.18.0
More information about the buildroot
mailing list