changeset 1814:5ff5fea0ad7a

Add EXTERNAL_PATCH_DIR option for applying patches from outside aboriginal
author Geoff Salmon <gsalmon@se-instruments.com>
date Thu, 12 Nov 2015 21:08:02 -0500
parents db11c049b66b
children 191dfad915ba
files config sources/download_functions.sh sources/variables.sh
diffstat 3 files changed, 41 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/config	Thu Nov 12 07:56:16 2015 -0600
+++ b/config	Thu Nov 12 21:08:02 2015 -0500
@@ -152,3 +152,14 @@
 
 # export CROSS_COMPILER_PATH=/path/to/cross-compiler/bin
 # export CC_PREFIX=thingy-
+
+# If you have patches you want patch files outside the aboriginal
+# patch directory to be applied, supply the path here. Paths to the
+# patches are built using the pattern
+#   ${EXTERNAL_PATCH_DIR}/${PACKAGE}/*.patch
+# So one or more patches to apply to linux could be in the
+# ${EXTERNAL_PATCH_DIR}/linux directory and will be applied in sorted
+# order. The path is either absolute or relative to the aboriginal
+# topdir.
+
+# export EXTERNAL_PATCH_DIR=/path/to/external/patches
\ No newline at end of file
--- a/sources/download_functions.sh	Thu Nov 12 07:56:16 2015 -0600
+++ b/sources/download_functions.sh	Thu Nov 12 21:08:02 2015 -0500
@@ -50,10 +50,33 @@
   echo "$1" | sed -e "$LOGRUS"
 }
 
+gather_patches()
+{
+  ls "$PATCHDIR/${PACKAGE}"-*.patch 2> /dev/null | sort | while read i
+  do
+    if [ -f "$i" ]
+    then
+      echo "$i"
+    fi
+  done
+
+  # gather external package patches sorted by filename
+  if [ ! -z "$EXTERNAL_PATCH_DIR" ] && [ -d "${EXTERNAL_PATCH_DIR}/${PACKAGE}" ]
+  then
+    for i in "${EXTERNAL_PATCH_DIR}/${PACKAGE}/"*.patch
+    do
+      if [ -f "$i" ]
+      then
+        echo "$i"
+      fi
+    done
+  fi
+}
+
 # Apply any patches to this package
 patch_package()
 {
-  ls "$PATCHDIR/${PACKAGE}"-*.patch 2> /dev/null | sort | while read i
+  gather_patches | while read i
   do
     if [ -f "$i" ]
     then
@@ -151,7 +174,7 @@
   SHALIST=$(cat "$SHA1FILE" 2> /dev/null)
   if [ ! -z "$SHALIST" ]
   then
-    for i in "$SHA1TAR" $(sha1file "$PATCHDIR/$PACKAGE"-*.patch 2>/dev/null)
+    for i in "$SHA1TAR" $(sha1file $(gather_patches))
     do
       # Is this sha1 in the file?
       if [ -z "$(echo "$SHALIST" | grep "$i")" ]
--- a/sources/variables.sh	Thu Nov 12 07:56:16 2015 -0600
+++ b/sources/variables.sh	Thu Nov 12 21:08:02 2015 -0500
@@ -53,6 +53,11 @@
 export_if_blank HOSTTOOLS="$BUILD/host"
 export_if_blank WRAPDIR="$BUILD/record-commands"
 
+if [ ! -z "$EXTERNAL_PATCH_DIR" ]
+then
+    export EXTERNAL_PATCH_DIR=$(readlink -e "$EXTERNAL_PATCH_DIR")
+fi
+
 # Set a default non-arch
 
 export WORK="${BUILD}/host-temp"