]> git.decadent.org.uk Git - dak.git/blobdiff - dak/clean_queues.py
Merge commit 'godog/master' into merge
[dak.git] / dak / clean_queues.py
old mode 100644 (file)
new mode 100755 (executable)
index 178c1ac..34d9047
@@ -1,6 +1,6 @@
 #!/usr/bin/env python
 
-# Clean incoming of old unused files
+""" Clean incoming of old unused files """
 # Copyright (C) 2000, 2001, 2002, 2006  James Troup <james@nocrew.org>
 
 # This program is free software; you can redistribute it and/or modify
@@ -35,7 +35,7 @@
 
 import os, stat, sys, time
 import apt_pkg
-import daklib.utils
+from daklib import utils
 
 ################################################################################
 
@@ -72,7 +72,7 @@ def init ():
         if not os.path.exists(del_dir):
             os.makedirs(del_dir, 02775)
         if not os.path.isdir(del_dir):
-            daklib.utils.fubar("%s must be a directory." % (del_dir))
+            utils.fubar("%s must be a directory." % (del_dir))
 
     # Move to the directory to clean
     incoming = Options["Incoming"]
@@ -86,10 +86,10 @@ def remove (f):
         dest_filename = del_dir + '/' + os.path.basename(f)
         # 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, 10)
-        daklib.utils.move(f, dest_filename, 0660)
+            dest_filename = utils.find_next_free(dest_filename, 10)
+        utils.move(f, dest_filename, 0660)
     else:
-        daklib.utils.warn("skipping '%s', permission denied." % (os.path.basename(f)))
+        utils.warn("skipping '%s', permission denied." % (os.path.basename(f)))
 
 # Removes any old files.
 # [Used for Incoming/REJECT]
@@ -125,20 +125,20 @@ def flush_orphans ():
     # Proces all .changes and .dsc files.
     for changes_filename in changes_files:
         try:
-            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)
         except:
-            daklib.utils.warn("error processing '%s'; skipping it. [Got %s]" % (changes_filename, sys.exc_type))
+            utils.warn("error processing '%s'; skipping it. [Got %s]" % (changes_filename, sys.exc_type))
             continue
 
         dsc_files = {}
         for f in files.keys():
             if f.endswith(".dsc"):
                 try:
-                    dsc = daklib.utils.parse_changes(f)
-                    dsc_files = daklib.utils.build_file_list(dsc, is_a_dsc=1)
+                    dsc = utils.parse_changes(f)
+                    dsc_files = utils.build_file_list(dsc, is_a_dsc=1)
                 except:
-                    daklib.utils.warn("error processing '%s'; skipping it. [Got %s]" % (f, sys.exc_type))
+                    utils.warn("error processing '%s'; skipping it. [Got %s]" % (f, sys.exc_type))
                     continue
 
         # Ensure all the files we've seen aren't deleted
@@ -170,7 +170,7 @@ def flush_orphans ():
 def main ():
     global Cnf, Options
 
-    Cnf = daklib.utils.get_conf()
+    Cnf = utils.get_conf()
 
     for i in ["Help", "Incoming", "No-Action", "Verbose" ]:
         if not Cnf.has_key("Clean-Queues::Options::%s" % (i)):