]> git.decadent.org.uk Git - dak.git/blobdiff - dak/make_overrides.py
Merge commit 'ftpmaster/master'
[dak.git] / dak / make_overrides.py
index 40ca41ed2fe946d6b3eb1ba4d11005053c00e981..7ac3ec275fa6a1e04ba471bbc68927e72e6cab88 100755 (executable)
@@ -1,7 +1,11 @@
 #!/usr/bin/env python
 
-# Output override files for apt-ftparchive and indices/
-# Copyright (C) 2000, 2001, 2002, 2004, 2006  James Troup <james@nocrew.org>
+"""
+Output override files for apt-ftparchive and indices/
+@contact: Debian FTP Master <ftpmaster@debian.org>
+@copyright: 2000, 2001, 2002, 2004, 2006  James Troup <james@nocrew.org>
+@license: GNU General Public License version 2 or later
+"""
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 ################################################################################
 
-import pg, sys
+import pg
+import sys
 import apt_pkg
-import dak.lib.database as database
-import dak.lib.utils as utils
+from daklib import database
+from daklib import utils
 
 ################################################################################
 
-Cnf = None
-projectB = None
-override = {}
+Cnf = None       #: Configuration, apt_pkg.Configuration
+projectB = None  #: database connection, pgobject
+override = {}    #: override data to write out
 
 ################################################################################
 
@@ -48,6 +53,22 @@ Outputs the override tables to text files.
 ################################################################################
 
 def do_list(output_file, suite, component, otype):
+    """
+    Fetch override data for suite from the database and dump it.
+
+    @type output_file: fileobject
+    @param output_file: where to write the overrides to
+
+    @type suite: string
+    @param suite: The name of the suite
+
+    @type component: string
+    @param component: The name of the component
+
+    @type otype: string
+    @param otype: type of override. deb/udeb/dsc
+
+    """
     global override
 
     suite_id = database.get_suite_id(suite)
@@ -86,36 +107,34 @@ def main ():
     Cnf = utils.get_conf()
     Arguments = [('h',"help","Make-Overrides::Options::Help")]
     for i in [ "help" ]:
-       if not Cnf.has_key("Make-Overrides::Options::%s" % (i)):
-           Cnf["Make-Overrides::Options::%s" % (i)] = ""
+        if not Cnf.has_key("Make-Overrides::Options::%s" % (i)):
+            Cnf["Make-Overrides::Options::%s" % (i)] = ""
     apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
     Options = Cnf.SubTree("Make-Overrides::Options")
     if Options["Help"]:
-       usage()
+        usage()
 
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
     database.init(Cnf, projectB)
 
     for suite in Cnf.SubTree("Check-Overrides::OverrideSuites").List():
-        if Cnf.has_key("Suite::%s::Untouchable" % suite) and Cnf["Suite::%s::Untouchable" % suite] != 0:
+        if database.get_suite_untouchable(suite):
             continue
         suite = suite.lower()
 
         sys.stderr.write("Processing %s...\n" % (suite))
         override_suite = Cnf["Suite::%s::OverrideCodeName" % (suite)]
         for component in Cnf.SubTree("Component").List():
-            if component == "mixed":
-                continue; # Ick
             for otype in Cnf.ValueList("OverrideType"):
                 if otype == "deb":
                     suffix = ""
                 elif otype == "udeb":
-                    if component != "main":
-                        continue; # Ick2
+                    if component == "contrib":
+                        continue # Ick2
                     suffix = ".debian-installer"
                 elif otype == "dsc":
                     suffix = ".src"
-                filename = "%s/override.%s.%s%s" % (Cnf["Dir::Override"], override_suite, component.replace("non-US/", ""), suffix)
+                filename = "%s/override.%s.%s%s" % (Cnf["Dir::Override"], override_suite, component, suffix)
                 output_file = utils.open_file(filename, 'w')
                 do_list(output_file, suite, component, otype)
                 output_file.close()