On 06/05/2017 12:32, Jon Turney wrote:
On 05/05/2017 23:06, Yaakov Selkowitz wrote:
On 2017-05-02 08:13, Jon Turney wrote:
The values which SRC_URI and PATCH_URI evaluate to should not change
depending on ARCH, as this will make the source package arch-dependent

I think this would require a proper src_prep first, so that patches may
be still be arch-conditionalized there instead.

Ok, that makes sense.

So I guess there could be a hook called for each patch to cause it to be
applied/skipped, or to adjust the patch list?  Or do you think more of
__src_prep needs to be customizable?


Attached is an implementation of the first suggestion.


From 4690490e81ddc2c429d3e124639b2814db96f249 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.tur...@dronecode.org.uk>
Date: Sat, 6 May 2017 13:37:13 +0100
Subject: [PATCH cygport] Add src_patch_apply_hook

---
 lib/check_funcs.cygpart |  1 +
 lib/src_prep.cygpart    | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/lib/check_funcs.cygpart b/lib/check_funcs.cygpart
index 93f3e12..bfa02f5 100644
--- a/lib/check_funcs.cygpart
+++ b/lib/check_funcs.cygpart
@@ -687,6 +687,7 @@ __check_unstable() {
        else
                warning "The ${1} API is not yet stable and is subject to 
change"
                warning "You must define ${unstable_var} in order to use it"
+               return  0
        fi
 }
 
diff --git a/lib/src_prep.cygpart b/lib/src_prep.cygpart
index d787d2f..aad5564 100644
--- a/lib/src_prep.cygpart
+++ b/lib/src_prep.cygpart
@@ -209,6 +209,24 @@ cygpatch() {
                        continue;
                fi
 
+#****v* Preparation/src_patch_apply_hook
+#  DESCRIPTION
+#  src_patch_apply_hook() is an optional function which can be defined
+#  to control patch application, for architecture dependent patches, etc.
+#  It receives a patch filename as an argument, and a non-zero result
+#  causes the patch to be skipped.
+#  (This API is not yet stable and is subject to change)
+#****
+
+               if __check_function src_patch_apply_hook
+               then
+                       if ! __check_unstable src_patch_apply_hook 
${patchfile_name}
+                       then
+                               warning "patch ${patchfile_name} skipped by 
src_patch_apply_hook";
+                               continue;
+                       fi
+               fi
+
                patchlevel=0;
 
                case ${patchfile_name} in
-- 
2.12.2

Reply via email to