From: Ansgar Burchardt Date: Sun, 21 Aug 2011 19:47:43 +0000 (+0000) Subject: control-suite: remove packages after adding new ones X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=615a9c912b5c1fc734e3d6469ae9a28bc3f22116;p=dak.git control-suite: remove packages after adding new ones We have to add package before removing those no longer wanted. Otherwise an old version could enter a suite without us noticing (as the old version would already be gone and thus no version check violated). --- diff --git a/dak/control_suite.py b/dak/control_suite.py index 0f3f53a8..6dd79b8f 100755 --- a/dak/control_suite.py +++ b/dak/control_suite.py @@ -238,17 +238,6 @@ def set_suite(file, suite, session, britney=False, force=False): key = " ".join(split_line) desired[key] = "" - # Check to see which packages need removed and remove them - for key in current.keys(): - if not desired.has_key(key): - (package, version, architecture) = key.split() - pkid = current[key] - if architecture == "source": - session.execute("""DELETE FROM src_associations WHERE id = :pkid""", {'pkid': pkid}) - else: - session.execute("""DELETE FROM bin_associations WHERE id = :pkid""", {'pkid': pkid}) - Logger.log(["removed", key, pkid]) - # Check to see which packages need added and add them for key in sorted(desired.keys(), cmp=cmp_package_version): if not current.has_key(key): @@ -265,6 +254,17 @@ def set_suite(file, suite, session, britney=False, force=False): VALUES (:suiteid, :pkid)""", {'suiteid': suite_id, 'pkid': pkid}) Logger.log(["added", key, pkid]) + # Check to see which packages need removed and remove them + for key in current.keys(): + if not desired.has_key(key): + (package, version, architecture) = key.split() + pkid = current[key] + if architecture == "source": + session.execute("""DELETE FROM src_associations WHERE id = :pkid""", {'pkid': pkid}) + else: + session.execute("""DELETE FROM bin_associations WHERE id = :pkid""", {'pkid': pkid}) + Logger.log(["removed", key, pkid]) + session.commit() if britney: