From patchwork Thu Jan 7 13:39:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1423283 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.137; helo=fraxinus.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 fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4DBS5s4r4Cz9sVk for ; Fri, 8 Jan 2021 00:40:01 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 448CB869C8; Thu, 7 Jan 2021 13:40:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pXR71-_qrOlX; Thu, 7 Jan 2021 13:39:59 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 088F0864EF; Thu, 7 Jan 2021 13:39:59 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id EE78F1BF3FC for ; Thu, 7 Jan 2021 13:39:55 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id EB95786004 for ; Thu, 7 Jan 2021 13:39:55 +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 GTQfQ6AeBRK6 for ; Thu, 7 Jan 2021 13:39:54 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relay2-d.mail.gandi.net (relay2-d.mail.gandi.net [217.70.183.194]) by whitealder.osuosl.org (Postfix) with ESMTPS id 74F9586AC2 for ; Thu, 7 Jan 2021 13:39:54 +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 relay2-d.mail.gandi.net (Postfix) with ESMTPSA id B1B114000D; Thu, 7 Jan 2021 13:39:50 +0000 (UTC) From: Thomas Petazzoni To: Buildroot List Date: Thu, 7 Jan 2021 14:39:38 +0100 Message-Id: <20210107133948.2997849-2-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 01/10] support/scripts/pkg-stats: improvements in is_status_*() methods 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" Make is_status_ok() work when the given status name is not even listed in the status dict. This will be necessary for following commits. Introduced similar methods for the error and na status, which will be used in following commits. Signed-off-by: Thomas Petazzoni --- support/scripts/pkg-stats | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/support/scripts/pkg-stats b/support/scripts/pkg-stats index 4a9ff1ffa0..900f290e11 100755 --- a/support/scripts/pkg-stats +++ b/support/scripts/pkg-stats @@ -276,7 +276,13 @@ class Package: self.status['developers'] = ("warning", "no developers") def is_status_ok(self, name): - return self.status[name][0] == 'ok' + return name in self.status and self.status[name][0] == 'ok' + + def is_status_error(self, name): + return name in self.status and self.status[name][0] == 'error' + + def is_status_na(self, name): + return name in self.status and self.status[name][0] == 'na' def __eq__(self, other): return self.path == other.path