Author: fw Date: 2011-04-24 18:23:55 +0000 (Sun, 24 Apr 2011) New Revision: 16590 Modified: bin/gen-DSA.py Log: bin/gen_DSA.py: add version information to data/DSA/list Modified: bin/gen-DSA.py ==================================================================--- bin/gen-DSA.py 2011-04-24 18:09:43 UTC (rev 16589) +++ bin/gen-DSA.py 2011-04-24 18:23:55 UTC (rev 16590) @@ -154,13 +154,18 @@ print >>sys.stderr, "DSA already exists:", repr(opt_dsaid) sys.exit(1) -def newdsalist(months=" Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split()): +def fordsalist(versions, + months=" Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split()): lines = ["[{0:0} {1} {2}] DSA-{3} {4} - {5}\n".format( tm.tm_mday, months[tm.tm_mon], tm.tm_year, opt_dsaid, opt_package, opt_vulnerability)] if opt_cve: lines.append("\t{" + " ".join(opt_cve) + "}\n") - lines = lines + list(file(dsa_list_path)) + for rel, ver in versions.items(): + rel = debian_support.releasecodename(rel) + if ver: + lines.append("\t[{0}] - {1} {2}\n".format( + rel, opt_package, ver)) return lines def checkfile(): @@ -221,7 +226,7 @@ if versions: versions.sort() return str(versions[-1]) - return "<missing>" + return None parsecommand() checklist() @@ -229,7 +234,7 @@ queue = secmaster.listqueue() stable_version = search_queue(queue, opt_package, "stable") -oldstable_version = search_queue(queue, opt_package, "oldstable", "<missing>") +oldstable_version = search_queue(queue, opt_package, "oldstable", False) testing_version = search_queue(queue, opt_package, "testing", False) buglist = searchlist_bugs(opt_cve) @@ -251,17 +256,23 @@ "OLDSTABLE" : debian_support.releasecodename("oldstable"), "STABLE" : debian_support.releasecodename("stable"), "TESTING" : debian_support.releasecodename("testing"), - "OLDSTABLE_VERSION" : oldstable_version, + "OLDSTABLE_VERSION" : oldstable_version or "<missing>", "STABLE_VERSION" : stable_version, - "TESTING_VERSION" : testing_version, - "UNSTABLE_VERSION" : unstable_version, + "TESTING_VERSION" : testing_version or "<missing>", + "UNSTABLE_VERSION" : unstable_version or "<missing>", "SPACEDDEBFULLNAME" : gecos().rjust(24), }) +updatedlist = fordsalist({ + "stable" : stable_version, + "oldstable" : oldstable_version + }) if opt_save: - updatedlist = newdsalist() out = file(dsa_file, "w+") out.write(template) out.close() - debian_support.replaceFile(updatedlist, dsa_list_path) + debian_support.replaceFile(updatedlist + list(file(dsa_list_path)), + dsa_list_path) else: - print template, + print template + for line in updatedlist: + print "|", line,