diff --git a/britney.py b/britney.py index a8b4e31..bc0120f 100755 --- a/britney.py +++ b/britney.py @@ -1358,7 +1358,7 @@ class Britney(object): else: excuse.addhtml("NEEDS APPROVAL BY RM") excuse.addreason("block") - excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY + excuse.policy_verdict = PolicyVerdict.REJECTED_NEEDS_APPROVAL # at this point, we check the status of the builds on all the supported architectures # to catch the out-of-date ones @@ -1436,7 +1436,7 @@ class Britney(object): else: excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY else: - excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY + excuse.policy_verdict = PolicyVerdict.REJECTED_CANNOT_DETERMINE_IF_PERMANENT excuse.missing_build_on_arch(arch) excuse.addhtml(text) @@ -1489,7 +1489,7 @@ class Britney(object): text = text + " (but %s isn't keeping up, so never mind)" % (arch) excuse.missing_build_on_ood_arch(arch) else: - excuse.policy_verdict = PolicyVerdict.REJECTED_PERMANENTLY + excuse.policy_verdict = PolicyVerdict.REJECTED_CANNOT_DETERMINE_IF_PERMANENT excuse.missing_build_on_arch(arch) excuse.addhtml(text) diff --git a/britney2/excuse.py b/britney2/excuse.py index e854277..5e9398b 100644 --- a/britney2/excuse.py +++ b/britney2/excuse.py @@ -19,6 +19,26 @@ import re from britney2.policies.policy import PolicyVerdict +VERDICT2DESC = { + PolicyVerdict.PASS: + 'OK: Will attempt migration (Any information below is purely informational)', + PolicyVerdict.PASS_HINTED: + 'OK: Will attempt migration due to a hint (Any information below is purely informational)', + PolicyVerdict.REJECTED_TEMPORARILY: + 'WAITING: Waiting for test results, another package or too young (no action required now - check later)', + PolicyVerdict.REJECTED_WAITING_FOR_ANOTHER_ITEM: + 'WAITING: Waiting for another item to be ready to migrate (no action required now - check later)', + PolicyVerdict.REJECTED_BLOCKED_BY_ANOTHER_ITEM: + 'BLOCKED: Cannot migrate due to another item, which is blocked (please check which dependencies are stuck)', + PolicyVerdict.REJECTED_NEEDS_APPROVAL: + 'BLOCKED: Needs an approval (either due to a freeze or due to the source suite)', + PolicyVerdict.REJECTED_CANNOT_DETERMINE_IF_PERMANENT: + 'BLOCKED: Maybe temporary, maybe blocked but Britney is missing information (check below or the buildds)', + PolicyVerdict.REJECTED_PERMANENTLY: + 'BLOCKED: Rejected/introduces a regression (please see below)' +} + + class Excuse(object): """Excuse class @@ -154,16 +174,9 @@ class Excuse(object): def _format_verdict_summary(self): verdict = self._policy_verdict - if not verdict.is_rejected: - msg = 'OK: Will attempt migration' - if verdict == PolicyVerdict.PASS_HINTED: - msg = 'OK: Will attempt migration due to a hint' - msg += " (Any information below is purely informational)" - return msg - if verdict == PolicyVerdict.REJECTED_PERMANENTLY: - msg = "BLOCKED: Will not migrate (Please review if it introduces a regression or needs approval/unblock)" - return msg - return "TEMP-BLOCKED: Waiting for test results, another package or too young (no action required at this time)" + if verdict in VERDICT2DESC: + return VERDICT2DESC[verdict] + return "UNKNOWN: Missing description for {0} - Please file a bug against Britney".format(verdict.name) def html(self): """Render the excuse in HTML""" diff --git a/britney2/policies/policy.py b/britney2/policies/policy.py index d5ad271..6e2c6e1 100644 --- a/britney2/policies/policy.py +++ b/britney2/policies/policy.py @@ -27,15 +27,41 @@ class PolicyVerdict(Enum): """ REJECTED_TEMPORARILY = 3 """ + The migration item is temporarily unable to migrate due to another item. The other item is temporarily blocked. + """ + REJECTED_WAITING_FOR_ANOTHER_ITEM = 4 + """ + The migration item is permanently unable to migrate due to another item. The other item is permanently blocked. + """ + REJECTED_BLOCKED_BY_ANOTHER_ITEM = 5 + """ + The migration item needs approval to migrate + """ + REJECTED_NEEDS_APPROVAL = 6 + """ + The migration item is blocked, but there is not enough information to determine + if this issue is permanent or temporary + """ + REJECTED_CANNOT_DETERMINE_IF_PERMANENT = 7 + """ The migration item did not pass the policy and the failure is believed to be uncorrectable (i.e. a hint or a new version is needed) """ - REJECTED_PERMANENTLY = 4 + REJECTED_PERMANENTLY = 8 @property def is_rejected(self): return True if self.name.startswith('REJECTED') else False + def is_blocked(self): + """Whether the item (probably) needs a fix or manual assistance to migrate""" + return self in { + PolicyVerdict.REJECTED_BLOCKED_BY_ANOTHER_ITEM, + PolicyVerdict.REJECTED_NEEDS_APPROVAL, + PolicyVerdict.REJECTED_CANNOT_DETERMINE_IF_PERMANENT, # Assuming the worst + PolicyVerdict.REJECTED_PERMANENTLY, + } + class BasePolicy(object): diff --git a/britney2/utils.py b/britney2/utils.py index b518dd9..99f83e9 100644 --- a/britney2/utils.py +++ b/britney2/utils.py @@ -801,6 +801,11 @@ def invalidate_excuses(excuses, valid, invalid): # if the dependency can be satisfied by a testing-proposed-updates excuse, skip the item if (ename + "_tpu") in valid: continue + + rdep_verdict = PolicyVerdict.REJECTED_WAITING_FOR_ANOTHER_ITEM + if excuses[ename].policy_verdict.is_blocked: + rdep_verdict = PolicyVerdict.REJECTED_BLOCKED_BY_ANOTHER_ITEM + # loop on the reverse dependencies for x in revdeps[ename]: if x in valid: @@ -815,8 +820,8 @@ def invalidate_excuses(excuses, valid, invalid): invalid.append(valid.pop(p)) excuses[x].addhtml("Invalidated by dependency") excuses[x].addreason("depends") - if excuses[x].policy_verdict.value < PolicyVerdict.REJECTED_TEMPORARILY.value: - excuses[x].policy_verdict = PolicyVerdict.REJECTED_TEMPORARILY + if excuses[x].policy_verdict.value < rdep_verdict.value: + excuses[x].policy_verdict = rdep_verdict def compile_nuninst(binaries_t, inst_tester, architectures, nobreakall_arches):