diff mbox series

patch: add minver and maxver parameters

Message ID 20190508104024.26159-1-ross.burton@intel.com
State Accepted
Commit 3fac9f884ac6bcc0280e1bb5d0f0e397bb53678f
Headers show
Series patch: add minver and maxver parameters | expand

Commit Message

Ross Burton May 8, 2019, 10:40 a.m. UTC
Add minver/maxver parameters to limit patch application by comparing PV.

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/lib/oe/patch.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
diff mbox series

Patch

diff --git a/meta/lib/oe/patch.py b/meta/lib/oe/patch.py
index f43cf047c06..91624e26ddb 100644
--- a/meta/lib/oe/patch.py
+++ b/meta/lib/oe/patch.py
@@ -847,6 +847,7 @@  def src_patches(d, all=False, expand=True):
 
 
 def should_apply(parm, d):
+    import bb.utils
     if "mindate" in parm or "maxdate" in parm:
         pn = d.getVar('PN')
         srcdate = d.getVar('SRCDATE_%s' % pn)
@@ -883,5 +884,15 @@  def should_apply(parm, d):
         if srcrev and parm["notrev"] in srcrev:
             return False, "doesn't apply to revision"
 
+    if "maxver" in parm:
+        pv = d.getVar('PV')
+        if bb.utils.vercmp_string_op(pv, parm["maxver"], ">"):
+            return False, "applies to earlier version"
+
+    if "minver" in parm:
+        pv = d.getVar('PV')
+        if bb.utils.vercmp_string_op(pv, parm["minver"], "<"):
+            return False, "applies to later version"
+
     return True, None