Replace dontinvalidate with forced

Signed-off-by: Niels Thykier <niels@thykier.net>
ubuntu/rebased
Niels Thykier 8 years ago
parent 6e560c854a
commit f40a7f41b3

@ -1498,11 +1498,10 @@ class Britney(object):
# check if there is a `force' hint for this package, which allows it to go in even if it is not updateable # check if there is a `force' hint for this package, which allows it to go in even if it is not updateable
forces = self.hints.search('force', package=src, version=source_u.version) forces = self.hints.search('force', package=src, version=source_u.version)
if forces: if forces:
excuse.dontinvalidate = True # force() updates the final verdict for us
if not excuse.is_valid: changed_state = excuse.force()
if changed_state:
excuse.addhtml("Should ignore, but forced by %s" % (forces[0].user)) excuse.addhtml("Should ignore, but forced by %s" % (forces[0].user))
excuse.force()
excuse.is_valid = True
self.excuses[excuse.name] = excuse self.excuses[excuse.name] = excuse
return excuse.is_valid return excuse.is_valid

@ -48,7 +48,6 @@ class Excuse(object):
self.mindays = None self.mindays = None
self.section = None self.section = None
self._is_valid = False self._is_valid = False
self._dontinvalidate = False
self.needs_approval = False self.needs_approval = False
self.hints = [] self.hints = []
self.forced = False self.forced = False
@ -80,13 +79,7 @@ class Excuse(object):
def is_valid(self, value): def is_valid(self, value):
self._is_valid = value self._is_valid = value
@property
def dontinvalidate(self):
return self._dontinvalidate
@dontinvalidate.setter
def dontinvalidate(self, value):
self._dontinvalidate = value
def set_vers(self, tver, uver): def set_vers(self, tver, uver):
"""Set the testing and unstable versions""" """Set the testing and unstable versions"""
@ -127,6 +120,10 @@ class Excuse(object):
def force(self): def force(self):
"""Add force hint""" """Add force hint"""
self.forced = True self.forced = True
if not self._is_valid:
self._is_valid = True
return True
return False
def addhtml(self, note): def addhtml(self, note):
"""Add a note in HTML""" """Add a note in HTML"""

@ -802,14 +802,14 @@ def invalidate_excuses(excuses, valid, invalid):
continue continue
# loop on the reverse dependencies # loop on the reverse dependencies
for x in revdeps[ename]: for x in revdeps[ename]:
# if the item is valid and it is marked as `dontinvalidate', skip the item
if x in valid and excuses[x].dontinvalidate:
continue
# otherwise, invalidate the dependency and mark as invalidated and
# remove the depending excuses
excuses[x].invalidate_dep(ename)
if x in valid: if x in valid:
# if the item is valid and it is marked as `forced', skip the item
if excuses[x].forced:
continue
# otherwise, invalidate the dependency and mark as invalidated and
# remove the depending excuses
excuses[x].invalidate_dep(ename)
p = valid.index(x) p = valid.index(x)
invalid.append(valid.pop(p)) invalid.append(valid.pop(p))
excuses[x].addhtml("Invalidated by dependency") excuses[x].addhtml("Invalidated by dependency")

Loading…
Cancel
Save