Made is_valid and dontinvalidate properties in Excuse

Use the is_valid in "html"-method to determine whether to write "Valid
candidate" or not.  This avoids the occasional:

 * Valid candidate
 * Invalidated by dependency
 * Not considered

Signed-off-by: Niels Thykier <niels@thykier.net>
debian
Niels Thykier 13 years ago
parent 85221000eb
commit ed905b99c7

@ -1110,7 +1110,7 @@ class Britney:
self.excuses.append(excuse) self.excuses.append(excuse)
return False return False
excuse.addhtml("Valid candidate") excuse.is_valid = True
self.excuses.append(excuse) self.excuses.append(excuse)
return True return True
@ -1216,7 +1216,7 @@ class Britney:
# if there is nothing wrong and there is something worth doing, this is a valid candidate # if there is nothing wrong and there is something worth doing, this is a valid candidate
if not anywrongver and anyworthdoing: if not anywrongver and anyworthdoing:
excuse.addhtml("Valid candidate") excuse.is_valid = True
self.excuses.append(excuse) self.excuses.append(excuse)
return True return True
# else if there is something worth doing (but something wrong, too) this package won't be considered # else if there is something worth doing (but something wrong, too) this package won't be considered
@ -1458,7 +1458,7 @@ class Britney:
# 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 = [ x for x in self.hints.search('force', package=src) if self.same_source(source_u[VERSION], x.version) ] forces = [ x for x in self.hints.search('force', package=src) if self.same_source(source_u[VERSION], x.version) ]
if forces: if forces:
excuse.dontinvalidate = 1 excuse.dontinvalidate = True
if not update_candidate and forces: if not update_candidate and forces:
excuse.addhtml("Should ignore, but forced by %s" % (forces[0].user)) excuse.addhtml("Should ignore, but forced by %s" % (forces[0].user))
update_candidate = True update_candidate = True
@ -1474,7 +1474,7 @@ class Britney:
# if the package can be updated, it is a valid candidate # if the package can be updated, it is a valid candidate
if update_candidate: if update_candidate:
excuse.addhtml("Valid candidate") excuse.is_valid = True
# else it won't be considered # else it won't be considered
else: else:
excuse.addhtml("Not considered") excuse.addhtml("Not considered")
@ -1535,6 +1535,7 @@ class Britney:
invalid.append(valid.pop(p)) invalid.append(valid.pop(p))
exclookup[x].addhtml("Invalidated by dependency") exclookup[x].addhtml("Invalidated by dependency")
exclookup[x].addhtml("Not considered") exclookup[x].addhtml("Not considered")
exclookup[x].is_valid = False
i = i + 1 i = i + 1
def write_excuses(self): def write_excuses(self):

@ -50,7 +50,8 @@ class Excuse:
self.daysold = None self.daysold = None
self.mindays = None self.mindays = None
self.section = None self.section = None
self.dontinvalidate = 0 self._is_valid = False
self._dontinvalidate = False
self.invalid_deps = [] self.invalid_deps = []
self.deps = {} self.deps = {}
@ -60,6 +61,22 @@ class Excuse:
self.bugs = [] self.bugs = []
self.htmlline = [] self.htmlline = []
@property
def is_valid(self):
return self._is_valid
@is_valid.setter
def is_valid(self, 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"""
if tver: self.ver = (tver, self.ver[1]) if tver: self.ver = (tver, self.ver[1])
@ -141,5 +158,7 @@ class Excuse:
for (n,a) in self.break_deps: for (n,a) in self.break_deps:
if n not in self.deps: if n not in self.deps:
res += "<li>Ignoring %s depends: <a href=\"#%s\">%s</a>\n" % (a, n, n) res += "<li>Ignoring %s depends: <a href=\"#%s\">%s</a>\n" % (a, n, n)
if self.is_valid:
res += "<li>Valid candidate</li>\n"
res = res + "</ul>\n" res = res + "</ul>\n"
return res return res

Loading…
Cancel
Save