summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
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: