From d1d108507c6825824e0931e088b1f4b2480612e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= Date: Mon, 10 Aug 2015 14:33:32 -0500 Subject: [PATCH] rrs_upstream_history.py: Use regexes in SPECIAL_PKGSUFFIX packages MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When SPECIAL_PKGSUFFIX packages don't have regexes use it from package without SPECIAL_PKGSUFFIX. [YOCTO #8102] For example: python-native use regex from python if don't have one. Signed-off-by: Aníbal Limón --- rrs/tools/rrs_upstream_history.py | 40 +++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/rrs/tools/rrs_upstream_history.py b/rrs/tools/rrs_upstream_history.py index 521b733..aeac3d3 100755 --- a/rrs/tools/rrs_upstream_history.py +++ b/rrs/tools/rrs_upstream_history.py @@ -39,6 +39,43 @@ sys.path.insert(0, os.path.join(bitbakepath, 'lib')) from layerindex.models import Recipe, LayerBranch from rrs.models import RecipeUpstream, RecipeUpstreamHistory +def set_regexes(d): + """ + Utility function to set regexes to SPECIAL_PKGSUFFIX packages + that don't have set it. + + For example: python-native use regex from python if don't have + one set it. + """ + + variables = ['REGEX', 'REGEX_URI', 'GITTAGREGEX'] + + if any(d.getVar(var, True) for var in variables): + return + + suffixes = d.getVar('SPECIAL_PKGSUFFIX', True).split() + suffixes.append('nativesdk-') + + localdata = bb.data.createCopy(d) + + pn = localdata.getVar('PN', True) + for sfx in suffixes: + if pn.find(sfx) != -1: + pnstripped = pn.replace(sfx, '') + localdata.setVar('OVERRIDES', "pn-" + pnstripped + ":" + + d.getVar('OVERRIDES', True)) + bb.data.update_data(localdata) + + for var in variables: + new_value = localdata.getVar(var, True) + if new_value is None: + continue + + d.setVar(var, new_value) + logger.debug("%s: %s new value %s" % (pn, var, + d.getVar(var, True))) + break + def get_upstream_info(thread_worker, arg): from bb.utils import vercmp_string from oe.recipeutils import get_recipe_upstream_version, \ @@ -122,6 +159,9 @@ if __name__=="__main__": if not recipes: continue + for recipe_data in recipes: + set_regexes(recipe_data) + history = RecipeUpstreamHistory(start_date = datetime.now()) from oe.utils import ThreadedPool