summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Smith <daniel.smith@qt.io>2022-03-07 12:29:22 +0100
committerDaniel Smith <Daniel.Smith@qt.io>2022-03-30 12:08:27 +0000
commite3205793dc15bcc09a49f8080470169c6246a9c5 (patch)
tree867497e22587ea5a232f36533db51275b0efca0c
parentd192c1e50674ec244e1c2edbbcf41479d91c30b9 (diff)
downloadqtrepotools-e3205793dc15bcc09a49f8080470169c6246a9c5.tar.gz
Have the Submodule Update Utility catch manually merged updates
If a change is manually merged after the utility has marked it as failed, the utility should pick up on this so the round can continue automatically without further user action. This change also updates calls to any() to directly pass an iterator rather than computing a value set through list comprehension. Change-Id: I18a5511de30e92e4276ef596c8ae2011f297dd63 Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
-rw-r--r--util/dependency_updater/main.py10
-rw-r--r--util/dependency_updater/tools/toolbox.py10
2 files changed, 14 insertions, 6 deletions
diff --git a/util/dependency_updater/main.py b/util/dependency_updater/main.py
index eaefd60..26f976a 100644
--- a/util/dependency_updater/main.py
+++ b/util/dependency_updater/main.py
@@ -322,11 +322,15 @@ def main():
# Determine how to exit
clear_state = False
- if not any([r.progress for r in config.state_data.values() if
- r.progress < Repo.PROGRESS.DONE.value]):
+ if not any(r.progress < Repo.PROGRESS.DONE for r in config.state_data.values()):
if config.args.simulate:
print("INFO: Done with this round, but not clearing state because --sim was used.")
- elif config.args.pause_on_finish_fail and not config.state_data.get("pause_on_finish_fail"):
+ elif (config.args.pause_on_finish_fail # The args say to pause on failure
+ and not config.state_data.get("pause_on_finish_fail") # And not already paused
+ # And are there any real failures that should cause us to pause.
+ and any(r.progress == Repo.PROGRESS.DONE_FAILED_BLOCKING for r in
+ config.state_data.values())):
+ # Set the flag and report the error.
print(
"Done with this round: Running in Pause On Finish Fail mode. Not resetting state.")
config.state_data["pause_on_finish_fail"] = Repo.Repo(id="pause_on_finish_fail",
diff --git a/util/dependency_updater/tools/toolbox.py b/util/dependency_updater/tools/toolbox.py
index 10c45bf..9b3a15c 100644
--- a/util/dependency_updater/tools/toolbox.py
+++ b/util/dependency_updater/tools/toolbox.py
@@ -560,7 +560,7 @@ def get_check_progress(config: Config, repo: Repo) -> (PROGRESS, str, str):
"""Determine the progress status of a submodule update
:returns: progress: PROGRESS, merged_ref: str, gerrit_change_status: str[NEW, MERGED, STAGED, INTEGRATING, ABANDONED]"""
- if repo.progress >= PROGRESS.DONE:
+ if repo.progress in [PROGRESS.DONE, PROGRESS.DONE_NO_UPDATE, PROGRESS.IGNORE_IS_META]:
return repo.progress, repo.proposal.merged_ref, "MERGED"
elif repo.proposal.proposed_yaml and not repo.proposal.change_id:
if repo.proposal.inconsistent_set:
@@ -568,6 +568,9 @@ def get_check_progress(config: Config, repo: Repo) -> (PROGRESS, str, str):
else:
return PROGRESS.READY, "", ""
elif repo.proposal.change_id:
+ # This condition also catches DONE_FAILED_BLOCKING and DONE_FAILED_NON_BLOCKING
+ # So that if a change was manually merged without the bot's help,
+ # it gets picked up and marked as merged.
change = config.datasources.gerrit_client.changes.get(repo.proposal.change_id)
remote_status = change.status
if remote_status == "NEW" and repo.progress == PROGRESS.IN_PROGRESS and repo.stage_count > 0:
@@ -809,8 +812,9 @@ def push_submodule_update(config: Config, repo: Repo, retry: bool = False) -> Pr
def do_try_supermodule_updates(config: Config) -> dict[str, Repo]:
"""Push supermodule updates if needed"""
blocking_repos = [r for r in config.state_data.values() if not r.is_non_blocking]
- if not any([r for r in blocking_repos if r.id not in ["qt/qt5", "yocto/meta-qt6"]
- and (r.progress < PROGRESS.DONE or r.progress == PROGRESS.DONE_FAILED_BLOCKING)]):
+ if not any((r.progress < PROGRESS.DONE or r.progress == PROGRESS.DONE_FAILED_BLOCKING)
+ and r.id not in ["qt/qt5", "yocto/meta-qt6"]
+ for r in blocking_repos):
if config.args.update_supermodule:
supermodule = push_supermodule_update(config)
config.state_data[supermodule.id] = supermodule