]> git.decadent.org.uk Git - dak.git/blobdiff - dak/override.py
stop using deprecated python-apt functions
[dak.git] / dak / override.py
index 75edbb580f88d11cef0e5022821b41c023c42a76..ce5d12ff41348c1f4c929fd7f5374554eafd13e3 100755 (executable)
@@ -49,7 +49,7 @@ def usage (exit_code=0):
 Make microchanges or microqueries of the binary overrides
 
   -h, --help                 show this help and exit
-  -c, --check                chech override compliance
+  -c, --check                check override compliance
   -d, --done=BUG#            send priority/section change as closure to bug#
   -n, --no-action            don't do anything
   -s, --suite                specify the suite to use
@@ -61,7 +61,7 @@ def check_override_compliance(package, priority, suite, cnf, session):
 
     depends = set()
     rdepends = set()
-    components = cnf.ValueList("Suite::%s::Components" % suite)
+    components = get_component_names(session)
     arches = set([x.arch_string for x in get_suite_architectures(suite)])
     arches -= set(["source", "all"])
     for arch in arches:
@@ -124,8 +124,8 @@ def main ():
     if not cnf.has_key("Override::Options::Suite"):
         cnf["Override::Options::Suite"] = "unstable"
 
-    arguments = apt_pkg.ParseCommandLine(cnf.Cnf, Arguments, sys.argv)
-    Options = cnf.SubTree("Override::Options")
+    arguments = apt_pkg.parse_commandline(cnf.Cnf, Arguments, sys.argv)
+    Options = cnf.subtree("Override::Options")
 
     if Options["Help"]:
         usage()
@@ -254,7 +254,7 @@ def main ():
 
     game_over()
 
-    Logger = daklog.Logger(cnf.Cnf, "override")
+    Logger = daklog.Logger("override")
 
     dsc_otype_id = get_override_type('dsc').overridetype_id
 
@@ -286,17 +286,25 @@ def main ():
     session.commit()
 
     if Options.has_key("Done"):
+        if not cnf.has_key("Dinstall::BugServer"):
+            utils.warn("Asked to send Done message but Dinstall::BugServer is not configured")
+            Logger.close()
+            return
+
         Subst = {}
         Subst["__OVERRIDE_ADDRESS__"] = cnf["Dinstall::MyEmailAddress"]
         Subst["__BUG_SERVER__"] = cnf["Dinstall::BugServer"]
         bcc = []
-        if cnf.Find("Dinstall::Bcc") != "":
+        if cnf.find("Dinstall::Bcc") != "":
             bcc.append(cnf["Dinstall::Bcc"])
         if bcc:
             Subst["__BCC__"] = "Bcc: " + ", ".join(bcc)
         else:
             Subst["__BCC__"] = "X-Filler: 42"
-        Subst["__CC__"] = "Cc: " + package + "@" + cnf["Dinstall::PackagesServer"] + "\nX-DAK: dak override"
+        if cnf.has_key("Dinstall::PackagesServer"):
+            Subst["__CC__"] = "Cc: " + package + "@" + cnf["Dinstall::PackagesServer"] + "\nX-DAK: dak override"
+        else:
+            Subst["__CC__"] = "X-DAK: dak override"
         Subst["__ADMIN_ADDRESS__"] = cnf["Dinstall::MyAdminAddress"]
         Subst["__DISTRO__"] = cnf["Dinstall::MyDistribution"]
         Subst["__WHOAMI__"] = utils.whoami()