summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-02-24 08:40:10 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-28 11:33:00 +0000
commitd30cc760394e77af64cc63add20344477789f97b (patch)
tree5c15a14e106e74c2ac6cbbbb29ee40fa11cb32b0 /scripts/lib/devtool/upgrade.py
parent75eeeabe3c60efa40c31789ea083ca35a46b9296 (diff)
downloadpoky-d30cc760394e77af64cc63add20344477789f97b.tar.gz
devtool: upgrade: fix renaming of recipe if PV is not in name
If the actual value of PV isn't in the name of the recipe (for example, a git or svn recipe) there's no point trying to rename it. Additionally, we already have the original filename, there's no need to guess it - just pass it in. (From OE-Core rev: e144db3650b4a7c0a59066621905f34a5400303e) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r--scripts/lib/devtool/upgrade.py22
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index f2a93b7acf..9a308b1218 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -83,21 +83,19 @@ def _rename_recipe_dirs(oldpv, newpv, path):
83 if olddir != newdir: 83 if olddir != newdir:
84 shutil.move(os.path.join(path, olddir), os.path.join(path, newdir)) 84 shutil.move(os.path.join(path, olddir), os.path.join(path, newdir))
85 85
86def _rename_recipe_file(bpn, oldpv, newpv, path): 86def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path):
87 oldrecipe = "%s_%s.bb" % (bpn, oldpv) 87 oldrecipe = os.path.basename(oldrecipe)
88 newrecipe = "%s_%s.bb" % (bpn, newpv) 88 if oldrecipe.endswith('_%s.bb' % oldpv):
89 if os.path.isfile(os.path.join(path, oldrecipe)): 89 newrecipe = '%s_%s.bb' % (bpn, newpv)
90 if oldrecipe != newrecipe: 90 if oldrecipe != newrecipe:
91 _run('mv %s %s' % (oldrecipe, newrecipe), cwd=path) 91 shutil.move(os.path.join(path, oldrecipe), os.path.join(path, newrecipe))
92 else: 92 else:
93 recipe = "%s_git.bb" % bpn 93 newrecipe = oldrecipe
94 if os.path.isfile(os.path.join(path, recipe)):
95 newrecipe = recipe
96 return os.path.join(path, newrecipe) 94 return os.path.join(path, newrecipe)
97 95
98def _rename_recipe_files(bpn, oldpv, newpv, path): 96def _rename_recipe_files(oldrecipe, bpn, oldpv, newpv, path):
99 _rename_recipe_dirs(oldpv, newpv, path) 97 _rename_recipe_dirs(oldpv, newpv, path)
100 return _rename_recipe_file(bpn, oldpv, newpv, path) 98 return _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path)
101 99
102def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d): 100def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d):
103 """Writes an append file""" 101 """Writes an append file"""
@@ -243,7 +241,9 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
243 oldpv = crd.getVar('PV', True) 241 oldpv = crd.getVar('PV', True)
244 if not newpv: 242 if not newpv:
245 newpv = oldpv 243 newpv = oldpv
246 fullpath = _rename_recipe_files(bpn, oldpv, newpv, path) 244 origpath = rd.getVar('FILE', True)
245 fullpath = _rename_recipe_files(origpath, bpn, oldpv, newpv, path)
246 logger.debug('Upgraded %s => %s' % (origpath, fullpath))
247 247
248 newvalues = {} 248 newvalues = {}
249 if _recipe_contains(rd, 'PV') and newpv != oldpv: 249 if _recipe_contains(rd, 'PV') and newpv != oldpv: