summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/upgrade.py
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/devtool/upgrade.py')
-rw-r--r--scripts/lib/devtool/upgrade.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index f6141bfdc3..445e064246 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -498,6 +498,26 @@ def upgrade(args, config, basepath, workspace):
498 tinfoil.shutdown() 498 tinfoil.shutdown()
499 return 0 499 return 0
500 500
501def latest_version(args, config, basepath, workspace):
502 """Entry point for the devtool 'latest_version' subcommand"""
503 tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
504 try:
505 rd = parse_recipe(config, tinfoil, args.recipename, True)
506 if not rd:
507 return 1
508 version_info = oe.recipeutils.get_recipe_upstream_version(rd)
509 # "new-commits-available" is an indication that upstream never issues version tags
510 if not version_info['version'].endswith("new-commits-available"):
511 logger.info("Current version: {}".format(version_info['current_version']))
512 logger.info("Latest version: {}".format(version_info['version']))
513 if version_info['revision']:
514 logger.info("Latest version's commit: {}".format(version_info['revision']))
515 else:
516 logger.info("Latest commit: {}".format(version_info['revision']))
517 finally:
518 tinfoil.shutdown()
519 return 0
520
501def register_commands(subparsers, context): 521def register_commands(subparsers, context):
502 """Register devtool subcommands from this plugin""" 522 """Register devtool subcommands from this plugin"""
503 523
@@ -519,3 +539,9 @@ def register_commands(subparsers, context):
519 group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true") 539 group.add_argument('--no-same-dir', help='Force build in a separate build directory', action="store_true")
520 parser_upgrade.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)') 540 parser_upgrade.add_argument('--keep-temp', action="store_true", help='Keep temporary directory (for debugging)')
521 parser_upgrade.set_defaults(func=upgrade, fixed_setup=context.fixed_setup) 541 parser_upgrade.set_defaults(func=upgrade, fixed_setup=context.fixed_setup)
542
543 parser_latest_version = subparsers.add_parser('latest-version', help='Report the latest version of an existing recipe',
544 description='Queries the upstream server for what the latest upstream release is (for git, tags are checked, for tarballs, a list of them is obtained, and one with the highest version number is reported)',
545 group='info')
546 parser_latest_version.add_argument('recipename', help='Name of recipe to query (just name - no version, path or extension)')
547 parser_latest_version.set_defaults(func=latest_version)