From c1c3c9a4fbaf01a905f79b0970f98ccb221a3935 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?An=C3=ADbal=20Lim=C3=B3n?= Date: Mon, 1 Jun 2015 16:04:29 -0500 Subject: recipeutils: Improve get_recipe_pv_without_srcpv function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use pv instead of rd this make the function more generic and avoid copy recipe data. Signed-off-by: Aníbal Limón --- meta/lib/oe/recipeutils.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'meta/lib') diff --git a/meta/lib/oe/recipeutils.py b/meta/lib/oe/recipeutils.py index 37efefb093..26bbf3e5c9 100644 --- a/meta/lib/oe/recipeutils.py +++ b/meta/lib/oe/recipeutils.py @@ -626,23 +626,17 @@ def replace_dir_vars(path, d): path = path.replace(dirpath, '${%s}' % dirvars[dirpath]) return path -def get_recipe_pv_without_srcpv(rd, uri_type): +def get_recipe_pv_without_srcpv(pv, uri_type): """ Get PV without SRCPV common in SCM's for now only support git. Returns tuple with pv, prefix and suffix. """ - pv = '' pfx = '' sfx = '' if uri_type == 'git': - rd_tmp = rd.createCopy() - - rd_tmp.setVar('SRCPV', '') - pv = rd_tmp.getVar('PV', True) - git_regex = re.compile("(?P(v|))(?P((\d+[\.\-_]*)+))(?P(\+|)(git|)(r|)(AUTOINC|)(\+|))(?P.*)") m = git_regex.match(pv) @@ -650,8 +644,6 @@ def get_recipe_pv_without_srcpv(rd, uri_type): pv = m.group('ver') pfx = m.group('pfx') sfx = m.group('sfx') - else: - pv = rd.getVar('PV', True) return (pv, pfx, sfx) @@ -704,7 +696,7 @@ def get_recipe_upstream_version(rd): pupver = ud.method.latest_versionstring(ud, rd) if uri_type == 'git': - (pv, pfx, sfx) = get_recipe_pv_without_srcpv(rd, uri_type) + (pv, pfx, sfx) = get_recipe_pv_without_srcpv(pv, uri_type) latest_revision = ud.method.latest_revision(ud, rd, ud.names[0]) -- cgit v1.2.3