diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-24 08:40:10 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:32:35 +0000 |
commit | e144db3650b4a7c0a59066621905f34a5400303e (patch) | |
tree | 0ee296c0e5b8e2dafb2e65a9f7c476c7cbd099e8 /scripts/lib | |
parent | 60454a0ba154d6c777e0c2b05b887b4e4fcde986 (diff) | |
download | openembedded-core-e144db3650b4a7c0a59066621905f34a5400303e.tar.gz openembedded-core-e144db3650b4a7c0a59066621905f34a5400303e.tar.bz2 openembedded-core-e144db3650b4a7c0a59066621905f34a5400303e.zip |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'scripts/lib')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 22 |
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): if olddir != newdir: shutil.move(os.path.join(path, olddir), os.path.join(path, newdir)) -def _rename_recipe_file(bpn, oldpv, newpv, path): - oldrecipe = "%s_%s.bb" % (bpn, oldpv) - newrecipe = "%s_%s.bb" % (bpn, newpv) - if os.path.isfile(os.path.join(path, oldrecipe)): +def _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path): + oldrecipe = os.path.basename(oldrecipe) + if oldrecipe.endswith('_%s.bb' % oldpv): + newrecipe = '%s_%s.bb' % (bpn, newpv) if oldrecipe != newrecipe: - _run('mv %s %s' % (oldrecipe, newrecipe), cwd=path) + shutil.move(os.path.join(path, oldrecipe), os.path.join(path, newrecipe)) else: - recipe = "%s_git.bb" % bpn - if os.path.isfile(os.path.join(path, recipe)): - newrecipe = recipe + newrecipe = oldrecipe return os.path.join(path, newrecipe) -def _rename_recipe_files(bpn, oldpv, newpv, path): +def _rename_recipe_files(oldrecipe, bpn, oldpv, newpv, path): _rename_recipe_dirs(oldpv, newpv, path) - return _rename_recipe_file(bpn, oldpv, newpv, path) + return _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path) def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d): """Writes an append file""" @@ -243,7 +241,9 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil oldpv = crd.getVar('PV', True) if not newpv: newpv = oldpv - fullpath = _rename_recipe_files(bpn, oldpv, newpv, path) + origpath = rd.getVar('FILE', True) + fullpath = _rename_recipe_files(origpath, bpn, oldpv, newpv, path) + logger.debug('Upgraded %s => %s' % (origpath, fullpath)) newvalues = {} if _recipe_contains(rd, 'PV') and newpv != oldpv: |