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:32:35 +0000 |
commit | 8a952407b192313515e91570632446b6dff01665 (patch) | |
tree | 41f507eaa9ae74147bb0ce91582f70bb99137d2b | |
parent | c51736df17da8e6e561dd5b7ce59cb08254da870 (diff) | |
download | openembedded-core-8a952407b192313515e91570632446b6dff01665.tar.gz openembedded-core-8a952407b192313515e91570632446b6dff01665.tar.bz2 openembedded-core-8a952407b192313515e91570632446b6dff01665.zip |
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.
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
-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): 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)') |