]> git.decadent.org.uk Git - dak.git/blobdiff - dak/rm.py
Revert "Merge commit 'stew/content_generation' into merge"
[dak.git] / dak / rm.py
index 350cd1ead94be0812d498dc1551f6066632c899b..903e138e8929e1f6aec25e2518f9f5adde58eb61 100755 (executable)
--- a/dak/rm.py
+++ b/dak/rm.py
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# General purpose package removal tool for ftpmaster
+""" General purpose package removal tool for ftpmaster """
 # 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
@@ -44,11 +44,7 @@ import apt_pkg, apt_inst
 from daklib import database
 from daklib import utils
 from daklib.dak_exceptions import *
-
-################################################################################
-
-re_strip_source_version = re.compile (r'\s+.*$')
-re_build_dep_arch = re.compile(r"\[[^]]+\]")
+from daklib.regexes import re_strip_source_version, re_build_dep_arch
 
 ################################################################################
 
@@ -104,7 +100,7 @@ def reverse_depends_check(removals, suites, arches=None):
     if arches:
         all_arches = set(arches)
     else:
-        all_arches = set(Cnf.ValueList("Suite::%s::Architectures" % suites[0]))
+        all_arches = set(database.get_suite_architectures(suites[0]))
     all_arches -= set(["source", "all"])
     for architecture in all_arches:
         deps = {}
@@ -113,7 +109,7 @@ def reverse_depends_check(removals, suites, arches=None):
         for component in components:
             filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (Cnf["Dir::Root"], suites[0], component, architecture)
             # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-            temp_filename = utils.temp_filename()
+            (fd, temp_filename) = utils.temp_filename()
             (result, output) = commands.getstatusoutput("gunzip -c %s > %s" % (filename, temp_filename))
             if (result != 0):
                 utils.fubar("Gunzip invocation failed!\n%s\n" % (output), result)
@@ -198,7 +194,7 @@ def reverse_depends_check(removals, suites, arches=None):
     for component in components:
         filename = "%s/dists/%s/%s/source/Sources.gz" % (Cnf["Dir::Root"], suites[0], component)
         # apt_pkg.ParseTagFile needs a real file handle and can't handle a GzipFile instance...
-        temp_filename = utils.temp_filename()
+        (fd, 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))
@@ -425,7 +421,7 @@ def main ():
     # If we don't have a reason; spawn an editor so the user can add one
     # Write the rejection email out as the <foo>.reason file
     if not Options["Reason"] and not Options["No-Action"]:
-        temp_filename = utils.temp_filename()
+        (fd, temp_filename) = utils.temp_filename()
         editor = os.environ.get("EDITOR","vi")
         result = os.system("%s %s" % (editor, temp_filename))
         if result != 0: