mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-02-10 14:07:29 +00:00
Rework the dependencies between excuses. Dependencies are specified based on packages (source or binary). Based on these packages, dependencies on other excuses (that have these packages) are calculated. As with package dependencies, dependencies between excuses can contain alternatives. Each alternative can satisfy the dependency, so the excuse only becomes invalid if all of the alternatives of a specific dependency are invalidated. Tracking of the alternatives and their validity is moved to separate objects.
51 lines
1.1 KiB
Python
51 lines
1.1 KiB
Python
from britney2.policies import PolicyVerdict
|
|
|
|
|
|
class DependencySpec(object):
|
|
|
|
def __init__(self, deptype, architecture=None):
|
|
self.deptype = deptype
|
|
self.architecture = architecture
|
|
assert self.architecture != 'all', "all not allowed for DependencySpec"
|
|
|
|
|
|
class DependencyState(object):
|
|
|
|
def __init__(self, dep):
|
|
"""State of a dependency
|
|
|
|
:param dep: the excuse that we are depending on
|
|
|
|
"""
|
|
self.valid = True
|
|
self.verdict = PolicyVerdict.PASS
|
|
self.dep = dep
|
|
|
|
@property
|
|
def possible(self):
|
|
return True
|
|
|
|
def invalidate(self, verdict):
|
|
self.valid = False
|
|
if verdict > self.verdict:
|
|
self.verdict = verdict
|
|
|
|
|
|
class ImpossibleDependencyState(DependencyState):
|
|
"""Object tracking an impossible dependency"""
|
|
|
|
def __init__(self, verdict, desc):
|
|
"""
|
|
|
|
:param desc: description of the impossible dependency
|
|
|
|
"""
|
|
self.valid = False
|
|
self.verdict = verdict
|
|
self.desc = desc
|
|
self.dep = None
|
|
|
|
@property
|
|
def possible(self):
|
|
return False
|