gitrecipe/rename: avoid renaming incorrect files
PATCH 1/1 gitrecipe/rename: avoid renaming incorrect files
From: Jackie Huang <[email protected]>
Previously f.find('pn') will not only match 'pn' but also packages that have 'pn' in their names, for example 'python-glance' will match 'python-glance', 'python-glanceclient' and 'python-glancestore', so the later two packages will be incorrectly changed.
Get the exact package name to compare with pn to void this issue.
Signed-off-by Jackie Huang <[email protected]>
--- gitrecipe.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
gitrecipe.py +8 -4
@@ -66,10 +66,14 @@ class GitRecipe(Recipe): for f in os.listdir(self.recipe_dir): full_path_f = os.path.join(self.recipe_dir, f) - if os.path.isfile(full_path_f) and \ - ((f.find(self.env['PN']) == 0 and (f.find(old_git_tag) != -1 or - f.find("git") != -1) and f.find(".bb") != -1) or - (f.find(self.env['PN']) == 0 and f.find(".inc") != -1)): + + # We only care about files like pn_[pv|git].<bb|inc> + fname, fext = os.path.splitext(f) + if os.path.isfile(full_path_f) and (fext == ".bb" or fext == ".inc"): + f = fname.split("_") + if f[0] != self.env['PN'] or (len(f) == 2 and f[1] != old_git_tag and f[1] != "git"): + continue + with open(full_path_f + ".tmp", "w+") as temp_recipe: with open(full_path_f) as recipe: for line in recipe:
Signature · 1 line
1.9.1