From 3deb6f14168b38470b59c7b73f06614b91aab645 Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Tue, 20 Aug 2019 15:52:15 +1200 Subject: [PATCH] rrs_upgrade_history: add stop commit option Add an option to stop at a particular commit (so we can then repeat a specific commit afterwards easily for debugging purposes). Signed-off-by: Paul Eggleton --- rrs/tools/rrs_upgrade_history.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rrs/tools/rrs_upgrade_history.py b/rrs/tools/rrs_upgrade_history.py index b154443..c65a220 100755 --- a/rrs/tools/rrs_upgrade_history.py +++ b/rrs/tools/rrs_upgrade_history.py @@ -175,6 +175,10 @@ def upgrade_history(options, logger): for commit in bitbake_commit_list: bitbake_map[commit] = '39780b1ccbd76579db0fc6fb9369c848a3bafa9d' + if options.stop_commit and (options.stop_commit not in [x.split()[0] for x in commit_list]): + logger.error('Stop commit %s is not in repository %s' % (options.stop_commit, repodir)) + sys.exit(1) + if initial: logger.debug("Adding initial upgrade history ....") @@ -192,6 +196,9 @@ def upgrade_history(options, logger): for item in commit_list: if item: ct, ctepoch = item.split() + if ct == options.stop_commit: + logger.debug('Stopping at requested commit %s' % ct) + break ctdate = datetime.fromtimestamp(int(ctepoch)) commitobj = repo.commit(ct) touches_recipe = False @@ -240,6 +247,10 @@ if __name__=="__main__": help="Specify a single commit to import (for debugging)", action="store", dest="commit", default='') + parser.add_option("--stop-commit", + help="Specify a commit to stop at (for debugging)", + action="store", dest="stop_commit", default='') + parser.add_option("-d", "--debug", help = "Enable debug output", action="store_const", const=logging.DEBUG, dest="loglevel", default=logging.INFO)