diff options
author | Andrew McRae <amcrae@google.com> | 2022-11-15 17:18:22 +1100 |
---|---|---|
committer | Chromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2022-11-16 00:11:01 +0000 |
commit | 0069615e6ae4edfa37340af158e10da01e4e0c97 (patch) | |
tree | 61e61eb5f4ee71b596b964c846992a28b32e5fdd | |
parent | 3544fe4470dab4c759c48215ce1fddee241cd08e (diff) | |
download | chrome-ec-0069615e6ae4edfa37340af158e10da01e4e0c97.tar.gz |
update_release_branch: Fix commit message and Zephyr OWNERS
Allow the relevant commits portion of the commit message to be
optional (not used for the zephyr main/cmsis repos).
Also prune any top level Zephyr OWNERS file changes to
avoid conflicts with expected modified branch OWNERS file.
BUG=b:257145337
TEST=Run for nissa firmware branch
BRANCH=none
Signed-off-by: Andrew McRae <amcrae@google.com>
Change-Id: Ic38ff025d7d57a8f2439d535bebd55a5be12935c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4022998
Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rwxr-xr-x | util/update_release_branch.py | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/util/update_release_branch.py b/util/update_release_branch.py index 591c833ea1..939d572dc4 100755 --- a/util/update_release_branch.py +++ b/util/update_release_branch.py @@ -42,11 +42,11 @@ def git_commit_msg(cros_main, branch, head, merge_head, rel_paths, cmd): A String containing the git commit message with the exception of the Signed-Off-By field and Change-ID field. """ - relevant_commits_cmd, relevant_commits = get_relevant_commits( + relevant_commits_cmd, relevant_commits, relevant_hdr = get_relevant_commits( head, merge_head, "--oneline", rel_paths ) - _, relevant_bugs = get_relevant_commits(head, merge_head, "", rel_paths) + _, relevant_bugs, _ = get_relevant_commits(head, merge_head, "", rel_paths) relevant_bugs = set(re.findall("BUG=(.*)", relevant_bugs)) # Filter out "none" from set of bugs filtered = [] @@ -65,7 +65,7 @@ Merge remote-tracking branch {CROS_MAIN} into {BRANCH} Generated by: {COMMAND_LINE} -Relevant changes: +{RELEVANT_COMMITS_HEADER} {RELEVANT_COMMITS_CMD} @@ -93,6 +93,7 @@ Force-Relevant-Builds: all BRANCH=branch, RELEVANT_COMMITS_CMD=relevant_commits_cmd, RELEVANT_COMMITS=relevant_commits, + RELEVANT_COMMITS_HEADER=relevant_hdr, BUG_FIELD=bug_field, COMMAND_LINE=cmd, ) @@ -135,10 +136,10 @@ def get_relevant_commits(head, merge_head, fmt, relevant_paths): Returns: A tuple containing the arguments passed to the git log command and - stdout. + stdout, and the header for the message """ if not relevant_paths: - return "", "" + return "", "", "" if fmt: cmd = [ "git", @@ -158,7 +159,7 @@ def get_relevant_commits(head, merge_head, fmt, relevant_paths): proc = subprocess.run( cmd, stdout=subprocess.PIPE, encoding="utf-8", check=True, shell=True ) - return "".join(proc.args), proc.stdout + return "".join(proc.args), proc.stdout, "Relevant changes:" def merge_repo( @@ -208,7 +209,7 @@ def merge_repo( print('Merge command: "%s"' % " ".join(cmd_merge)) try: subprocess.run(cmd_merge, check=True) - except: + except subprocess.CalledProcessError: # We've likely encountered a merge conflict due to new OWNERS file # modifications. If we're removing the owners, we'll delete them. if prunelist: @@ -480,13 +481,18 @@ def main(argv): opts.release_branch, opts.remote_prefix + "/" + opts.release_branch, ] + prunelist = [] + if opts.remove_owners: + # Remove the top level OWNERS file from the list + # to avoid any conflict with the modified branch file. + prunelist.append("OWNERS") merge_repo( os.path.join(opts.srcbase, "src/third_party/zephyr/main"), cros_main, cmd_checkout, strategy, cmd, - [], + prunelist, [], ) # cmsis repo has different remote @@ -497,7 +503,7 @@ def main(argv): cmd_checkout, strategy, cmd, - [], + prunelist, [], ) print( |