]> git.decadent.org.uk Git - dak.git/commitdiff
Merge commit 'sec-merge' into security
authorJoerg Jaspert <joerg@debian.org>
Wed, 24 Sep 2008 21:26:01 +0000 (23:26 +0200)
committerJoerg Jaspert <joerg@debian.org>
Wed, 24 Sep 2008 21:26:01 +0000 (23:26 +0200)
* commit 'sec-merge':
  Use "import daklib.foo as foo" style
  Use "import daklib.foo as foo" style
  Use "import daklib.foo as foo" style
  Use "import daklib.foo as foo" style
  Tell bzr that dak.py should be executable
  Use "import daklib.foo as foo" style
  Use "import daklib.foo as foo" style
  Cleanup

ChangeLog
dak/clean_suites.py [changed mode: 0644->0755]
dak/compare_suites.py [changed mode: 0644->0755]
dak/cruft_report.py [changed mode: 0644->0755]
dak/examine_package.py
dak/find_null_maintainers.py [changed mode: 0644->0755]
dak/generate_index_diffs.py [changed mode: 0644->0755]
dak/generate_releases.py [changed mode: 0644->0755]
dak/import_archive.py [changed mode: 0644->0755]

index e515fc65edb362cd9401bc943d05d9a7c79cb452..833a64bf860063d048d7f993c9938dbf58e8c3cf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,19 @@
 2008-05-04  Joerg Jaspert  <joerg@debian.org>
 
+       * dak/examine_package.py: remove daklib.queue import, never used
+
        * dak/check_proposed_updates.py: Import stuff from daklib as
        "import daklib.foo as foo"
        * dak/clean_proposed_updates.py: likewise
        * dak/clean_queues.py: likewise
+       * dak/clean_suites.py: likewise
+       * dak/compare_suites.py: likewise
+       * dak/cruft_report.py: likewise
+       * dak/examine_package.py: likewise
+       * dak/find_null_maintainers.py: likewise
+       * dak/generate_index_diffs.py: likewise
+       * dak/generate_releases.py: likewise
+       * dak/import_archive.py: likewise
 
        * dak/check_archive.py (check_files_not_symlinks): Remove
        long-time unused and commented code. Import stuff from daklib as
old mode 100644 (file)
new mode 100755 (executable)
index cb7225b..f459cdd
@@ -30,7 +30,7 @@
 
 import os, pg, stat, sys, time
 import apt_pkg
-import daklib.utils
+import daklib.utils as utils
 
 ################################################################################
 
@@ -208,7 +208,7 @@ def clean():
     for i in q.getresult():
         filename = i[0] + i[1]
         if not os.path.exists(filename):
-            daklib.utils.warn("can not find '%s'." % (filename))
+            utils.warn("can not find '%s'." % (filename))
             continue
         if os.path.isfile(filename):
             if os.path.islink(filename):
@@ -224,14 +224,14 @@ def clean():
                 dest_filename = dest + '/' + os.path.basename(filename)
                 # If the destination file exists; try to find another filename to use
                 if os.path.exists(dest_filename):
-                    dest_filename = daklib.utils.find_next_free(dest_filename)
+                    dest_filename = utils.find_next_free(dest_filename)
 
                 if Options["No-Action"]:
                     print "Cleaning %s -> %s ..." % (filename, dest_filename)
                 else:
-                    daklib.utils.move(filename, dest_filename)
+                    utils.move(filename, dest_filename)
         else:
-            daklib.utils.fubar("%s is neither symlink nor file?!" % (filename))
+            utils.fubar("%s is neither symlink nor file?!" % (filename))
 
     # Delete from the 'files' table
     if not Options["No-Action"]:
@@ -240,7 +240,7 @@ def clean():
         projectB.query("DELETE FROM files WHERE last_used <= '%s'" % (delete_date))
         sys.stdout.write("done. (%d seconds)]\n" % (int(time.time()-before)))
     if count > 0:
-        sys.stderr.write("Cleaned %d files, %s.\n" % (count, daklib.utils.size_type(size)))
+        sys.stderr.write("Cleaned %d files, %s.\n" % (count, utils.size_type(size)))
 
 ################################################################################
 
@@ -307,10 +307,10 @@ def clean_queue_build():
     for i in q.getresult():
         filename = i[0]
         if not os.path.exists(filename):
-            daklib.utils.warn("%s (from queue_build) doesn't exist." % (filename))
+            utils.warn("%s (from queue_build) doesn't exist." % (filename))
             continue
         if not Cnf.FindB("Dinstall::SecurityQueueBuild") and not os.path.islink(filename):
-            daklib.utils.fubar("%s (from queue_build) should be a symlink but isn't." % (filename))
+            utils.fubar("%s (from queue_build) should be a symlink but isn't." % (filename))
         os.unlink(filename)
         count += 1
     projectB.query("DELETE FROM queue_build WHERE last_used <= '%s'" % (our_delete_date))
@@ -323,7 +323,7 @@ def clean_queue_build():
 def main():
     global Cnf, Options, projectB, delete_date, now_date
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
     for i in ["Help", "No-Action" ]:
         if not Cnf.has_key("Clean-Suites::Options::%s" % (i)):
             Cnf["Clean-Suites::Options::%s" % (i)] = ""
old mode 100644 (file)
new mode 100755 (executable)
index e94d9f5..a3df829
@@ -22,8 +22,8 @@
 
 import pg, sys
 import apt_pkg
-import daklib.database
-import daklib.utils
+import daklib.database as database
+import daklib.utils as utils
 
 ################################################################################
 
@@ -44,7 +44,7 @@ Looks for fixable descrepancies between stable and unstable.
 def main ():
     global Cnf, projectB
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
     Arguments = [('h',"help","Compare-Suites::Options::Help")]
     for i in [ "help" ]:
         if not Cnf.has_key("Compare-Suites::Options::%s" % (i)):
@@ -57,15 +57,15 @@ def main ():
         usage()
 
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
-    daklib.database.init(Cnf, projectB)
+    database.init(Cnf, projectB)
 
     src_suite = "stable"
     dst_suite = "unstable"
 
-    src_suite_id = daklib.database.get_suite_id(src_suite)
-    dst_suite_id = daklib.database.get_suite_id(dst_suite)
-    arch_all_id = daklib.database.get_architecture_id("all")
-    dsc_type_id = daklib.database.get_override_type_id("dsc")
+    src_suite_id = database.get_suite_id(src_suite)
+    dst_suite_id = database.get_suite_id(dst_suite)
+    arch_all_id = database.get_architecture_id("all")
+    dsc_type_id = database.get_override_type_id("dsc")
 
     for arch in Cnf.ValueList("Suite::%s::Architectures" % (src_suite)):
         if arch == "source":
@@ -77,7 +77,7 @@ def main ():
 
         if arch == "all":
             continue
-        arch_id = daklib.database.get_architecture_id(arch)
+        arch_id = database.get_architecture_id(arch)
         q = projectB.query("""
 SELECT b_src.package, b_src.version, a.arch_string
   FROM binaries b_src, bin_associations ba, override o, architecture a
old mode 100644 (file)
new mode 100755 (executable)
index 02a38e0..238cdd4
@@ -29,8 +29,8 @@
 
 import commands, pg, os, sys, time
 import apt_pkg
-import daklib.database
-import daklib.utils
+import daklib.database as database
+import daklib.utils as utils
 
 ################################################################################
 
@@ -117,7 +117,7 @@ def do_anais(architecture, binaries_list, source):
 ################################################################################
 
 def do_nviu():
-    experimental_id = daklib.database.get_suite_id("experimental")
+    experimental_id = database.get_suite_id("experimental")
     if experimental_id == -1:
         return
     # Check for packages in experimental obsoleted by versions in unstable
@@ -127,7 +127,7 @@ SELECT s.source, s.version AS experimental, s2.version AS unstable
   WHERE sa.suite = %s AND sa2.suite = %d AND sa.source = s.id
    AND sa2.source = s2.id AND s.source = s2.source
    AND versioncmp(s.version, s2.version) < 0""" % (experimental_id,
-                                                   daklib.database.get_suite_id("unstable")))
+                                                   database.get_suite_id("unstable")))
     ql = q.getresult()
     if ql:
         nviu_to_remove = []
@@ -247,7 +247,7 @@ def do_obsolete_source(duplicate_bins, bin2source):
 def main ():
     global Cnf, projectB, suite, suite_id, source_binaries, source_versions
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
 
     Arguments = [('h',"help","Cruft-Report::Options::Help"),
                  ('m',"mode","Cruft-Report::Options::Mode", "HasArg"),
@@ -272,11 +272,11 @@ def main ():
     elif Options["Mode"] == "full":
         checks = [ "nbs", "nviu", "obsolete source", "dubious nbs", "bnb", "bms", "anais" ]
     else:
-        daklib.utils.warn("%s is not a recognised mode - only 'full' or 'daily' are understood." % (Options["Mode"]))
+        utils.warn("%s is not a recognised mode - only 'full' or 'daily' are understood." % (Options["Mode"]))
         usage(1)
 
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
-    daklib.database.init(Cnf, projectB)
+    database.init(Cnf, projectB)
 
     bin_pkgs = {}
     src_pkgs = {}
@@ -289,7 +289,7 @@ def main ():
     duplicate_bins = {}
 
     suite = Options["Suite"]
-    suite_id = daklib.database.get_suite_id(suite)
+    suite_id = database.get_suite_id(suite)
 
     bin_not_built = {}
 
@@ -308,12 +308,12 @@ def main ():
     for component in components:
         filename = "%s/dists/%s/%s/source/Sources.gz" % (Cnf["Dir::Root"], suite, component)
         # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-        temp_filename = daklib.utils.temp_filename()
+        temp_filename = utils.temp_filename()
         (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
         if (result != 0):
             sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))
             sys.exit(result)
-        sources = daklib.utils.open_file(temp_filename)
+        sources = utils.open_file(temp_filename)
         Sources = apt_pkg.ParseTagFile(sources)
         while Sources.Step():
             source = Sources.Section.Find('Package')
@@ -356,16 +356,16 @@ def main ():
     if suite != "experimental":
         check_components.append('main/debian-installer');
     for component in check_components:
-        architectures = filter(daklib.utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite)))
+        architectures = filter(utils.real_arch, Cnf.ValueList("Suite::%s::Architectures" % (suite)))
         for architecture in architectures:
             filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (Cnf["Dir::Root"], suite, component, architecture)
             # apt_pkg.ParseTagFile needs a real file handle
-            temp_filename = daklib.utils.temp_filename()
+            temp_filename = utils.temp_filename()
             (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
             if (result != 0):
                 sys.stderr.write("Gunzip invocation failed!\n%s\n" % (output))
                 sys.exit(result)
-            packages = daklib.utils.open_file(temp_filename)
+            packages = utils.open_file(temp_filename)
             Packages = apt_pkg.ParseTagFile(packages)
             while Packages.Step():
                 package = Packages.Section.Find('Package')
@@ -382,7 +382,7 @@ def main ():
                     bin2source[package]["version"] = version
                     bin2source[package]["source"] = source
                 if source.find("(") != -1:
-                    m = daklib.utils.re_extract_src_version.match(source)
+                    m = utils.re_extract_src_version.match(source)
                     source = m.group(1)
                     version = m.group(2)
                 if not bin_pkgs.has_key(package):
index 3161428de9919f9563a86752a1cb108cb858831b..81191d257616963e492512d62aa94f2e44520f3c 100755 (executable)
@@ -34,7 +34,8 @@
 
 import errno, os, pg, re, sys, md5
 import apt_pkg, apt_inst
-import daklib.database, daklib.utils, daklib.queue
+import daklib.database as database
+import daklib.utils as utils
 
 ################################################################################
 
@@ -62,9 +63,9 @@ re_html_escaping = re.compile('|'.join(map(re.escape, html_escaping.keys())))
 Cnf = None
 projectB = None
 
-Cnf = daklib.utils.get_conf()
+Cnf = utils.get_conf()
 projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
-daklib.database.init(Cnf, projectB)
+database.init(Cnf, projectB)
 
 printed_copyrights = {}
 
@@ -225,7 +226,7 @@ def read_control (filename):
     maintainer = ''
     arch = ''
 
-    deb_file = daklib.utils.open_file(filename)
+    deb_file = utils.open_file(filename)
     try:
         extracts = apt_inst.debExtractControl(deb_file)
         control = apt_pkg.ParseSection(extracts)
@@ -279,9 +280,9 @@ def read_control (filename):
 def read_changes_or_dsc (filename):
     dsc = {}
 
-    dsc_file = daklib.utils.open_file(filename)
+    dsc_file = utils.open_file(filename)
     try:
-        dsc = daklib.utils.parse_changes(filename)
+        dsc = utils.parse_changes(filename)
     except:
         return formatted_text("can't parse .dsc control info")
     dsc_file.close()
@@ -457,7 +458,7 @@ def check_deb (deb_filename):
 # Read a file, strip the signature and return the modified contents as
 # a string.
 def strip_pgp_signature (filename):
-    file = daklib.utils.open_file (filename)
+    file = utils.open_file (filename)
     contents = ""
     inside_signature = 0
     skip_next = 0
@@ -489,8 +490,8 @@ def display_changes(changes_filename):
 def check_changes (changes_filename):
     display_changes(changes_filename)
 
-    changes = daklib.utils.parse_changes (changes_filename)
-    files = daklib.utils.build_file_list(changes)
+    changes = utils.parse_changes (changes_filename)
+    files = utils.build_file_list(changes)
     for f in files.keys():
         if f.endswith(".deb") or f.endswith(".udeb"):
             check_deb(f)
@@ -501,7 +502,7 @@ def check_changes (changes_filename):
 def main ():
     global Cnf, projectB, db_files, waste, excluded
 
-#    Cnf = daklib.utils.get_conf()
+#    Cnf = utils.get_conf()
 
     Arguments = [('h',"help","Examine-Package::Options::Help"),
                  ('H',"html-output","Examine-Package::Options::Html-Output"),
@@ -533,7 +534,7 @@ def main ():
                 elif f.endswith(".dsc"):
                     check_dsc(f)
                 else:
-                    daklib.utils.fubar("Unrecognised file type: '%s'." % (f))
+                    utils.fubar("Unrecognised file type: '%s'." % (f))
             finally:
                 if not Options["Html-Output"]:
                     # Reset stdout here so future less invocations aren't FUBAR
@@ -541,12 +542,12 @@ def main ():
                     sys.stdout = stdout_fd
         except IOError, e:
             if errno.errorcode[e.errno] == 'EPIPE':
-                daklib.utils.warn("[examine-package] Caught EPIPE; skipping.")
+                utils.warn("[examine-package] Caught EPIPE; skipping.")
                 pass
             else:
                 raise
         except KeyboardInterrupt:
-            daklib.utils.warn("[examine-package] Caught C-c; skipping.")
+            utils.warn("[examine-package] Caught C-c; skipping.")
             pass
 
 #######################################################################################
old mode 100644 (file)
new mode 100755 (executable)
index 727ed31..c4e457f
@@ -21,7 +21,7 @@
 
 import ldap, pg, sys, time
 import apt_pkg
-import daklib.utils
+import daklib.utils as utils
 
 ################################################################################
 
@@ -50,7 +50,7 @@ def get_ldap_value(entry, value):
 def main():
     global Cnf, projectB
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
     Arguments = [('h',"help","Find-Null-Maintainers::Options::Help")]
     for i in [ "help" ]:
         if not Cnf.has_key("Find-Null-Maintainers::Options::%s" % (i)):
old mode 100644 (file)
new mode 100755 (executable)
index 03d5165..7cbedb9
@@ -32,7 +32,7 @@
 
 import sys, os, tempfile
 import apt_pkg
-import daklib.utils
+import daklib.utils as utils
 
 ################################################################################
 
@@ -286,7 +286,7 @@ def main():
 
     os.umask(0002)
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
     Arguments = [ ('h', "help", "Generate-Index-Diffs::Options::Help"),
                   ('c', None, "Generate-Index-Diffs::Options::CanonicalPath", "hasArg"),
                   ('p', "patchname", "Generate-Index-Diffs::Options::PatchName", "hasArg"),
@@ -312,7 +312,7 @@ def main():
         o.close()
 
     AptCnf = apt_pkg.newConfiguration()
-    apt_pkg.ReadConfigFileISC(AptCnf,daklib.utils.which_apt_conf_file())
+    apt_pkg.ReadConfigFileISC(AptCnf,utils.which_apt_conf_file())
 
     if Options.has_key("RootDir"): Cnf["Dir::Root"] = Options["RootDir"]
 
@@ -349,7 +349,7 @@ def main():
         elif AptCnf.has_key("bindirectory::%s" % (tree)):
             sections = AptCnf["bindirectory::%s::Sections" % (tree)].split()
         else:
-            aptcnf_filename = os.path.basename(daklib.utils.which_apt_conf_file())
+            aptcnf_filename = os.path.basename(utils.which_apt_conf_file())
             print "ALERT: suite %s not in %s, nor untouchable!" % (suite, aptcnf_filename)
             continue
 
old mode 100644 (file)
new mode 100755 (executable)
index 867fbc8..cb82a94
@@ -24,7 +24,7 @@
 
 import sys, os, popen2, tempfile, stat, time, pg
 import apt_pkg
-import daklib.utils
+import daklib.utils as utils
 
 ################################################################################
 
@@ -106,8 +106,8 @@ def print_md5sha_files (tree, files, hashop):
                     (cat, path, name, ext))
             else:
                 size = os.stat(path + name)[stat.ST_SIZE]
-                file_handle = daklib.utils.open_file(path + name)
-        except daklib.utils.cant_open_exc:
+                file_handle = utils.open_file(path + name)
+        except utils.cant_open_exc:
             print "ALERT: Couldn't open " + path + name
         else:
             hash = hashop(file_handle)
@@ -129,7 +129,7 @@ def main ():
     global Cnf, AptCnf, projectB, out
     out = sys.stdout
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
 
     Arguments = [('h',"help","Generate-Releases::Options::Help"),
                  ('a',"apt-conf","Generate-Releases::Options::Apt-Conf", "HasArg"),
@@ -146,7 +146,7 @@ def main ():
         usage()
 
     if not Options["Apt-Conf"]:
-        Options["Apt-Conf"] = daklib.utils.which_apt_conf_file()
+        Options["Apt-Conf"] = utils.which_apt_conf_file()
 
     AptCnf = apt_pkg.newConfiguration()
     apt_pkg.ReadConfigFileISC(AptCnf, Options["Apt-Conf"])
@@ -202,7 +202,7 @@ def main ():
         elif AptCnf.has_key("bindirectory::%s" % (tree)):
             pass
         else:
-            aptcnf_filename = os.path.basename(daklib.utils.which_apt_conf_file())
+            aptcnf_filename = os.path.basename(utils.which_apt_conf_file())
             print "ALERT: suite %s not in %s, nor untouchable!" % (suite, aptcnf_filename)
             continue
 
@@ -219,7 +219,7 @@ def main ():
         out.write("Date: %s\n" % (time.strftime("%a, %d %b %Y %H:%M:%S UTC", time.gmtime(time.time()))))
         if notautomatic != "":
             out.write("NotAutomatic: %s\n" % (notautomatic))
-        out.write("Architectures: %s\n" % (" ".join(filter(daklib.utils.real_arch, SuiteBlock.ValueList("Architectures")))))
+        out.write("Architectures: %s\n" % (" ".join(filter(utils.real_arch, SuiteBlock.ValueList("Architectures")))))
         if components:
             out.write("Components: %s\n" % (" ".join(components)))
 
@@ -262,7 +262,7 @@ def main ():
                         release = open(relpath, "w")
                         #release = open(longsuite.replace("/","_") + "_" + arch + "_" + sec + "_Release", "w")
                     except IOError:
-                        daklib.utils.fubar("Couldn't write to " + relpath)
+                        utils.fubar("Couldn't write to " + relpath)
 
                     release.write("Archive: %s\n" % (suite))
                     if version != "":
old mode 100644 (file)
new mode 100755 (executable)
index 82def1e..b8884ab
@@ -38,8 +38,8 @@
 
 import commands, os, pg, re, sys, time
 import apt_pkg
-import daklib.database
-import daklib.utils
+import daklib.database as database
+import daklib.utils as utils
 
 ###############################################################################
 
@@ -93,14 +93,14 @@ def reject (str, prefix="Rejected: "):
 ###############################################################################
 
 def check_signature (filename):
-    if not daklib.utils.re_taint_free.match(os.path.basename(filename)):
+    if not utils.re_taint_free.match(os.path.basename(filename)):
         reject("!!WARNING!! tainted filename: '%s'." % (filename))
         return None
 
     status_read, status_write = os.pipe()
     cmd = "gpgv --status-fd %s %s %s" \
-          % (status_write, daklib.utils.gpg_keyring_args(), filename)
-    (output, status, exit_status) = daklib.utils.gpgv_get_status_output(cmd, status_read, status_write)
+          % (status_write, utils.gpg_keyring_args(), filename)
+    (output, status, exit_status) = utils.gpgv_get_status_output(cmd, status_read, status_write)
 
     # Process the status-fd output
     keywords = {}
@@ -133,7 +133,7 @@ def check_signature (filename):
 
     # Now check for obviously bad things in the processed output
     if keywords.has_key("SIGEXPIRED"):
-        daklib.utils.warn("%s: signing key has expired." % (filename))
+        utils.warn("%s: signing key has expired." % (filename))
     if keywords.has_key("KEYREVOKED"):
         reject("key used to sign %s has been revoked." % (filename))
         bad = 1
@@ -154,7 +154,7 @@ def check_signature (filename):
         reject("ascii armour of signature was corrupt in %s." % (filename))
         bad = 1
     if keywords.has_key("NODATA"):
-        daklib.utils.warn("no signature found for %s." % (filename))
+        utils.warn("no signature found for %s." % (filename))
         return "NOSIG"
         #reject("no signature found in %s." % (filename))
         #bad = 1
@@ -166,9 +166,9 @@ def check_signature (filename):
     if exit_status and not keywords.has_key("NO_PUBKEY"):
         reject("gpgv failed while checking %s." % (filename))
         if status.strip():
-            reject(daklib.utils.prefix_multi_line_string(status, " [GPG status-fd output:] "), "")
+            reject(utils.prefix_multi_line_string(status, " [GPG status-fd output:] "), "")
         else:
-            reject(daklib.utils.prefix_multi_line_string(output, " [GPG output:] "), "")
+            reject(utils.prefix_multi_line_string(output, " [GPG output:] "), "")
         return None
 
     # Sanity check the good stuff we expect
@@ -191,7 +191,7 @@ def check_signature (filename):
         bad = 1
 
     # Finally ensure there's not something we don't recognise
-    known_keywords = daklib.utils.Dict(VALIDSIG="",SIG_ID="",GOODSIG="",BADSIG="",ERRSIG="",
+    known_keywords = utils.Dict(VALIDSIG="",SIG_ID="",GOODSIG="",BADSIG="",ERRSIG="",
                                 SIGEXPIRED="",KEYREVOKED="",NO_PUBKEY="",BADARMOR="",
                                 NODATA="")
 
@@ -232,13 +232,13 @@ def update_locations ():
     projectB.query("DELETE FROM location")
     for location in Cnf.SubTree("Location").List():
         SubSec = Cnf.SubTree("Location::%s" % (location))
-        archive_id = daklib.database.get_archive_id(SubSec["archive"])
+        archive_id = database.get_archive_id(SubSec["archive"])
         type = SubSec.Find("type")
         if type == "legacy-mixed":
             projectB.query("INSERT INTO location (path, archive, type) VALUES ('%s', %d, '%s')" % (location, archive_id, SubSec["type"]))
         else:
             for component in Cnf.SubTree("Component").List():
-                component_id = daklib.database.get_component_id(component)
+                component_id = database.get_component_id(component)
                 projectB.query("INSERT INTO location (path, component, archive, type) VALUES ('%s', %d, %d, '%s')" %
                                (location, component_id, archive_id, SubSec["type"]))
 
@@ -256,7 +256,7 @@ def update_suites ():
             if SubSec.has_key(i):
                 projectB.query("UPDATE suite SET %s = '%s' WHERE suite_name = '%s'" % (i.lower(), SubSec[i], suite.lower()))
         for architecture in Cnf.ValueList("Suite::%s::Architectures" % (suite)):
-            architecture_id = daklib.database.get_architecture_id (architecture)
+            architecture_id = database.get_architecture_id (architecture)
             projectB.query("INSERT INTO suite_architectures (suite, architecture) VALUES (currval('suite_id_seq'), %d)" % (architecture_id))
 
 def update_override_type():
@@ -297,7 +297,7 @@ def get_location_path(directory):
     try:
         path = q.getresult()[0][0]
     except:
-        daklib.utils.fubar("[import-archive] get_location_path(): Couldn't get path for %s" % (directory))
+        utils.fubar("[import-archive] get_location_path(): Couldn't get path for %s" % (directory))
     location_path_cache[directory] = path
     return path
 
@@ -320,41 +320,41 @@ def process_sources (filename, suite, component, archive):
     global source_cache, source_query_cache, src_associations_query_cache, dsc_files_query_cache, source_id_serial, src_associations_id_serial, dsc_files_id_serial, source_cache_for_binaries, orig_tar_gz_cache, reject_message
 
     suite = suite.lower()
-    suite_id = daklib.database.get_suite_id(suite)
+    suite_id = database.get_suite_id(suite)
     try:
-        file = daklib.utils.open_file (filename)
-    except daklib.utils.cant_open_exc:
-        daklib.utils.warn("can't open '%s'" % (filename))
+        file = utils.open_file (filename)
+    except utils.cant_open_exc:
+        utils.warn("can't open '%s'" % (filename))
         return
     Scanner = apt_pkg.ParseTagFile(file)
     while Scanner.Step() != 0:
         package = Scanner.Section["package"]
         version = Scanner.Section["version"]
         directory = Scanner.Section["directory"]
-        dsc_file = os.path.join(Cnf["Dir::Root"], directory, "%s_%s.dsc" % (package, daklib.utils.re_no_epoch.sub('', version)))
+        dsc_file = os.path.join(Cnf["Dir::Root"], directory, "%s_%s.dsc" % (package, utils.re_no_epoch.sub('', version)))
         # Sometimes the Directory path is a lie; check in the pool
         if not os.path.exists(dsc_file):
             if directory.split('/')[0] == "dists":
-                directory = Cnf["Dir::PoolRoot"] + daklib.utils.poolify(package, component)
-                dsc_file = os.path.join(Cnf["Dir::Root"], directory, "%s_%s.dsc" % (package, daklib.utils.re_no_epoch.sub('', version)))
+                directory = Cnf["Dir::PoolRoot"] + utils.poolify(package, component)
+                dsc_file = os.path.join(Cnf["Dir::Root"], directory, "%s_%s.dsc" % (package, utils.re_no_epoch.sub('', version)))
         if not os.path.exists(dsc_file):
-            daklib.utils.fubar("%s not found." % (dsc_file))
+            utils.fubar("%s not found." % (dsc_file))
         install_date = time.strftime("%Y-%m-%d", time.localtime(os.path.getmtime(dsc_file)))
         fingerprint = check_signature(dsc_file)
-        fingerprint_id = daklib.database.get_or_set_fingerprint_id(fingerprint)
+        fingerprint_id = database.get_or_set_fingerprint_id(fingerprint)
         if reject_message:
-            daklib.utils.fubar("%s: %s" % (dsc_file, reject_message))
+            utils.fubar("%s: %s" % (dsc_file, reject_message))
         maintainer = Scanner.Section["maintainer"]
         maintainer = maintainer.replace("'", "\\'")
-        maintainer_id = daklib.database.get_or_set_maintainer_id(maintainer)
+        maintainer_id = database.get_or_set_maintainer_id(maintainer)
         location = get_location_path(directory.split('/')[0])
-        location_id = daklib.database.get_location_id (location, component, archive)
+        location_id = database.get_location_id (location, component, archive)
         if not directory.endswith("/"):
             directory += '/'
         directory = poolify (directory, location)
         if directory != "" and not directory.endswith("/"):
             directory += '/'
-        no_epoch_version = daklib.utils.re_no_epoch.sub('', version)
+        no_epoch_version = utils.re_no_epoch.sub('', version)
         # Add all files referenced by the .dsc to the files table
         ids = []
         for line in Scanner.Section["files"].split('\n'):
@@ -403,11 +403,11 @@ def process_packages (filename, suite, component, archive):
     count_total = 0
     count_bad = 0
     suite = suite.lower()
-    suite_id = daklib.database.get_suite_id(suite)
+    suite_id = database.get_suite_id(suite)
     try:
-        file = daklib.utils.open_file (filename)
-    except daklib.utils.cant_open_exc:
-        daklib.utils.warn("can't open '%s'" % (filename))
+        file = utils.open_file (filename)
+    except utils.cant_open_exc:
+        utils.warn("can't open '%s'" % (filename))
         return
     Scanner = apt_pkg.ParseTagFile(file)
     while Scanner.Step() != 0:
@@ -415,25 +415,25 @@ def process_packages (filename, suite, component, archive):
         version = Scanner.Section["version"]
         maintainer = Scanner.Section["maintainer"]
         maintainer = maintainer.replace("'", "\\'")
-        maintainer_id = daklib.database.get_or_set_maintainer_id(maintainer)
+        maintainer_id = database.get_or_set_maintainer_id(maintainer)
         architecture = Scanner.Section["architecture"]
-        architecture_id = daklib.database.get_architecture_id (architecture)
+        architecture_id = database.get_architecture_id (architecture)
         fingerprint = "NOSIG"
-        fingerprint_id = daklib.database.get_or_set_fingerprint_id(fingerprint)
+        fingerprint_id = database.get_or_set_fingerprint_id(fingerprint)
         if not Scanner.Section.has_key("source"):
             source = package
         else:
             source = Scanner.Section["source"]
         source_version = ""
         if source.find("(") != -1:
-            m = daklib.utils.re_extract_src_version.match(source)
+            m = utils.re_extract_src_version.match(source)
             source = m.group(1)
             source_version = m.group(2)
         if not source_version:
             source_version = version
         filename = Scanner.Section["filename"]
         location = get_location_path(filename.split('/')[0])
-        location_id = daklib.database.get_location_id (location, component, archive)
+        location_id = database.get_location_id (location, component, archive)
         filename = poolify (filename, location)
         if architecture == "all":
             filename = re_arch_from_filename.sub("binary-all", filename)
@@ -473,10 +473,10 @@ def process_packages (filename, suite, component, archive):
 ###############################################################################
 
 def do_sources(sources, suite, component, server):
-    temp_filename = daklib.utils.temp_filename()
+    temp_filename = utils.temp_filename()
     (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (sources, temp_filename))
     if (result != 0):
-        daklib.utils.fubar("Gunzip invocation failed!\n%s" % (output), result)
+        utils.fubar("Gunzip invocation failed!\n%s" % (output), result)
     print 'Processing '+sources+'...'
     process_sources (temp_filename, suite, component, server)
     os.unlink(temp_filename)
@@ -486,7 +486,7 @@ def do_sources(sources, suite, component, server):
 def do_da_do_da ():
     global Cnf, projectB, query_cache, files_query_cache, source_query_cache, src_associations_query_cache, dsc_files_query_cache, bin_associations_query_cache, binaries_query_cache
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
     Arguments = [('a', "action", "Import-Archive::Options::Action"),
                  ('h', "help", "Import-Archive::Options::Help")]
     for i in [ "action", "help" ]:
@@ -500,7 +500,7 @@ def do_da_do_da ():
         usage()
 
     if not Options["Action"]:
-        daklib.utils.warn("""no -a/--action given; not doing anything.
+        utils.warn("""no -a/--action given; not doing anything.
 Please read the documentation before running this script.
 """)
         usage(1)
@@ -508,12 +508,12 @@ Please read the documentation before running this script.
     print "Re-Creating DB..."
     (result, output) = commands.getstatusoutput("psql -f init_pool.sql template1")
     if (result != 0):
-        daklib.utils.fubar("psql invocation failed!\n", result)
+        utils.fubar("psql invocation failed!\n", result)
     print output
 
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
 
-    daklib.database.init (Cnf, projectB)
+    database.init (Cnf, projectB)
 
     print "Adding static tables from conf file..."
     projectB.query("BEGIN WORK")
@@ -527,12 +527,12 @@ Please read the documentation before running this script.
     update_section()
     projectB.query("COMMIT WORK")
 
-    files_query_cache = daklib.utils.open_file(Cnf["Import-Archive::ExportDir"]+"files","w")
-    source_query_cache = daklib.utils.open_file(Cnf["Import-Archive::ExportDir"]+"source","w")
-    src_associations_query_cache = daklib.utils.open_file(Cnf["Import-Archive::ExportDir"]+"src_associations","w")
-    dsc_files_query_cache = daklib.utils.open_file(Cnf["Import-Archive::ExportDir"]+"dsc_files","w")
-    binaries_query_cache = daklib.utils.open_file(Cnf["Import-Archive::ExportDir"]+"binaries","w")
-    bin_associations_query_cache = daklib.utils.open_file(Cnf["Import-Archive::ExportDir"]+"bin_associations","w")
+    files_query_cache = utils.open_file(Cnf["Import-Archive::ExportDir"]+"files","w")
+    source_query_cache = utils.open_file(Cnf["Import-Archive::ExportDir"]+"source","w")
+    src_associations_query_cache = utils.open_file(Cnf["Import-Archive::ExportDir"]+"src_associations","w")
+    dsc_files_query_cache = utils.open_file(Cnf["Import-Archive::ExportDir"]+"dsc_files","w")
+    binaries_query_cache = utils.open_file(Cnf["Import-Archive::ExportDir"]+"binaries","w")
+    bin_associations_query_cache = utils.open_file(Cnf["Import-Archive::ExportDir"]+"bin_associations","w")
 
     projectB.query("BEGIN WORK")
     # Process Sources files to popoulate `source' and friends
@@ -550,7 +550,7 @@ Please read the documentation before running this script.
                     sources = Cnf["Dir::Root"] + "dists/" + Cnf["Suite::%s::CodeName" % (suite)] + '/' + component + '/source/' + 'Sources.gz'
                     do_sources(sources, suite, component, server)
         else:
-            daklib.utils.fubar("Unknown location type ('%s')." % (type))
+            utils.fubar("Unknown location type ('%s')." % (type))
 
     # Process Packages files to populate `binaries' and friends
 
@@ -566,7 +566,7 @@ Please read the documentation before running this script.
         elif type == "legacy" or type == "pool":
             for suite in Cnf.ValueList("Location::%s::Suites" % (location)):
                 for component in Cnf.SubTree("Component").List():
-                    architectures = filter(daklib.utils.real_arch,
+                    architectures = filter(utils.real_arch,
                                            Cnf.ValueList("Suite::%s::Architectures" % (suite)))
                     for architecture in architectures:
                         packages = Cnf["Dir::Root"] + "dists/" + Cnf["Suite::%s::CodeName" % (suite)] + '/' + component + '/binary-' + architecture + '/Packages'
@@ -601,14 +601,14 @@ Please read the documentation before running this script.
     (result, output) = commands.getstatusoutput("psql %s < add_constraints.sql" % (Cnf["DB::Name"]))
     print output
     if (result != 0):
-        daklib.utils.fubar("psql invocation failed!\n%s" % (output), result)
+        utils.fubar("psql invocation failed!\n%s" % (output), result)
 
     return
 
 ################################################################################
 
 def main():
-    daklib.utils.try_with_debug(do_da_do_da)
+    utils.try_with_debug(do_da_do_da)
 
 ################################################################################