From 7049af338de6e416edba4a67201c6712fe7a011e Mon Sep 17 00:00:00 2001 From: Colin Watson Date: Mon, 22 Oct 2012 13:47:52 +0100 Subject: [PATCH] Skip date-based processing if Dates is missing. --- britney.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/britney.py b/britney.py index 4c633c7..3af3c8e 100755 --- a/britney.py +++ b/britney.py @@ -721,13 +721,18 @@ class Britney(object): dates = {} filename = os.path.join(basedir, "Dates") self.__log("Loading upload data from %s" % filename) - for line in open(filename): - l = line.split() - if len(l) != 3: continue - try: - dates[l[0]] = (l[1], int(l[2])) - except ValueError: - self.__log("Dates, unable to parse \"%s\"" % line, type="E") + try: + for line in open(filename): + l = line.split() + if len(l) != 3: continue + try: + dates[l[0]] = (l[1], int(l[2])) + except ValueError: + self.__log("Dates, unable to parse \"%s\"" % line, + type="E") + except IOError: + self.__log("%s missing; skipping date-based processing" % filename) + return None return dates def write_dates(self, basedir, dates): @@ -1327,7 +1332,7 @@ class Britney(object): # permanence in unstable before updating testing; if the source package is too young, # the check fails and we set update_candidate to False to block the update; consider # the age-days hint, if specified for the package - if suite == 'unstable': + if suite == 'unstable' and self.dates is not None: if src not in self.dates: self.dates[src] = (source_u[VERSION], self.date_now) elif not self.same_source(self.dates[src][0], source_u[VERSION]): @@ -1423,7 +1428,7 @@ class Britney(object): else: update_candidate = False - if self.date_now != self.dates[src][1]: + if self.dates is None or self.date_now != self.dates[src][1]: excuse.addhtml(text) # if the source package has no binaries, set update_candidate to False to block the update @@ -2449,7 +2454,8 @@ class Britney(object): self.write_controlfiles(self.options.testing, 'testing') # write dates - self.write_dates(self.options.testing, self.dates) + if self.dates is not None: + self.write_dates(self.options.testing, self.dates) # write HeidiResult self.write_heidi(self.options.heidi_output)