mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 12:59:02 +02:00
devtool: upgrade: make source tree path optional
Make devtool upgrade consistent with devtool add/modify in defaulting to sources/<recipename> under the workspace if no source tree path is specified. (From OE-Core rev: 8a952407b192313515e91570632446b6dff01665) 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
942ae25279
commit
492b1eb1d2
|
@ -313,36 +313,44 @@ def upgrade(args, config, basepath, workspace):
|
|||
if pn in workspace:
|
||||
raise DevtoolError("recipe %s is already in your workspace" % pn)
|
||||
|
||||
if args.srctree:
|
||||
srctree = os.path.abspath(args.srctree)
|
||||
else:
|
||||
srctree = standard.get_default_srctree(config, pn)
|
||||
|
||||
standard._check_compatible_recipe(pn, rd)
|
||||
if rd.getVar('PV', True) == args.version and rd.getVar('SRCREV', True) == args.srcrev:
|
||||
raise DevtoolError("Current and upgrade versions are the same version" % version)
|
||||
|
||||
rf = None
|
||||
try:
|
||||
rev1 = standard._extract_source(args.srctree, False, 'devtool-orig', False, rd)
|
||||
rev2, md5, sha256 = _extract_new_source(args.version, args.srctree, args.no_patch,
|
||||
rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, rd)
|
||||
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)
|
||||
except bb.process.CmdError as e:
|
||||
_upgrade_error(e, rf, args.srctree)
|
||||
_upgrade_error(e, rf, srctree)
|
||||
except DevtoolError as e:
|
||||
_upgrade_error(e, rf, args.srctree)
|
||||
_upgrade_error(e, rf, srctree)
|
||||
standard._add_md5(config, pn, os.path.dirname(rf))
|
||||
|
||||
af = _write_append(rf, args.srctree, args.same_dir, args.no_same_dir, rev2,
|
||||
af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2,
|
||||
config.workspace_path, rd)
|
||||
standard._add_md5(config, pn, af)
|
||||
logger.info('Upgraded source extracted to %s' % args.srctree)
|
||||
logger.info('Upgraded source extracted to %s' % srctree)
|
||||
return 0
|
||||
|
||||
def register_commands(subparsers, context):
|
||||
"""Register devtool subcommands from this plugin"""
|
||||
|
||||
defsrctree = standard.get_default_srctree(context.config)
|
||||
|
||||
parser_upgrade = subparsers.add_parser('upgrade', help='Upgrade an existing recipe',
|
||||
description='Upgrades an existing recipe to a new upstream version. Puts the upgraded recipe file into the workspace along with any associated files, and extracts the source tree to a specified location (in case patches need rebasing or adding to as a result of the upgrade).',
|
||||
group='starting')
|
||||
parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)')
|
||||
parser_upgrade.add_argument('srctree', help='Path to where to extract the source tree')
|
||||
parser_upgrade.add_argument('srctree', nargs='?', help='Path to where to extract the source tree. If not specified, a subdirectory of %s will be used.' % defsrctree)
|
||||
parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)')
|
||||
parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (if fetching from an SCM such as git)')
|
||||
parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)')
|
||||
|
|
Loading…
Reference in New Issue
Block a user