Optimise a few hints.search calls

Signed-off-by: Niels Thykier <niels@thykier.net>
master
Niels Thykier 8 years ago
parent ce5b893a19
commit 63b08f8278

@ -1032,7 +1032,7 @@ class Britney(object):
# version in testing, then stop here and return False
# (as a side effect, a removal may generate such excuses for both the source
# package and its binary packages on each architecture)
for hint in [x for x in self.hints.search('remove', package=src) if source_t[VERSION] == x.version]:
for hint in self.hints.search('remove', package=src, version=source_t[VERSION]):
excuse.addhtml("Removal request by %s" % (hint.user))
excuse.addhtml("Trying to remove package, not update it")
excuse.addhtml("Not considered")
@ -1435,7 +1435,7 @@ class Britney(object):
update_candidate = False
# 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 source_u[VERSION] == x.version]
forces = self.hints.search('force', package=src, version=source_u[VERSION])
if forces:
excuse.dontinvalidate = True
if not update_candidate and forces:

@ -160,8 +160,8 @@ class AgePolicy(BasePolicy):
age_info['age-requirement'] = min_days
age_info['current-age'] = days_old
for age_days_hint in [x for x in self.hints.search('age-days', package=source_name)
if source_data_srcdist[VERSION] == x.version]:
for age_days_hint in self.hints.search('age-days', package=source_name,
version=source_data_srcdist[VERSION]):
new_req = int(age_days_hint.days)
age_info['age-requirement-reduced'] = {
'new-requirement': new_req,
@ -170,8 +170,8 @@ class AgePolicy(BasePolicy):
min_days = new_req
if days_old < min_days:
urgent_hints = [x for x in self.hints.search('urgent', package=source_name)
if source_data_srcdist[VERSION] == x.version]
urgent_hints = self.hints.search('urgent', package=source_name,
version=source_data_srcdist[VERSION])
if urgent_hints:
age_info['age-requirement-reduced'] = {
'new-requirement': 0,

Loading…
Cancel
Save