Author: fw Date: 2011-04-24 17:52:21 +0000 (Sun, 24 Apr 2011) New Revision: 16588 Modified: bin/gen-DSA.py Log: bin/gen_DSA.py: fill in version information for stable and oldstable Modified: bin/gen-DSA.py ==================================================================--- bin/gen-DSA.py 2011-04-24 17:37:45 UTC (rev 16587) +++ bin/gen-DSA.py 2011-04-24 17:52:21 UTC (rev 16588) @@ -39,8 +39,9 @@ import re import time +import bugs import debian_support -import bugs +import secmaster def parsecommand(): args = sys.argv[1:] @@ -169,9 +170,33 @@ print >>sys.stderr, "DSA file already exists:", repr(dsa_file) sys.exit(1) +def search_queue(queue, package, codename, missing=None): + """Search QUEUE for PACKAGE in distribution CODENAME. + Returns MISSING if not found (or raises exception of None). + If found, returns the maximum version number encountered. + """ + cname = debian_support.releasecodename(codename) + versions = [debian_support.Version(pkg.source_version) + for pkg, dists in queue + if pkg.source == package and cname in dists] + if versions: + versions.sort() + return str(versions[-1]) + if missing is None: + raise IOError("could not find version for package {0!r} in {1!r}". + format(package, codename)) + return missing + parsecommand() checklist() checkfile() + +queue = secmaster.listqueue() +stable_version = search_queue(queue, opt_package, "stable") +oldstable_version = search_queue(queue, opt_package, "oldstable", "<missing>") +testing_version = search_queue(queue, opt_package, "testing", "<missing>") +unstable_version = search_queue(queue, opt_package, "unstable", "<missing>") + template = filledtemplate({ "DEBFULLNAME" : gecos(), "DEBEMAIL" : debemail(), @@ -186,10 +211,10 @@ "OLDSTABLE" : debian_support.releasecodename("oldstable"), "STABLE" : debian_support.releasecodename("stable"), "TESTING" : debian_support.releasecodename("testing"), - "OLDSTABLE_VERSION" : "$OLDSTABLE_VERSION", - "STABLE_VERSION" : "$STABLE_VERSION", - "TESTING_VERSION" : "$TESTING_VERSION", - "UNSTABLE_VERSION" : "$UNSTABLE_VERSION", + "OLDSTABLE_VERSION" : oldstable_version, + "STABLE_VERSION" : stable_version, + "TESTING_VERSION" : testing_version, + "UNSTABLE_VERSION" : unstable_version, "SPACEDDEBFULLNAME" : gecos().rjust(24), }) if opt_save: