From: Frank Lichtenheld Date: Tue, 27 Oct 2009 15:02:18 +0000 (+0000) Subject: clean-suites: Fix logic error in during source cleaning X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1a4282b11d64ee88f5cbc49a0394c0b5f6767853;p=dak 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 --- 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()