From: Mark Hymers Date: Mon, 26 Oct 2009 15:03:27 +0000 (+0000) Subject: hack around file hanging around forever X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=efa1b13e55848306d5e3b1f27d6c56a708d58f70;p=dak.git hack around file hanging around forever Signed-off-by: Mark Hymers --- diff --git a/dak/clean_suites.py b/dak/clean_suites.py index cf08ee19..d40f67ec 100755 --- a/dak/clean_suites.py +++ b/dak/clean_suites.py @@ -147,9 +147,11 @@ SELECT f.id FROM source s, files f, dsc_files df def check_files(now_date, delete_date, max_delete, session): # FIXME: this is evil; nothing should ever be in this state. if - # they are, it's a bug and the files should not be auto-deleted. - # XXX: In that case, remove the stupid return to later and actually - # *TELL* us rather than silently ignore it - mhy + # they are, it's a bug. + + # However, we've discovered it happens sometimes so we print a huge warning + # and then mark the file for deletion. This probably masks a bug somwhere + # else but is better than collecting cruft forever print "Checking for unused files..." q = session.execute(""" @@ -163,17 +165,10 @@ SELECT id, filename FROM files f print "WARNING: check_files found something it shouldn't" for x in ql: print x + session.execute("UPDATE files SET last_used = :lastused WHERE id = :fileid", + {'lastused': now_date, 'fileid': x[0]}) - # NOW return, the code below is left as an example of what was - # evidently done at some point in the past - return - -# for i in q.fetchall(): -# file_id = i[0] -# session.execute("UPDATE files SET last_used = :lastused WHERE id = :fileid", -# {'lastused': now_date, 'fileid': file_id}) -# -# session.commit() + session.commit() def clean_binaries(now_date, delete_date, max_delete, session): # We do this here so that the binaries we remove will have their