From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 8FA88138335 for ; Sat, 31 Aug 2019 03:42:42 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1A009E0817; Sat, 31 Aug 2019 03:42:41 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 991D3E081B for ; Sat, 31 Aug 2019 03:42:40 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E6C3734A738 for ; Sat, 31 Aug 2019 03:42:38 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 9717677C for ; Sat, 31 Aug 2019 03:42:36 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1567221253.db3bcdad84ea115ee94e20beb780713a1cf86839.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/ X-VCS-Repository: proj/portage X-VCS-Files: bin/glsa-check X-VCS-Directories: bin/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: db3bcdad84ea115ee94e20beb780713a1cf86839 X-VCS-Branch: master Date: Sat, 31 Aug 2019 03:42:36 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fbf8733a-3dec-4cfa-8909-42afab6ded95 X-Archives-Hash: 4d7b305e8f0f961915679cde32ee1e93 commit: db3bcdad84ea115ee94e20beb780713a1cf86839 Author: Zac Medico gentoo org> AuthorDate: Fri Aug 30 22:41:08 2019 +0000 Commit: Zac Medico gentoo org> CommitDate: Sat Aug 31 03:14:13 2019 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=db3bcdad glsa-check: Make --pretend output nicer This patch is a forward port of the following commit: https://gitweb.gentoo.org/proj/gentoolkit.git/commit/?id=72ba7b1274faf37451b1641ee51140f53f4b7098 commit 72ba7b1274faf37451b1641ee51140f53f4b7098 Author: rbu gentoo.org> AuthorDate: 2009-08-18 17:47:20 +0000 Commit: rbu gentoo.org> CommitDate: 2009-08-18 17:47:20 +0000 Make --pretend output in glsa-check nicer. Add colors and fix linebreaks. svn path=/trunk/gentoolkit/; revision=670 Bug: https://bugs.gentoo.org/693088 Acked-by: Aaron Bauman gentoo.org> Signed-off-by: Zac Medico gentoo.org> bin/glsa-check | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/bin/glsa-check b/bin/glsa-check index 3502812d9..bf81eca63 100755 --- a/bin/glsa-check +++ b/bin/glsa-check @@ -263,13 +263,23 @@ if mode in ["dump", "fix", "inject", "pretend"]: for (vuln, update) in myglsa.getAffectionTable(least_change=least_change): mergedict.setdefault(update, []).append(vuln) + # first, extract the atoms that cannot be upgraded (where key == "") + no_upgrades = [] 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") 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.items(): + 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()