[yocto] [PATCH][rrs] rrs_upstream_history.py: Fix use regexes in packages

Aníbal Limón anibal.limon at linux.intel.com
Tue Sep 22 16:41:11 PDT 2015


Make difference when handling suffixes or preffixes like 'nativesdk-'
when try to use regexes in packages that have suffixes like '-crosssdk'
it can contain the arch into it like binutils-crosssdk-x86_64.

Use split method in suffixes and replace method into preffixes, this
fixes issues with suffixes containing archs at end.

[YOCTO #8102]

Signed-off-by: Aníbal Limón <anibal.limon at linux.intel.com>
---
 rrs/tools/rrs_upstream_history.py | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py
index aeac3d3..3db8f38 100755
--- a/rrs/tools/rrs_upstream_history.py
+++ b/rrs/tools/rrs_upstream_history.py
@@ -54,14 +54,20 @@ def set_regexes(d):
         return
 
     suffixes = d.getVar('SPECIAL_PKGSUFFIX', True).split()
-    suffixes.append('nativesdk-')
+    prefixes = ['nativesdk-']
 
-    localdata = bb.data.createCopy(d)
+    special = list(suffixes)
+    special.extend(prefixes)
 
+    localdata = bb.data.createCopy(d)
     pn = localdata.getVar('PN', True)
-    for sfx in suffixes:
-        if pn.find(sfx) != -1:
-            pnstripped = pn.replace(sfx, '')
+    for s in special:
+        if pn.find(s) != -1:
+            if s in suffixes:
+                pnstripped = pn.split(s)[0]
+            else:
+                pnstripped = pn.replace(s, '')
+
             localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" +
                     d.getVar('OVERRIDES', True))
             bb.data.update_data(localdata)
-- 
1.9.1




More information about the yocto mailing list