mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-02-24 03:41:12 +00:00
policies: Use suite class instead of suite name
When determining whether a policy applies to a given item, use the suite class rather than the suite name. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
e7b5339eae
commit
54e5eb0e74
@ -1532,8 +1532,9 @@ class Britney(object):
|
||||
# the age-days hint, if specified for the package
|
||||
policy_verdict = excuse.policy_verdict
|
||||
policy_info = excuse.policy_info
|
||||
suite_class = source_suite.suite_class
|
||||
for policy in self.policies:
|
||||
if suite_name in policy.applicable_suites:
|
||||
if suite_class in policy.applicable_suites:
|
||||
v = policy.apply_policy(policy_info, suite_name, src, source_t, source_u, excuse)
|
||||
if v.value > policy_verdict.value:
|
||||
policy_verdict = v
|
||||
|
@ -30,13 +30,17 @@ from urllib.request import urlopen
|
||||
import apt_pkg
|
||||
|
||||
import britney2.hints
|
||||
|
||||
from britney2 import SuiteClass
|
||||
from britney2.policies.policy import BasePolicy, PolicyVerdict
|
||||
|
||||
|
||||
class Result(Enum):
|
||||
FAIL = 1
|
||||
PASS = 2
|
||||
NEUTRAL = 3
|
||||
|
||||
|
||||
EXCUSES_LABELS = {
|
||||
"PASS": '<span style="background:#87d96c">Pass</span>',
|
||||
"NEUTRAL": '<span style="background:#e5c545">No test results</span>',
|
||||
@ -50,6 +54,7 @@ EXCUSES_LABELS = {
|
||||
|
||||
REF_TRIG = 'migration-reference/0'
|
||||
|
||||
|
||||
def srchash(src):
|
||||
'''archive hash prefix for source package'''
|
||||
|
||||
@ -67,7 +72,7 @@ class AutopkgtestPolicy(BasePolicy):
|
||||
"""
|
||||
|
||||
def __init__(self, options, suite_info):
|
||||
super().__init__('autopkgtest', options, suite_info, {'unstable'})
|
||||
super().__init__('autopkgtest', options, suite_info, {SuiteClass.PRIMARY_SOURCE_SUITE})
|
||||
# tests requested in this and previous runs
|
||||
# trigger -> src -> [arch]
|
||||
self.pending_tests = None
|
||||
|
@ -7,6 +7,7 @@ from urllib.parse import quote
|
||||
|
||||
import apt_pkg
|
||||
|
||||
from britney2 import SuiteClass
|
||||
from britney2.hints import Hint, split_into_one_hint_per_package
|
||||
from britney2.policies import PolicyVerdict
|
||||
from britney2.utils import get_dependency_solvers
|
||||
@ -23,7 +24,7 @@ class BasePolicy(object):
|
||||
:param options The options member of Britney with all the
|
||||
config options.
|
||||
|
||||
:param applicable_suites A set of suite names where this
|
||||
:param applicable_suites A set of suite classes where this
|
||||
policy applies.
|
||||
"""
|
||||
self.policy_id = policy_id
|
||||
@ -92,7 +93,7 @@ class BasePolicy(object):
|
||||
|
||||
:param source_data_srcdist Information about the source
|
||||
package in the source distribution (e.g. "unstable" or "tpu").
|
||||
This is the data structure in
|
||||
This is the data structure in suite.sources[source_name]
|
||||
Britney.sources[suite][source_name]
|
||||
|
||||
:return A Policy Verdict (e.g. PolicyVerdict.PASS)
|
||||
@ -173,7 +174,7 @@ class AgePolicy(BasePolicy):
|
||||
"""
|
||||
|
||||
def __init__(self, options, suite_info, mindays):
|
||||
super().__init__('age', options, suite_info, {'unstable'})
|
||||
super().__init__('age', options, suite_info, {SuiteClass.PRIMARY_SOURCE_SUITE})
|
||||
self._min_days = mindays
|
||||
if options.default_urgency not in mindays: # pragma: no cover
|
||||
raise ValueError("Missing age-requirement for default urgency (MINDAYS_%s)" % options.default_urgency)
|
||||
@ -408,7 +409,7 @@ class RCBugPolicy(BasePolicy):
|
||||
"""
|
||||
|
||||
def __init__(self, options, suite_info):
|
||||
super().__init__('rc-bugs', options, suite_info, {'unstable'})
|
||||
super().__init__('rc-bugs', options, suite_info, {SuiteClass.PRIMARY_SOURCE_SUITE})
|
||||
self._bugs = {}
|
||||
|
||||
def register_hints(self, hint_parser):
|
||||
@ -535,7 +536,7 @@ class RCBugPolicy(BasePolicy):
|
||||
class PiupartsPolicy(BasePolicy):
|
||||
|
||||
def __init__(self, options, suite_info):
|
||||
super().__init__('piuparts', options, suite_info, {'unstable'})
|
||||
super().__init__('piuparts', options, suite_info, {SuiteClass.PRIMARY_SOURCE_SUITE})
|
||||
self._piuparts = {
|
||||
'unstable': None,
|
||||
'testing': None,
|
||||
@ -637,7 +638,8 @@ class PiupartsPolicy(BasePolicy):
|
||||
class BuildDependsPolicy(BasePolicy):
|
||||
|
||||
def __init__(self, options, suite_info):
|
||||
super().__init__('build-depends', options, suite_info, {'unstable', 'tpu', 'pu'})
|
||||
super().__init__('build-depends', options, suite_info,
|
||||
{SuiteClass.PRIMARY_SOURCE_SUITE, SuiteClass.ADDITIONAL_SOURCE_SUITE})
|
||||
self._britney = None
|
||||
|
||||
def initialise(self, britney):
|
||||
|
Loading…
x
Reference in New Issue
Block a user