[buildroot-test,3/4] utils/daily-mail: add some debug information for the Notification class
diff mbox series

Message ID 20190708081406.28215-4-victor.huesca@bootlin.com
State New
Headers show
Series
  • add support for outdated packages
Related show

Commit Message

Victor Huesca July 8, 2019, 8:14 a.m. UTC
It was useful to me when working on adding support for new notification
so it may help someone else.

Signed-off-by: Victor Huesca <victor.huesca@bootlin.com>
---
 utils/daily-mail | 12 ++++++++++++
 1 file changed, 12 insertions(+)

Patch
diff mbox series

diff --git a/utils/daily-mail b/utils/daily-mail
index b4d0a56..85a1c4e 100755
--- a/utils/daily-mail
+++ b/utils/daily-mail
@@ -65,6 +65,18 @@  class Notification:
         self.arch_notifications = defaultdict(list)
         self.package_notifications = defaultdict(list)
         self.package_version_notification = []
+    def __repr__(self):
+        things = []
+        if len(self.arch_notifications):
+            things.append( '{} archs'.format(len(self.arch_notifications)) )
+        if len(self.package_notifications):
+            things.append( '{} pkgs'.format(len(self.package_notifications)) )
+        if len(self.package_version_notification):
+            things.append( '{} outdated pkgs'.format(len(self.package_version_notification)) )
+        if things:
+            return 'Notification <' + ', '.join(things) + '>'
+        else:
+            return None
 
 # Calculate the list of .mk files in the Buildroot source tree, will
 # be used to guess the name of the packages that caused build