From ad81ff98f9597a18dc1d7ae102f4d85e4d23f3a2 Mon Sep 17 00:00:00 2001 From: Jimmy Berry Date: Thu, 11 May 2017 22:52:19 -0500 Subject: [PATCH] checkrepo: wait for accepts for all archs before final review accept. --- osclib/checkrepo.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/osclib/checkrepo.py b/osclib/checkrepo.py index 0d7b9e5d..a5108b7b 100644 --- a/osclib/checkrepo.py +++ b/osclib/checkrepo.py @@ -159,6 +159,8 @@ class CheckRepo(object): self._staging() self.readonly = readonly self.debug_enable = debug + self.accept_counts = {} + self.accepts = {} def debug(self, *args): if not self.debug_enable: @@ -220,6 +222,18 @@ class CheckRepo(object): if review_state == 'accepted' and newstate != 'accepted': print ' - Avoid change state %s -> %s (%s)' % (review_state, newstate, message) + if newstate == 'accepted': + messages = self.accepts.get(request_id, []) + messages.append(message) + self.accepts[request_id] = messages + + self.accept_counts[request_id] = self.accept_counts.get(request_id, 0) + 1 + if self.accept_counts[request_id] != len(self.target_archs()): + print('- Wait for successful reviews of all archs.') + return 200 + else: + message = '\n'.join(set(messages)) + code = 404 url = makeurl(self.apiurl, ('request', str(request_id)), query=query) if self.readonly: