mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
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>
This commit is contained in:
parent
7af3295b0b
commit
10a5af5eb4
|
@ -365,6 +365,7 @@ def copy_recipe_files(d, tgt_dir, whole_dir=False, download=True):
|
|||
# Copy local files to target directory and gather any remote files
|
||||
bb_dir = os.path.dirname(d.getVar('FILE', True)) + os.sep
|
||||
remotes = []
|
||||
copied = []
|
||||
includes = [path for path in d.getVar('BBINCLUDED', True).split() if
|
||||
path.startswith(bb_dir) and os.path.exists(path)]
|
||||
for path in fetch.localpaths() + includes:
|
||||
|
@ -376,13 +377,14 @@ def copy_recipe_files(d, tgt_dir, whole_dir=False, download=True):
|
|||
if not os.path.exists(subdir):
|
||||
os.makedirs(subdir)
|
||||
shutil.copy2(path, os.path.join(tgt_dir, relpath))
|
||||
copied.append(relpath)
|
||||
else:
|
||||
remotes.append(path)
|
||||
# Simply copy whole meta dir, if requested
|
||||
if whole_dir:
|
||||
shutil.copytree(bb_dir, tgt_dir)
|
||||
|
||||
return remotes
|
||||
return copied, remotes
|
||||
|
||||
|
||||
def get_recipe_local_files(d, patches=False):
|
||||
|
|
|
@ -105,7 +105,7 @@ def _rename_recipe_files(oldrecipe, bpn, oldpv, newpv, path):
|
|||
_rename_recipe_dirs(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):
|
||||
def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d):
|
||||
"""Writes an append file"""
|
||||
if not os.path.exists(rc):
|
||||
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):
|
|||
b_is_s = use_external_build(same_dir, no_same_dir, d)
|
||||
if b_is_s:
|
||||
f.write('EXTERNALSRC_BUILD_pn-%s = "%s"\n' % (pn, srctree))
|
||||
f.write('\n')
|
||||
if rev:
|
||||
f.write('\n# initial_rev: %s\n' % rev)
|
||||
f.write('# initial_rev: %s\n' % rev)
|
||||
if copied:
|
||||
f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE', True)))
|
||||
f.write('# original_files: %s\n' % ' '.join(copied))
|
||||
return af
|
||||
|
||||
def _cleanup_on_error(rf, srctree):
|
||||
|
@ -267,7 +271,7 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
|
|||
bpn = rd.getVar('BPN', True)
|
||||
path = os.path.join(workspace, 'recipes', bpn)
|
||||
bb.utils.mkdirhier(path)
|
||||
oe.recipeutils.copy_recipe_files(rd, path)
|
||||
copied, _ = oe.recipeutils.copy_recipe_files(rd, path)
|
||||
|
||||
oldpv = rd.getVar('PV', True)
|
||||
if not newpv:
|
||||
|
@ -317,7 +321,7 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
|
|||
rd = oe.recipeutils.parse_recipe(fullpath, None, tinfoil.config_data)
|
||||
oe.recipeutils.patch_recipe(rd, fullpath, newvalues)
|
||||
|
||||
return fullpath
|
||||
return fullpath, copied
|
||||
|
||||
def upgrade(args, config, basepath, workspace):
|
||||
"""Entry point for the devtool 'upgrade' subcommand"""
|
||||
|
@ -360,7 +364,7 @@ def upgrade(args, config, basepath, workspace):
|
|||
rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch,
|
||||
args.srcrev, args.branch, args.keep_temp,
|
||||
tinfoil, rd)
|
||||
rf = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd)
|
||||
rf, copied = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd)
|
||||
except bb.process.CmdError as e:
|
||||
_upgrade_error(e, rf, srctree)
|
||||
except DevtoolError as e:
|
||||
|
@ -368,7 +372,7 @@ def upgrade(args, config, basepath, workspace):
|
|||
standard._add_md5(config, pn, os.path.dirname(rf))
|
||||
|
||||
af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2,
|
||||
config.workspace_path, rd)
|
||||
copied, config.workspace_path, rd)
|
||||
standard._add_md5(config, pn, af)
|
||||
logger.info('Upgraded source extracted to %s' % srctree)
|
||||
logger.info('New recipe is %s' % rf)
|
||||
|
|
Loading…
Reference in New Issue
Block a user