summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-07-14 09:04:24 +1200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-20 10:28:49 +0100
commit10a5af5eb4f928abe1fe12e63520f656b682d55d (patch)
treead1a9258b7b67cf56c6afda20314e3bafdd1f3f5 /scripts/lib/devtool/upgrade.py
parent7af3295b0b2eb65e8f541f358c3091918db65ab9 (diff)
downloadpoky-10a5af5eb4f928abe1fe12e63520f656b682d55d.tar.gz
devtool: upgrade: record original recipe files
This provides us with the information we need to remove the original version recipe and associated files when running "devtool finish" after "devtool upgrade". (From OE-Core rev: 92eb42c347af919cd9f8739515fdf806c12b5ba8) 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.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 66e5f59a01..8ea72ef2b5 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -105,7 +105,7 @@ def _rename_recipe_files(oldrecipe, bpn, oldpv, newpv, path):
105 _rename_recipe_dirs(oldpv, newpv, path) 105 _rename_recipe_dirs(oldpv, newpv, path)
106 return _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path) 106 return _rename_recipe_file(oldrecipe, bpn, oldpv, newpv, path)
107 107
108def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d): 108def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d):
109 """Writes an append file""" 109 """Writes an append file"""
110 if not os.path.exists(rc): 110 if not os.path.exists(rc):
111 raise DevtoolError("bbappend not created because %s does not exist" % rc) 111 raise DevtoolError("bbappend not created because %s does not exist" % rc)
@@ -128,8 +128,12 @@ def _write_append(rc, srctree, same_dir, no_same_dir, rev, workspace, d):
128 b_is_s = use_external_build(same_dir, no_same_dir, d) 128 b_is_s = use_external_build(same_dir, no_same_dir, d)
129 if b_is_s: 129 if b_is_s:
130 f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree)) 130 f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree))
131 f.write('\n')
131 if rev: 132 if rev:
132 f.write('\n# initial_rev: %s\n' % rev) 133 f.write('# initial_rev: %s\n' % rev)
134 if copied:
135 f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE', True)))
136 f.write('# original_files: %s\n' % ' '.join(copied))
133 return af 137 return af
134 138
135def _cleanup_on_error(rf, srctree): 139def _cleanup_on_error(rf, srctree):
@@ -267,7 +271,7 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
267 bpn = rd.getVar('BPN', True) 271 bpn = rd.getVar('BPN', True)
268 path = os.path.join(workspace, 'recipes', bpn) 272 path = os.path.join(workspace, 'recipes', bpn)
269 bb.utils.mkdirhier(path) 273 bb.utils.mkdirhier(path)
270 oe.recipeutils.copy_recipe_files(rd, path) 274 copied, _ = oe.recipeutils.copy_recipe_files(rd, path)
271 275
272 oldpv = rd.getVar('PV', True) 276 oldpv = rd.getVar('PV', True)
273 if not newpv: 277 if not newpv:
@@ -317,7 +321,7 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
317 rd = oe.recipeutils.parse_recipe(fullpath, None, tinfoil.config_data) 321 rd = oe.recipeutils.parse_recipe(fullpath, None, tinfoil.config_data)
318 oe.recipeutils.patch_recipe(rd, fullpath, newvalues) 322 oe.recipeutils.patch_recipe(rd, fullpath, newvalues)
319 323
320 return fullpath 324 return fullpath, copied
321 325
322def upgrade(args, config, basepath, workspace): 326def upgrade(args, config, basepath, workspace):
323 """Entry point for the devtool 'upgrade' subcommand""" 327 """Entry point for the devtool 'upgrade' subcommand"""
@@ -360,7 +364,7 @@ def upgrade(args, config, basepath, workspace):
360 rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch, 364 rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch,
361 args.srcrev, args.branch, args.keep_temp, 365 args.srcrev, args.branch, args.keep_temp,
362 tinfoil, rd) 366 tinfoil, rd)
363 rf = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd) 367 rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd)
364 except bb.process.CmdError as e: 368 except bb.process.CmdError as e:
365 _upgrade_error(e, rf, srctree) 369 _upgrade_error(e, rf, srctree)
366 except DevtoolError as e: 370 except DevtoolError as e:
@@ -368,7 +372,7 @@ def upgrade(args, config, basepath, workspace):
368 standard._add_md5(config, pn, os.path.dirname(rf)) 372 standard._add_md5(config, pn, os.path.dirname(rf))
369 373
370 af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, 374 af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2,
371 config.workspace_path, rd) 375 copied, config.workspace_path, rd)
372 standard._add_md5(config, pn, af) 376 standard._add_md5(config, pn, af)
373 logger.info('Upgraded source extracted to %s' % srctree) 377 logger.info('Upgraded source extracted to %s' % srctree)
374 logger.info('New recipe is %s' % rf) 378 logger.info('New recipe is %s' % rf)