- for id in all_sources.keys():
- if not linked_sources.has_key(id):
- # Is this a known source-only package?
- if in_override_p(all_sources_package[id]):
- continue;
- # Then check to see if the source is still in any suites
- untouchable = 0;
- q = projectB.query("SELECT su.suite_name FROM src_associations sa, suite su WHERE sa.source = %s and su.id = sa.suite" % (id));
- for i in q.getresult():
- if Cnf.Find("Suite::%s::Untouchable" % (i[0])):
- untouchable = 1;
- else:
- if not Cnf["Rhona::Options::No-Action"]:
- projectB.query("DELETE FROM src_associations WHERE source = %s" % (id));
-
- # We can't delete binary-less source-only packages if
- # they're in an untouchable suite (i.e. stable)...
- if untouchable:
- continue;
-
- projectB.query("UPDATE files SET last_used = '%s' WHERE id = %s" % (delete_date, all_sources[id]))
- # Delete all other files references by .dsc too if they're not used by anyone else
- q = projectB.query("SELECT f.id FROM files f, dsc_files d WHERE d.source = %d AND d.file = f.id" % (id));
- for i in q.getresult():
- q = projectB.query("SELECT id FROM dsc_files d WHERE file = %s" % (i[0]));
- ql = q.getresult();
- if len(ql) == 1:
- projectB.query("UPDATE files SET last_used = '%s' WHERE id = %s" % (delete_date, i[0]));
-
- # If the file is used by another source package
- # (e.g. because it's an .orig.tar.gz) We need to delete
- # this source package's reference to it from dsc_files.
- # So just clear out all references to the source file in
- # dsc_files now.
- if not Cnf["Rhona::Options::No-Action"]:
- projectB.query("DELETE FROM dsc_files WHERE source = %s" % (id));
-
- projectB.query("COMMIT WORK");
-
- # Check for any sources which are marked for eventual deletion but are now used again.
- all_marked_sources = {};
- q = projectB.query("SELECT s.id, s.file FROM source s, files f WHERE f.last_used IS NOT NULL AND f.id = s.file");
- ql = q.getresult();