From: rbu Date: Tue, 18 Aug 2009 17:47:20 +0000 (-0000) Subject: Make --pretend output in glsa-check nicer. Add colors and fix linebreaks. X-Git-Tag: gentoolkit-0.3.0_rc10~57 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=72ba7b1274faf37451b1641ee51140f53f4b7098;p=gentoolkit.git Make --pretend output in glsa-check nicer. Add colors and fix linebreaks. svn path=/trunk/gentoolkit/; revision=670 --- diff --git a/bin/glsa-check b/bin/glsa-check index a66371c..9f2e344 100755 --- a/bin/glsa-check +++ b/bin/glsa-check @@ -298,13 +298,22 @@ if mode in ["dump", "fix", "inject", "pretend"]: for (vuln, update) in myglsa.getAffectionTable(least_change=least_change): mergedict.setdefault(update, []).append(vuln) - sys.stdout.write(">>> The following updates will be performed for this GLSA:\n") - for pkg in mergedict: - if pkg != "": - sys.stdout.write(" " + pkg + " (vulnerable: " + ", ".join(mergedict[pkg]) + ")\n") + # first, extract the atoms that cannot be upgraded (where key == "") + no_upgrades = [] if "" in mergedict: - sys.stdout.write("\n>>> For the following packages, no upgrade path exists:\n") - sys.stdout.write(" " + ", ".join(mergedict[""])) + no_upgrades = mergedict[""] + del mergedict[""] + + # see if anything is left that can be upgraded + if mergedict: + sys.stdout.write(">>> Updates that will be performed:\n") + for (upd, vuln) in mergedict.iteritems(): + sys.stdout.write(" " + green(upd) + " (vulnerable: " + red(", ".join(vuln)) + ")\n") + + if no_upgrades: + sys.stdout.write(">>> No upgrade path exists for these packages:\n") + sys.stdout.write(" " + red(", ".join(no_upgrades)) + "\n") + sys.stdout.write("\n") elif mode == "inject": sys.stdout.write("injecting " + myid + "\n") myglsa.inject()