From: Mike O'Connor Date: Wed, 25 Feb 2009 21:21:16 +0000 (-0500) Subject: allow contents files to be written to an alternate location X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=acce37cb1193730d8b7529a49cf95a7997f6ee9d;p=dak allow contents files to be written to an alternate location Signed-off-by: Mike O'Connor --- diff --git a/config/debian/dak.conf b/config/debian/dak.conf index de6841e9..60df7567 100644 --- a/config/debian/dak.conf +++ b/config/debian/dak.conf @@ -716,4 +716,5 @@ Urgency Contents { Header "contents"; + Root "/srv/ftp.debian.org/ftp/"; } \ No newline at end of file diff --git a/dak/contents.py b/dak/contents.py index 2e24b2b9..a2f99ae7 100644 --- a/dak/contents.py +++ b/dak/contents.py @@ -191,14 +191,12 @@ class Contents(object): h = open(os.path.join( Config()["Dir::Templates"], Config()["Contents::Header"] ), "r") self.header = h.read() - print( "header: %s" % self.header ) h.close() except: log.error( "error opening header file: %d\n%s" % (Config()["Contents::Header"], traceback.format_exc() )) self.header = False else: - print( "no header" ) self.header = False return self.header @@ -211,7 +209,11 @@ class Contents(object): Internal method for writing all the results to a given file. The cursor should have a result set generated from a query already. """ - f = gzip.open(Config()["Dir::Root"] + filename, "w") + filepath = Config()["Contents::Root"] + filename + filedir = os.path.dirname(filepath) + if not os.path.isdir(filedir): + os.makedirs(filedir) + f = gzip.open(filepath, "w") try: header = self._getHeader() @@ -224,7 +226,7 @@ class Contents(object): return num_tabs = max(1, - int( math.ceil( (self._goal_column - len(contents[0])) / 8) ) ) + int(math.ceil((self._goal_column - len(contents[0])) / 8))) f.write(contents[0] + ( '\t' * num_tabs ) + contents[-1] + "\n") finally: diff --git a/dak/dak.py b/dak/dak.py index 14cddd56..61749490 100755 --- a/dak/dak.py +++ b/dak/dak.py @@ -173,8 +173,6 @@ def init(): "Split queue/done into a date-based hierarchy"), ("stats", "Generate statistics"), - ("calculate-shasums", - "Calculate missing sha1sums and sha256sums"), ("bts-categorize", "Categorize uncategorized bugs filed against ftp.debian.org"), ("add-user",