+ if count > 0:
+ sys.stderr.write("Cleared out %d fingerprint entries.\n" % (count));
+
+################################################################################
+
+def clean_queue_build():
+ global now_date;
+
+ if not Cnf.ValueList("Dinstall::QueueBuildSuites") or Options["No-Action"]:
+ return;
+
+ print "Cleaning out queue build symlinks..."
+
+ our_delete_date = time.strftime("%Y-%m-%d %H:%M", time.localtime(time.time()-int(Cnf["Rhona::QueueBuildStayOfExecution"])));
+ count = 0;
+
+ q = projectB.query("SELECT filename FROM queue_build WHERE last_used <= '%s'" % (our_delete_date));
+ for i in q.getresult():
+ filename = i[0];
+ if not os.path.exists(filename):
+ utils.warn("%s (from queue_build) doesn't exist." % (filename));
+ continue;
+ if not Cnf.FindB("Dinstall::SecurityQueueBuild") and not os.path.islink(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));
+
+ if count:
+ sys.stderr.write("Cleaned %d queue_build files.\n" % (count));
+
+################################################################################
+
+def main():
+ global Cnf, Options, projectB, delete_date, now_date;
+
+ Cnf = utils.get_conf()
+ for i in ["Help", "No-Action" ]:
+ if not Cnf.has_key("Rhona::Options::%s" % (i)):
+ Cnf["Rhona::Options::%s" % (i)] = "";