From 67a181d8fc5b5acca7b0e41a4fa722e8df075312 Mon Sep 17 00:00:00 2001 From: "Adam D. Barratt" Date: Fri, 18 Jan 2013 18:52:07 +0000 Subject: [PATCH] Merge excuses "unblock" parsing for unstable and *pu The primary difference between the parsing / output of excuses for *pu and unstable unblocks is the messages displayed. We can therefore remove some duplication by having the same code handle both, outputting the appropriate message. Where a *pu package is also the subject of a "block" (most likely during a freeze) we only supply the "needs approval" or "approved" message; previously both "needs approval" and "not touching due to block" were output, which is redundant. We ensure that there is always a dummy "block" hint for *pu packages to provide the "needs approval" behaviour. Signed-off-by: Adam D. Barratt --- britney.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/britney.py b/britney.py index 4353992..ab87016 100755 --- a/britney.py +++ b/britney.py @@ -1305,6 +1305,8 @@ class Britney(object): blocked['block-udeb'] = hint for hint in self.hints.search(type='block-all', package='source'): blocked.setdefault('block', hint) + if suite in ['pu', 'tpu']: + blocked['block'] = '%s-block' % (suite) # if the source is blocked, then look for an `unblock' hint; the unblock request # is processed only if the specified version is correct. If a package is blocked @@ -1314,14 +1316,20 @@ class Britney(object): unblocks = self.hints.search(unblock_cmd, package=src) if unblocks and self.same_source(unblocks[0].version, source_u[VERSION]): - excuse.addhtml("Ignoring %s request by %s, due to %s request by %s" % - (block_cmd, blocked[block_cmd].user, unblock_cmd, unblocks[0].user)) + if suite == 'unstable' or block_cmd == 'block-udeb': + excuse.addhtml("Ignoring %s request by %s, due to %s request by %s" % + (block_cmd, blocked[block_cmd].user, unblock_cmd, unblocks[0].user)) + else: + excuse.addhtml("Approved by %s" % (unblocks[0].user)) else: if unblocks: excuse.addhtml("%s request by %s ignored due to version mismatch: %s" % (unblock_cmd.capitalize(), unblocks[0].user, unblocks[0].version)) - excuse.addhtml("Not touching package due to %s request by %s (contact debian-release if update is needed)" % - (block_cmd, blocked[block_cmd].user)) + if suite == 'unstable' or block_cmd == 'block-udeb': + excuse.addhtml("Not touching package due to %s request by %s (contact debian-release if update is needed)" % + (block_cmd, blocked[block_cmd].user)) + else: + excuse.addhtml("NEEDS APPROVAL BY RM") update_candidate = False # if the suite is unstable, then we have to check the urgency and the minimum days of @@ -1476,15 +1484,6 @@ class Britney(object): excuse.addhtml("Should ignore, but forced by %s" % (forces[0].user)) update_candidate = True - # if the suite is *-proposed-updates, the package needs an explicit approval in order to go in - if suite in ['tpu', 'pu']: - approves = [ x for x in self.hints.search('unblock', package=src) if self.same_source(source_u[VERSION], x.version) ] - if approves: - excuse.addhtml("Approved by %s" % approves[0].user) - else: - excuse.addhtml("NEEDS APPROVAL BY RM") - update_candidate = False - # if the package can be updated, it is a valid candidate if update_candidate: excuse.is_valid = True