From patchwork Thu Jan 7 13:39:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1423287 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=bootlin.com Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBS636V82z9sSC for ; Fri, 8 Jan 2021 00:40:11 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 3542D86BF7; Thu, 7 Jan 2021 13:40:08 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QuLH49efuyBk; Thu, 7 Jan 2021 13:40:03 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id 7456386BDA; Thu, 7 Jan 2021 13:40:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id CB2F01BF34A for ; Thu, 7 Jan 2021 13:39:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C7AFE8732D for ; Thu, 7 Jan 2021 13:39:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fLYm6LcsPBq2 for ; Thu, 7 Jan 2021 13:39:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by hemlock.osuosl.org (Postfix) with ESMTPS id A734086EC0 for ; Thu, 7 Jan 2021 13:39:55 +0000 (UTC) X-Originating-IP: 90.2.82.147 Received: from localhost (aputeaux-654-1-223-147.w90-2.abo.wanadoo.fr [90.2.82.147]) (Authenticated sender: thomas.petazzoni@bootlin.com) by relay9-d.mail.gandi.net (Postfix) with ESMTPSA id 1245EFF811; Thu, 7 Jan 2021 13:39:51 +0000 (UTC) From: Thomas Petazzoni To: Buildroot List Date: Thu, 7 Jan 2021 14:39:39 +0100 Message-Id: <20210107133948.2997849-3-thomas.petazzoni@bootlin.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210107133948.2997849-1-thomas.petazzoni@bootlin.com> References: <20210107133948.2997849-1-thomas.petazzoni@bootlin.com> MIME-Version: 1.0 Subject: [Buildroot] [PATCH 02/10] support/scripts/pkg-stats: fix the status reporting of CVEs X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Matt Weber , Thomas Petazzoni Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Since commit bd665d182c8131d2deafa39be0f3d89adb43643f ("support/scripts/pkg-stats: improve rendering of CVE information"), we have better reporting of CVE related information, based on pkg.status['cve']. However, this commit broke pkg-stats when the --nvd-path option is not passed, and therefore no CVE information is available. This commit fixes that, by making use of the is_status_ok(), is_status_error() and is_status_na() methods recently introduced. Signed-off-by: Thomas Petazzoni --- support/scripts/pkg-stats | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 900f290e11..c084c54b60 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -881,18 +881,20 @@ def dump_html_pkg(f, pkg): # CVEs td_class = ["centered"] - if pkg.status['cve'][0] == "ok": + if pkg.is_status_ok("cve"): td_class.append("cve-ok") - elif pkg.status['cve'][0] == "error": + elif pkg.is_status_error("cve"): td_class.append("cve-nok") else: td_class.append("cve-unknown") f.write(" \n" % " ".join(td_class)) - if pkg.status['cve'][0] == "error": + if pkg.is_status_error("cve"): for cve in pkg.cves: f.write(" %s
\n" % (cve, cve)) - elif pkg.status['cve'][0] == "na": + elif pkg.is_status_na("cve"): f.write(" %s" % pkg.status['cve'][1]) + else: + f.write(" N/A\n") f.write(" \n") # CPE ID