From 105153673ddf17fa20705d07d73b0f100c577546 Mon Sep 17 00:00:00 2001 From: Joerg Jaspert Date: Sun, 2 Mar 2008 23:39:16 +0100 Subject: [PATCH] Fix check logic to work the way apt_pkg.VersionCompare wants it. Also parse "not in testing" as reject reason, as wanted by a release team member --- ChangeLog | 2 ++ dak/check_transitions.py | 44 ++++++++++++++++++++++++---------------- dak/process_unchecked.py | 8 +++++--- debian/control | 2 +- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6aba702a..26beb097 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2008-03-02 Joerg Jaspert + * debian/control (Suggests): Add python-syck to Depends: + * dak/dak.py (init): Tell it about check_transitions * dak/check_transitions.py (usage): Added, checks the transitions diff --git a/dak/check_transitions.py b/dak/check_transitions.py index 89ac4c7f..20964258 100755 --- a/dak/check_transitions.py +++ b/dak/check_transitions.py @@ -44,25 +44,29 @@ def init(): Cnf = daklib.utils.get_conf() - Arguments = [('h',"help","Dinstall::Options::Help"), - ('n',"no-action","Dinstall::Options::No-Action")] + Arguments = [('h',"help","Check-Transitions::Options::Help"), + ('n',"no-action","Check-Transitions::Options::No-Action")] for i in ["help", "no-action"]: - Cnf["Dinstall::Options::%s" % (i)] = "" + if not Cnf.has_key("Check-Transitions::Options::%s" % (i)): + Cnf["Check-Transitions::Options::%s" % (i)] = "" + + apt_pkg.ParseCommandLine(Cnf, Arguments, sys.argv) + + Options = Cnf.SubTree("Check-Transitions::Options") projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) daklib.database.init(Cnf, projectB) - Options = Cnf.SubTree("Dinstall::Options") - if Options["Help"]: + if Options["help"]: usage() ################################################################################ def usage (exit_code=0): print """Usage: check_transitions [OPTION]... - Check the release managers transition file for correctness and outdated transitions + Check the release managers transition file for correctness and outdated transitions -h, --help show this help and exit. -n, --no-action don't do anything""" sys.exit(exit_code) @@ -108,28 +112,34 @@ Looking at transition: %s Source: %s New Version: %s Responsible: %s - Reason: %s + Description: %s Blocked Packages (total: %d): %s """ % (trans, source, new_vers, t["rm"], t["reason"], len(t["packages"]), ", ".join(t["packages"])) - if curvers and apt_pkg.VersionCompare(new_vers, curvers) == 1: - # This is still valid, the current version in database is older than - # the new version we wait for - print "This transition is still ongoing" + if curvers == None: + # No package in testing + print "Transition source %s not in testing, transition still ongoing." % (source) else: - print "This transition is over, the target package reached testing, removing" - print "%s wanted version: %s, has %s" % (source, new_vers, curvers) - to_remove.append(trans) - to_dump = 1 + compare = apt_pkg.VersionCompare(curvers, new_vers) + print "Apt compare says: %s" % (compare) + if compare < 0: + # This is still valid, the current version in database is older than + # the new version we wait for + print "This transition is still ongoing, we currently have version %s" % (curvers) + else: + print "This transition is over, the target package reached testing, removing" + print "%s wanted version: %s, has %s" % (source, new_vers, curvers) + to_remove.append(trans) + to_dump = 1 print "-------------------------------------------------------------------------" if to_dump: for remove in to_remove: - if Options["No-Action"]: + if Options["no-action"]: print "I: I would remove the %s transition" % (remove) else: del transitions[remove] - if not Options["No-Action"]: + if not Options["no-action"]: destfile = file(Cnf["Dinstall::Reject::ReleaseTransitions"], 'w') dump(transitions, destfile) diff --git a/dak/process_unchecked.py b/dak/process_unchecked.py index dc92f74f..920cfb9b 100755 --- a/dak/process_unchecked.py +++ b/dak/process_unchecked.py @@ -1030,10 +1030,12 @@ def check_transition(sourcepkg): # Will be None if nothing is in testing. curvers = daklib.database.get_testing_version(source) + if not curvers == None: + compare = apt_pkg.VersionCompare(curvers, new_vers) - if curvers and apt_pkg.VersionCompare(new_vers, curvers) == 1: - # This is still valid, the current version in database is older than - # the new version we wait for + if curvers == None or compare < 0: + # This is still valid, the current version in testing is older than + # the new version we wait for, or there is none in testing yet # Check if the source we look at is affected by this. if sourcepkg in t['packages']: diff --git a/debian/control b/debian/control index 97c1fbe1..2d6678b9 100644 --- a/debian/control +++ b/debian/control @@ -7,7 +7,7 @@ Standards-Version: 3.5.6.0 Package: dak Architecture: any -Depends: ${python:Depends}, python-pygresql, python2.1-email | python (>= 2.2), python-apt, apt-utils, gnupg (>= 1.0.6-1), ${shlibs:Depends}, dpkg-dev +Depends: ${python:Depends}, python-pygresql, python2.1-email | python (>= 2.2), python-apt, apt-utils, gnupg (>= 1.0.6-1), ${shlibs:Depends}, dpkg-dev, python-syck (>= 0.61.2-1) Suggests: lintian, linda, less, binutils-multiarch, symlinks, postgresql (>= 7.1.0), dsync Description: Debian's archive maintenance scripts This is a collection of archive maintenance scripts used by the -- 2.39.5