diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-02-22 11:54:40 +1300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-02-28 11:33:00 +0000 |
commit | 492b1eb1d2457bea2fd8fdd8fb5ef4e69a3af790 (patch) | |
tree | 1682e7662bf9d599d27a9f831ae0d41fcd7345ad /scripts/lib/devtool/upgrade.py | |
parent | 942ae25279bea1b9768112e33f459a9b191d18bd (diff) | |
download | poky-492b1eb1d2457bea2fd8fdd8fb5ef4e69a3af790.tar.gz |
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>
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index 0e53c8286e..a446c557bc 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
@@ -313,36 +313,44 @@ def upgrade(args, config, basepath, workspace): | |||
313 | if pn in workspace: | 313 | if pn in workspace: |
314 | raise DevtoolError("recipe %s is already in your workspace" % pn) | 314 | raise DevtoolError("recipe %s is already in your workspace" % pn) |
315 | 315 | ||
316 | if args.srctree: | ||
317 | srctree = os.path.abspath(args.srctree) | ||
318 | else: | ||
319 | srctree = standard.get_default_srctree(config, pn) | ||
320 | |||
316 | standard._check_compatible_recipe(pn, rd) | 321 | standard._check_compatible_recipe(pn, rd) |
317 | if rd.getVar('PV', True) == args.version and rd.getVar('SRCREV', True) == args.srcrev: | 322 | if rd.getVar('PV', True) == args.version and rd.getVar('SRCREV', True) == args.srcrev: |
318 | raise DevtoolError("Current and upgrade versions are the same version" % version) | 323 | raise DevtoolError("Current and upgrade versions are the same version" % version) |
319 | 324 | ||
320 | rf = None | 325 | rf = None |
321 | try: | 326 | try: |
322 | rev1 = standard._extract_source(args.srctree, False, 'devtool-orig', False, rd) | 327 | rev1 = standard._extract_source(srctree, False, 'devtool-orig', False, rd) |
323 | rev2, md5, sha256 = _extract_new_source(args.version, args.srctree, args.no_patch, | 328 | rev2, md5, sha256 = _extract_new_source(args.version, srctree, args.no_patch, |
324 | args.srcrev, args.branch, args.keep_temp, | 329 | args.srcrev, args.branch, args.keep_temp, |
325 | tinfoil, rd) | 330 | tinfoil, rd) |
326 | rf = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd) | 331 | rf = _create_new_recipe(args.version, md5, sha256, args.srcrev, args.srcbranch, config.workspace_path, tinfoil, rd) |
327 | except bb.process.CmdError as e: | 332 | except bb.process.CmdError as e: |
328 | _upgrade_error(e, rf, args.srctree) | 333 | _upgrade_error(e, rf, srctree) |
329 | except DevtoolError as e: | 334 | except DevtoolError as e: |
330 | _upgrade_error(e, rf, args.srctree) | 335 | _upgrade_error(e, rf, srctree) |
331 | standard._add_md5(config, pn, os.path.dirname(rf)) | 336 | standard._add_md5(config, pn, os.path.dirname(rf)) |
332 | 337 | ||
333 | af = _write_append(rf, args.srctree, args.same_dir, args.no_same_dir, rev2, | 338 | af = _write_append(rf, srctree, args.same_dir, args.no_same_dir, rev2, |
334 | config.workspace_path, rd) | 339 | config.workspace_path, rd) |
335 | standard._add_md5(config, pn, af) | 340 | standard._add_md5(config, pn, af) |
336 | logger.info('Upgraded source extracted to %s' % args.srctree) | 341 | logger.info('Upgraded source extracted to %s' % srctree) |
337 | return 0 | 342 | return 0 |
338 | 343 | ||
339 | def register_commands(subparsers, context): | 344 | def register_commands(subparsers, context): |
340 | """Register devtool subcommands from this plugin""" | 345 | """Register devtool subcommands from this plugin""" |
346 | |||
347 | defsrctree = standard.get_default_srctree(context.config) | ||
348 | |||
341 | parser_upgrade = subparsers.add_parser('upgrade', help='Upgrade an existing recipe', | 349 | parser_upgrade = subparsers.add_parser('upgrade', help='Upgrade an existing recipe', |
342 | 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).', | 350 | 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).', |
343 | group='starting') | 351 | group='starting') |
344 | parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') | 352 | parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') |
345 | parser_upgrade.add_argument('srctree', help='Path to where to extract the source tree') | 353 | 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) |
346 | parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)') | 354 | parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)') |
347 | parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (if fetching from an SCM such as git)') | 355 | parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (if fetching from an SCM such as git)') |
348 | parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)') | 356 | parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)') |