[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master 6/7] clean-suites: Fix logic error in during source cleaning

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 |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/dak/clean_suites.py b/dak/clean_suites.py
index 3513d91..8f68907 100755
--- a/dak/clean_suites.py
+++ b/dak/clean_suites.py
@@ -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"]:

Reply to: