[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] allow contents files to be written to an alternate location



Signed-off-by: Mike O'Connor <stew@vireo.org>
---
 config/debian/dak.conf |    1 +
 dak/contents.py        |   10 ++++++----
 dak/dak.py             |    2 --
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/config/debian/dak.conf b/config/debian/dak.conf
index de6841e..60df756 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 2e24b2b..a2f99ae 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 14cddd5..6174949 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",
-- 
1.5.6.5



Reply to: