From: Luca Falavigna Date: Sun, 21 Apr 2013 01:02:50 +0000 (+0000) Subject: Finds newer or equal versions in lowersuite_name X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=76b59a19769bc4468e528bb1e35623da2bc6ad5c;p=dak.git Finds newer or equal versions in lowersuite_name This is particularly useful when the same package has migrated to a different suite (e.g. t-p-u -> testing), so it is displayed in cruft-report to be manually removed. --- diff --git a/daklib/cruft.py b/daklib/cruft.py index f060085d..fc98eafb 100644 --- a/daklib/cruft.py +++ b/daklib/cruft.py @@ -28,10 +28,10 @@ from sqlalchemy.orm import object_session def newer_version(lowersuite_name, highersuite_name, session): ''' - Finds newer versions in lowersuite_name than in highersuite_name. Returns a - list of tuples (source, higherversion, lowerversion) where higherversion is - the newest version from highersuite_name and lowerversion is the newest - version from lowersuite_name. + Finds newer or equal versions in lowersuite_name than in highersuite_name. + Returns a list of tuples (source, higherversion, lowerversion) where + higherversion is the newest version from highersuite_name and lowerversion + is the newest version from lowersuite_name. ''' lowersuite = get_suite(lowersuite_name, session) @@ -43,7 +43,7 @@ def newer_version(lowersuite_name, highersuite_name, session): list = [] for (source, higherversion) in query: lowerversion = session.query(func.max(DBSource.version)). \ - filter_by(source = source).filter(DBSource.version > higherversion). \ + filter_by(source = source).filter(DBSource.version >= higherversion). \ with_parent(lowersuite).group_by(DBSource.source).scalar() if lowerversion is not None: list.append((source, higherversion, lowerversion))