From 9b148ca41affcfac7ed081804550595ab9d96b48 Mon Sep 17 00:00:00 2001 From: Luca Falavigna Date: Tue, 22 Jun 2010 08:02:30 +0000 Subject: [PATCH] Fix do_newer_version package detection If projectb stores more than one version of a given source package, cruft-report erroneously takes the lower one, and this sometimes leads to wrong removals. Instruct cruft-report to take the highest version. Signed-off-by: Luca Falavigna --- dak/cruft_report.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dak/cruft_report.py b/dak/cruft_report.py index b9ddf5f7..ee1dcdef 100755 --- a/dak/cruft_report.py +++ b/dak/cruft_report.py @@ -198,10 +198,14 @@ def do_newer_version(lowersuite_name, highersuite_name, code, session): # Check for packages in $highersuite obsoleted by versions in $lowersuite q = session.execute(""" +WITH highersuite_maxversion AS (SELECT s.source AS source, max(s.version) AS version + FROM src_associations sa, source s + WHERE sa.suite = :highersuite_id AND sa.source = s.id group by s.source) SELECT s.source, s.version AS lower, s2.version AS higher - FROM src_associations sa, source s, source s2, src_associations sa2 + FROM src_associations sa, source s, source s2, src_associations sa2, highersuite_maxversion hm WHERE sa.suite = :highersuite_id AND sa2.suite = :lowersuite_id AND sa.source = s.id AND sa2.source = s2.id AND s.source = s2.source + AND hm.source = s.source AND hm.version < s2.version AND s.version < s2.version""", {'lowersuite_id': lowersuite.suite_id, 'highersuite_id': highersuite.suite_id}) ql = q.fetchall() -- 2.39.5