]> git.decadent.org.uk Git - dak.git/blobdiff - dak/clean_suites.py
Cope with empty queue
[dak.git] / dak / clean_suites.py
index c6a0a77761a2f429363a176d6f16e69909d777c0..5e41d372785a117e44c7ac0393afc085dc410601 100755 (executable)
@@ -254,7 +254,8 @@ def clean(now_date, delete_date, max_delete, session):
     q = session.execute("""
 SELECT s.id, f.filename FROM source s, files f
   WHERE f.last_used <= :deletedate
-        AND s.file = f.id""", {'deletedate': delete_date})
+        AND s.file = f.id
+        AND s.id NOT IN (SELECT src_id FROM extra_src_references)""", {'deletedate': delete_date})
     for s in q.fetchall():
         Logger.log(["delete source", s[1], s[0]])
         if not Options["No-Action"]:
@@ -425,7 +426,7 @@ def main():
     if Options["Help"]:
         usage()
 
-    Logger = daklog.Logger(cnf, "clean-suites", debug=Options["No-Action"])
+    Logger = daklog.Logger("clean-suites", debug=Options["No-Action"])
 
     session = DBConn().session()