From 2afa51b1080660bcb975e83d20cd2f045975ea4c Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 26 Mar 2018 14:53:29 +1300 Subject: [PATCH] rrs_upgrade_history: only look at commits that actually change recipes Since we're now executing a separate script per commit, we should try not to do that unless the commit actually touches recipe files in order to avoid wasting time. (Whilst it's possible that a change to a bbclass might alter what's in the recipe, we can ignore that since we are only concerned with actual upgrades which would always require some sort of change to the recipe or an include file, so we can safely skip commits that don't do that.) Signed-off-by: Paul Eggleton --- rrs/tools/rrs_upgrade_history.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rrs/tools/rrs_upgrade_history.py b/rrs/tools/rrs_upgrade_history.py index 2dbb07b..1c37bea 100755 --- a/rrs/tools/rrs_upgrade_history.py +++ b/rrs/tools/rrs_upgrade_history.py @@ -23,6 +23,8 @@ from common import common_setup, get_logger common_setup() from layerindex import utils +import git + utils.setup_django() import settings @@ -110,6 +112,9 @@ def upgrade_history(options, logger): since = options.since since_option = '--since="%s" origin/master' % since + repo = git.Repo(repodir) + assert repo.bare == False + commits = utils.runcmd("git log %s --format='%%H %%ct' --reverse" % since_option, repodir, logger=logger) @@ -136,6 +141,25 @@ def upgrade_history(options, logger): if item: ct, ctepoch = item.split() ctdate = datetime.fromtimestamp(int(ctepoch)) + commitobj = repo.commit(ct) + touches_recipe = False + for parent in commitobj.parents: + diff = parent.diff(commitobj) + for diffitem in diff: + if diffitem.a_path.endswith(('.bb', '.inc')) or diffitem.b_path.endswith(('.bb', '.inc')): + # We need to look at this commit + touches_recipe = True + break + if touches_recipe: + break + if not touches_recipe: + # No recipes changed in this commit + # NOTE: Whilst it's possible that a change to a class might alter what's + # in the recipe, we can ignore that since we are only concerned with actual + # upgrades which would always require some sort of change to the recipe + # or an include file, so we can safely skip commits that don't do that + logger.debug("Skipping commit %s" % ct) + continue logger.debug("Analysing commit %s ..." % ct) run_internal(maintplanbranch, ct, ctdate, options, logger, bitbake_map) if not options.dry_run: