]> git.decadent.org.uk Git - dak.git/blobdiff - dak/cruft_report.py
import dak.lib.foo as foo for library modules.
[dak.git] / dak / cruft_report.py
index 803a77527a48562c70d41e17a62ec6d6c424ac35..91b3844a1596d6dd8cf65911b4de91a32b7d9583 100755 (executable)
@@ -1,8 +1,7 @@
 #!/usr/bin/env python
 
 # Check for obsolete binary packages
-# Copyright (C) 2000, 2001, 2002, 2003, 2004  James Troup <james@nocrew.org>
-# $Id: rene,v 1.23 2005-04-16 09:19:20 rmurray Exp $
+# Copyright (C) 2000, 2001, 2002, 2003, 2004, 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
@@ -29,8 +28,9 @@
 ################################################################################
 
 import commands, pg, os, string, sys, time
-import utils, db_access
 import apt_pkg
+import dak.lib.database as database
+import dak.lib.utils as utils
 
 ################################################################################
 
@@ -45,7 +45,7 @@ source_versions = {}
 ################################################################################
 
 def usage(exit_code=0):
-    print """Usage: rene
+    print """Usage: dak cruft-report
 Check for obsolete or duplicated packages.
 
   -h, --help                show this help and exit.
@@ -116,7 +116,7 @@ def do_anais(architecture, binaries_list, source):
 ################################################################################
 
 def do_nviu():
-    experimental_id = db_access.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
@@ -126,7 +126,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,
-                                                   db_access.get_suite_id("unstable")))
+                                                   database.get_suite_id("unstable")))
     ql = q.getresult()
     if ql:
         nviu_to_remove = []
@@ -139,7 +139,7 @@ SELECT s.source, s.version AS experimental, s2.version AS unstable
             nviu_to_remove.append(source)
         print
         print "Suggested command:"
-        print " melanie -m \"[rene] NVIU\" -s experimental %s" % (" ".join(nviu_to_remove))
+        print " dak rm -m \"[auto-cruft] NVIU\" -s experimental %s" % (" ".join(nviu_to_remove))
         print
 
 ################################################################################
@@ -171,7 +171,7 @@ def do_nbs(real_nbs):
         print output
 
         print "Suggested command:"
-        print " melanie -m \"[rene] NBS\" -b %s" % (" ".join(nbs_to_remove))
+        print " dak rm -m \"[auto-cruft] NBS\" -b %s" % (" ".join(nbs_to_remove))
         print
 
 ################################################################################
@@ -239,7 +239,7 @@ def do_obsolete_source(duplicate_bins, bin2source):
         print output
 
         print "Suggested command:"
-        print " melanie -S -p -m \"[rene] obsolete source package\" %s" % (" ".join(to_remove))
+        print " dak rm -S -p -m \"[auto-cruft] obsolete source package\" %s" % (" ".join(to_remove))
         print
 
 ################################################################################
@@ -249,20 +249,20 @@ def main ():
 
     Cnf = utils.get_conf()
 
-    Arguments = [('h',"help","Rene::Options::Help"),
-                 ('m',"mode","Rene::Options::Mode", "HasArg"),
-                 ('s',"suite","Rene::Options::Suite","HasArg")]
+    Arguments = [('h',"help","Cruft-Report::Options::Help"),
+                 ('m',"mode","Cruft-Report::Options::Mode", "HasArg"),
+                 ('s',"suite","Cruft-Report::Options::Suite","HasArg")]
     for i in [ "help" ]:
-       if not Cnf.has_key("Rene::Options::%s" % (i)):
-           Cnf["Rene::Options::%s" % (i)] = ""
-    Cnf["Rene::Options::Suite"] = Cnf["Dinstall::DefaultSuite"]
+       if not Cnf.has_key("Cruft-Report::Options::%s" % (i)):
+           Cnf["Cruft-Report::Options::%s" % (i)] = ""
+    Cnf["Cruft-Report::Options::Suite"] = Cnf["Dinstall::DefaultSuite"]
 
-    if not Cnf.has_key("Rene::Options::Mode"):
-        Cnf["Rene::Options::Mode"] = "daily"
+    if not Cnf.has_key("Cruft-Report::Options::Mode"):
+        Cnf["Cruft-Report::Options::Mode"] = "daily"
 
     apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv)
 
-    Options = Cnf.SubTree("Rene::Options")
+    Options = Cnf.SubTree("Cruft-Report::Options")
     if Options["Help"]:
        usage()
 
@@ -276,7 +276,7 @@ def main ():
         usage(1)
 
     projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"]))
-    db_access.init(Cnf, projectB)
+    database.init(Cnf, projectB)
 
     bin_pkgs = {}
     src_pkgs = {}
@@ -289,7 +289,7 @@ def main ():
     duplicate_bins = {}
 
     suite = Options["Suite"]
-    suite_id = db_access.get_suite_id(suite)
+    suite_id = database.get_suite_id(suite)
 
     bin_not_built = {}