diff options
| author | Alexander Kanavin <alexander.kanavin@linux.intel.com> | 2017-11-23 17:27:47 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-12-18 18:03:57 +0000 |
| commit | b52a9cf310aacca042760adc6cc581951886715f (patch) | |
| tree | 06bfe6fa710bf9023e527c62f5f32f1cde2d81ac /scripts/lib/devtool/upgrade.py | |
| parent | 5b61268fcad88d89bf1f58a454464de225aac33b (diff) | |
| download | poky-b52a9cf310aacca042760adc6cc581951886715f.tar.gz | |
devtool: provide useful defaults for version/commit when upgrading recipes
Specifically, 'devtool upgrade' will use the latest upstream release if available
or latest commit if upstream never makes releases.
(From OE-Core rev: 45b4242b105ad36e94ae15a96d588a58b917b8e8)
Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.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 | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index 445e064246..28fbdaee35 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
| @@ -433,8 +433,6 @@ def upgrade(args, config, basepath, workspace): | |||
| 433 | 433 | ||
| 434 | if args.recipename in workspace: | 434 | if args.recipename in workspace: |
| 435 | raise DevtoolError("recipe %s is already in your workspace" % args.recipename) | 435 | raise DevtoolError("recipe %s is already in your workspace" % args.recipename) |
| 436 | if not args.version and not args.srcrev: | ||
| 437 | raise DevtoolError("You must provide a version using the --version/-V option, or for recipes that fetch from an SCM such as git, the --srcrev/-S option") | ||
| 438 | if args.srcbranch and not args.srcrev: | 436 | if args.srcbranch and not args.srcrev: |
| 439 | raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename) | 437 | raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename) |
| 440 | 438 | ||
| @@ -457,6 +455,16 @@ def upgrade(args, config, basepath, workspace): | |||
| 457 | else: | 455 | else: |
| 458 | srctree = standard.get_default_srctree(config, pn) | 456 | srctree = standard.get_default_srctree(config, pn) |
| 459 | 457 | ||
| 458 | # try to automatically discover latest version and revision if not provided on command line | ||
| 459 | if not args.version and not args.srcrev: | ||
| 460 | version_info = oe.recipeutils.get_recipe_upstream_version(rd) | ||
| 461 | if version_info['version'] and not version_info['version'].endswith("new-commits-available"): | ||
| 462 | args.version = version_info['version'] | ||
| 463 | if version_info['revision']: | ||
| 464 | args.srcrev = version_info['revision'] | ||
| 465 | if not args.version and not args.srcrev: | ||
| 466 | raise DevtoolError("Automatic discovery of latest version/revision failed - you must provide a version using the --version/-V option, or for recipes that fetch from an SCM such as git, the --srcrev/-S option.") | ||
| 467 | |||
| 460 | standard._check_compatible_recipe(pn, rd) | 468 | standard._check_compatible_recipe(pn, rd) |
| 461 | old_srcrev = rd.getVar('SRCREV') | 469 | old_srcrev = rd.getVar('SRCREV') |
| 462 | if old_srcrev == 'INVALID': | 470 | if old_srcrev == 'INVALID': |
| @@ -528,8 +536,8 @@ def register_commands(subparsers, context): | |||
| 528 | group='starting') | 536 | group='starting') |
| 529 | parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') | 537 | parser_upgrade.add_argument('recipename', help='Name of recipe to upgrade (just name - no version, path or extension)') |
| 530 | 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) | 538 | 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) |
| 531 | parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV)') | 539 | parser_upgrade.add_argument('--version', '-V', help='Version to upgrade to (PV). If omitted, latest upstream version will be determined and used, if possible.') |
| 532 | parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (required if fetching from an SCM such as git)') | 540 | parser_upgrade.add_argument('--srcrev', '-S', help='Source revision to upgrade to (useful when fetching from an SCM such as git)') |
| 533 | parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)') | 541 | parser_upgrade.add_argument('--srcbranch', '-B', help='Branch in source repository containing the revision to use (if fetching from an SCM such as git)') |
| 534 | parser_upgrade.add_argument('--branch', '-b', default="devtool", help='Name for new development branch to checkout (default "%(default)s")') | 542 | parser_upgrade.add_argument('--branch', '-b', default="devtool", help='Name for new development branch to checkout (default "%(default)s")') |
| 535 | parser_upgrade.add_argument('--no-patch', action="store_true", help='Do not apply patches from the recipe to the new source code') | 543 | parser_upgrade.add_argument('--no-patch', action="store_true", help='Do not apply patches from the recipe to the new source code') |
