summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alexander.kanavin@linux.intel.com>2017-11-23 17:11:40 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-12-18 18:03:57 +0000
commit5b61268fcad88d89bf1f58a454464de225aac33b (patch)
tree8e8b07f6bb85f51fee357397c9741c9ec74c5b25
parent4a9dc28fb44ba12df8d0f9f1242d44cbc407d581 (diff)
downloadpoky-5b61268fcad88d89bf1f58a454464de225aac33b.tar.gz
devtool: add a 'latest-version' command
This command queries the upstream server for what the latest release is and prints the output; it is a much neater way to find out these things than fumbling with distrodata, 'bitbake -c checkpkg' and awkward to read csv output in a file. Examples: python3 (tarballs): NOTE: Current version: 3.5.3 NOTE: Latest version: 3.6.3 rpm (git): NOTE: Current version: 4.13.90 NOTE: Latest version: 4.14.0 NOTE: Latest version's commit: da3720f62e57648fb1dc2a632744d38866139971 puzzles (git without version tags): NOTE: Latest commit: ee8ea9b9785964694cb2b3ad77c3fb2460f49510 (From OE-Core rev: e8f5b5cc25ce7a9882f21473cefc47edcebf77d4) Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-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)