From 1a4282b11d64ee88f5cbc49a0394c0b5f6767853 Mon Sep 17 00:00:00 2001 From: Frank Lichtenheld Date: Tue, 27 Oct 2009 15:02:18 +0000 Subject: [PATCH] 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 --- dak/clean_suites.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dak/clean_suites.py b/dak/clean_suites.py index 3513d912..8f68907a 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"]: session.commit() -- 2.39.5