From: Joerg Jaspert Date: Sat, 3 May 2008 23:29:57 +0000 (+0200) Subject: Cleanup X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0cceee443e7e56bb4255964f5ac22d7edddabb62;p=dak Cleanup --- diff --git a/ChangeLog b/ChangeLog index b5c129b0..55da6678 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ "import daklib.foo as foo" * dak/clean_proposed_updates.py: likewise * dak/clean_queues.py: likewise + * dak/clean_suites.py: likewise * dak/check_archive.py (check_files_not_symlinks): Remove long-time unused and commented code. Import stuff from daklib as diff --git a/dak/clean_suites.py b/dak/clean_suites.py old mode 100644 new mode 100755 index cb7225b9..f459cdda --- a/dak/clean_suites.py +++ b/dak/clean_suites.py @@ -30,7 +30,7 @@ import os, pg, stat, sys, time import apt_pkg -import daklib.utils +import daklib.utils as utils ################################################################################ @@ -208,7 +208,7 @@ def clean(): for i in q.getresult(): filename = i[0] + i[1] if not os.path.exists(filename): - daklib.utils.warn("can not find '%s'." % (filename)) + utils.warn("can not find '%s'." % (filename)) continue if os.path.isfile(filename): if os.path.islink(filename): @@ -224,14 +224,14 @@ def clean(): dest_filename = dest + '/' + os.path.basename(filename) # 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) + dest_filename = utils.find_next_free(dest_filename) if Options["No-Action"]: print "Cleaning %s -> %s ..." % (filename, dest_filename) else: - daklib.utils.move(filename, dest_filename) + utils.move(filename, dest_filename) else: - daklib.utils.fubar("%s is neither symlink nor file?!" % (filename)) + utils.fubar("%s is neither symlink nor file?!" % (filename)) # Delete from the 'files' table if not Options["No-Action"]: @@ -240,7 +240,7 @@ def clean(): projectB.query("DELETE FROM files WHERE last_used <= '%s'" % (delete_date)) sys.stdout.write("done. (%d seconds)]\n" % (int(time.time()-before))) if count > 0: - sys.stderr.write("Cleaned %d files, %s.\n" % (count, daklib.utils.size_type(size))) + sys.stderr.write("Cleaned %d files, %s.\n" % (count, utils.size_type(size))) ################################################################################ @@ -307,10 +307,10 @@ def clean_queue_build(): for i in q.getresult(): filename = i[0] if not os.path.exists(filename): - daklib.utils.warn("%s (from queue_build) doesn't exist." % (filename)) + utils.warn("%s (from queue_build) doesn't exist." % (filename)) continue if not Cnf.FindB("Dinstall::SecurityQueueBuild") and not os.path.islink(filename): - daklib.utils.fubar("%s (from queue_build) should be a symlink but isn't." % (filename)) + utils.fubar("%s (from queue_build) should be a symlink but isn't." % (filename)) os.unlink(filename) count += 1 projectB.query("DELETE FROM queue_build WHERE last_used <= '%s'" % (our_delete_date)) @@ -323,7 +323,7 @@ def clean_queue_build(): def main(): global Cnf, Options, projectB, delete_date, now_date - Cnf = daklib.utils.get_conf() + Cnf = utils.get_conf() for i in ["Help", "No-Action" ]: if not Cnf.has_key("Clean-Suites::Options::%s" % (i)): Cnf["Clean-Suites::Options::%s" % (i)] = ""