]> git.decadent.org.uk Git - dak.git/blobdiff - dak/examine_package.py
Enmasse adaptation for removal of silly names.
[dak.git] / dak / examine_package.py
index 1f4633a9a94e8076b07fa1dac116838274f26dc1..1749bb20a95038bbcede981ace19c7c50cfaf1a8 100755 (executable)
@@ -1,8 +1,7 @@
 #!/usr/bin/env python
 
 # Script to automate some parts of checking NEW packages
-# Copyright (C) 2000, 2001, 2002, 2003  James Troup <james@nocrew.org>
-# $Id: fernanda.py,v 1.10 2003-11-10 23:01:17 troup Exp $
+# Copyright (C) 2000, 2001, 2002, 2003, 2006  James Troup <james@nocrew.org>
 
 # 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
@@ -34,9 +33,9 @@
 ################################################################################
 
 import errno, os, re, sys
-import utils
+import dak.lib.utils
 import apt_pkg, apt_inst
-import pg, db_access
+import pg, dak.lib.database
 
 ################################################################################
 
@@ -80,14 +79,14 @@ maintainer_colour = arch_colour
 Cnf = None
 projectB = None
 
-Cnf = utils.get_conf()
+Cnf = dak.lib.utils.get_conf()
 projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
-db_access.init(Cnf, projectB)
+dak.lib.database.init(Cnf, projectB)
 
 ################################################################################
 
 def usage (exit_code=0):
-    print """Usage: fernanda [PACKAGE]...
+    print """Usage: dak examine-package [PACKAGE]...
 Check NEW package(s).
 
   -h, --help                 show this help and exit
@@ -145,7 +144,7 @@ def read_control (filename):
     maintainer = ''
     arch = ''
 
-    deb_file = utils.open_file(filename)
+    deb_file = dak.lib.utils.open_file(filename)
     try:
        extracts = apt_inst.debExtractControl(deb_file)
        control = apt_pkg.ParseSection(extracts)
@@ -196,9 +195,9 @@ def read_control (filename):
 def read_dsc (dsc_filename):
     dsc = {}
 
-    dsc_file = utils.open_file(dsc_filename)
+    dsc_file = dak.lib.utils.open_file(dsc_filename)
     try:
-       dsc = utils.parse_changes(dsc_filename)
+       dsc = dak.lib.utils.parse_changes(dsc_filename)
     except:
        print "can't parse control info"
     dsc_file.close()
@@ -347,7 +346,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 = utils.open_file (filename)
+    file = dak.lib.utils.open_file (filename)
     contents = ""
     inside_signature = 0
     skip_next = 0
@@ -380,8 +379,8 @@ def display_changes (changes_filename):
 def check_changes (changes_filename):
     display_changes(changes_filename)
 
-    changes = utils.parse_changes (changes_filename)
-    files = utils.build_file_list(changes)
+    changes = dak.lib.utils.parse_changes (changes_filename)
+    files = dak.lib.utils.build_file_list(changes)
     for file in files.keys():
        if file.endswith(".deb") or file.endswith(".udeb"):
            check_deb(file)
@@ -392,15 +391,15 @@ def check_changes (changes_filename):
 def main ():
     global Cnf, projectB, db_files, waste, excluded
 
-#    Cnf = utils.get_conf()
+#    Cnf = dak.lib.utils.get_conf()
 
-    Arguments = [('h',"help","Fernanda::Options::Help")]
+    Arguments = [('h',"help","Examine-Package::Options::Help")]
     for i in [ "help" ]:
        if not Cnf.has_key("Frenanda::Options::%s" % (i)):
-           Cnf["Fernanda::Options::%s" % (i)] = ""
+           Cnf["Examine-Package::Options::%s" % (i)] = ""
 
     args = apt_pkg.ParseCommandLine(Cnf,Arguments,sys.argv)
-    Options = Cnf.SubTree("Fernanda::Options")
+    Options = Cnf.SubTree("Examine-Package::Options")
 
     if Options["Help"]:
        usage()
@@ -422,19 +421,19 @@ def main ():
                 elif file.endswith(".dsc"):
                     check_dsc(file)
                 else:
-                    utils.fubar("Unrecognised file type: '%s'." % (file))
+                    dak.lib.utils.fubar("Unrecognised file type: '%s'." % (file))
             finally:
                 # Reset stdout here so future less invocations aren't FUBAR
                 less_fd.close()
                 sys.stdout = stdout_fd
         except IOError, e:
             if errno.errorcode[e.errno] == 'EPIPE':
-                utils.warn("[fernanda] Caught EPIPE; skipping.")
+                dak.lib.utils.warn("[examine-package] Caught EPIPE; skipping.")
                 pass
             else:
                 raise
         except KeyboardInterrupt:
-            utils.warn("[fernanda] Caught C-c; skipping.")
+            dak.lib.utils.warn("[examine-package] Caught C-c; skipping.")
             pass
 
 #######################################################################################