support/scripts/pkg-stats: improvements in is_status_*() methods
authorThomas Petazzoni <thomas.petazzoni@bootlin.com>
Thu, 7 Jan 2021 13:39:38 +0000 (14:39 +0100)
committerThomas Petazzoni <thomas.petazzoni@bootlin.com>
Sun, 31 Jan 2021 11:02:41 +0000 (12:02 +0100)
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 <thomas.petazzoni@bootlin.com>
support/scripts/pkg-stats

index b66064f1435952c17ba44232e140169ef9195b84..099aacc8d2b8a66ba91a5b92f4c84ed2991e6afa 100755 (executable)
@@ -275,7 +275,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