]> err.no Git - dak/commitdiff
clean-suites: Fix logic error in during source cleaning
authorFrank Lichtenheld <djpig@debian.org>
Tue, 27 Oct 2009 15:02:18 +0000 (15:02 +0000)
committerFrank Lichtenheld <djpig@debian.org>
Tue, 27 Oct 2009 15:06:04 +0000 (15:06 +0000)
We need to remove all the entries in dsc_files(sic) for a given
source before we can remove the source.

Signed-off-by: Frank Lichtenheld <djpig@debian.org>
dak/clean_suites.py

index 3513d9122f8a3e2bc5d83f343bfde337fd5cbc3a..8f68907a0f5c9be83440fd2ec34021d9df5e8e37 100755 (executable)
@@ -209,14 +209,14 @@ def clean(now_date, delete_date, max_delete, session):
     # Delete from source
     print "Deleting from source table... "
     q = session.execute("""
-SELECT df.id, s.id, f.filename FROM source s, files f, dsc_files df
+SELECT s.id, f.filename FROM source s, files f
   WHERE f.last_used <= :deletedate
-        AND s.file = f.id AND s.id = df.source""", {'deletedate': delete_date})
+        AND s.file = f.id""", {'deletedate': delete_date})
     for s in q.fetchall():
-        Logger.log(["delete source", s[2]])
+        Logger.log(["delete source", s[1], s[0]])
         if not Options["No-Action"]:
-            session.execute("DELETE FROM dsc_files WHERE id = :dsc_id", {"dscid":s[0]})
-            session.execute("DELETE FROM source WHERE id = :s_id", {"s_id":s[1]})
+            session.execute("DELETE FROM dsc_files WHERE source = :s_id", {"s_id":s[0]})
+            session.execute("DELETE FROM source WHERE id = :s_id", {"s_id":s[0]})
 
     if not Options["No-Action"]:
         session.commit()