diff options
author | Thomas Haller <thaller@redhat.com> | 2023-04-06 15:44:16 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2023-04-06 18:34:15 +0200 |
commit | efd23da26b296c45e27ce351c049b5a4ab008996 (patch) | |
tree | 9f58f809baa781b65463cee2141cbbcea9c532fb | |
parent | 24461954d0063f1017caa850b8aafe660c564d10 (diff) | |
download | NetworkManager-efd23da26b296c45e27ce351c049b5a4ab008996.tar.gz |
find-backports: enable debug logging in script
-rwxr-xr-x | contrib/scripts/find-backports | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/contrib/scripts/find-backports b/contrib/scripts/find-backports index ac1bac69bf..6d77baf9f4 100755 --- a/contrib/scripts/find-backports +++ b/contrib/scripts/find-backports @@ -9,7 +9,19 @@ import pprint FNULL = open(os.devnull, "w") -pp = pprint.PrettyPrinter(indent=4) +pp = pprint.PrettyPrinter(indent=4, stream=sys.stderr) + +DEBUG = os.environ.get("NM_FIND_BACKPORTS_DEBUG", None) == "1" + + +def dbg_log(s): + if DEBUG: + print(s, file=sys.stderr) + + +def dbg_pprint(obj): + if DEBUG: + pp.pprint(obj) def print_err(s): @@ -310,11 +322,11 @@ if __name__ == "__main__": if p: own_commits_cherry_picked_flat.update(p) - # print(">>> own_commits_cherry_picked") - # pp.pprint(own_commits_cherry_picked) + dbg_log(">>> own_commits_cherry_picked") + dbg_pprint(own_commits_cherry_picked) - # print(">>> cherry_picks_all") - # pp.pprint(cherry_picks_all) + dbg_log(">>> cherry_picks_all") + dbg_pprint(cherry_picks_all) # find all commits on the upstream branches that fix another commit. fixing_commits = {} @@ -322,21 +334,21 @@ if __name__ == "__main__": ref_str = ref_head + ".." + ref_upstream print_err('Check upstream patches "%s"...' % (ref_str)) for c, fixes in git_commits_annotate_fixes(ref_str).items(): - # print(">>> test %s ==> %s" % (c, fixes)) + dbg_log(">>> test %s ==> %s" % (c, fixes)) if not fixes: - # print(">>> test %s ==> SKIP" % (c)) + dbg_log(">>> test %s ==> SKIP" % (c)) continue if c in cherry_picks_all: # commit 'c' is already backported. Skip it. - # print(">>> in cherry_picks_all") + dbg_log(">>> in cherry_picks_all") continue for f in fixes: if f not in own_commits_cherry_picked_flat: # commit "c" fixes commit "f", but this is not one of our own commits # and not interesting. - # print(">>> fixes %s not in own_commits_cherry_picked" % (f)) + dbg_log(">>> fixes %s not in own_commits_cherry_picked" % (f)) continue - # print(">>> take %s (fixes %s)" % (c, fixes)) + dbg_log(">>> take %s (fixes %s)" % (c, fixes)) fixing_commits[c] = fixes break |