[auh][PATCH] modules/statistics: include information about skipped recipes into summary emails

Alexander Kanavin <[email protected]>
Newsgroups org.yoctoproject.lists.yocto-patches
Message-ID <[email protected]>
Signed-off-by: Alexander Kanavin <[email protected]>
---
 modules/statistics.py | 10 ++++++++++
 upgrade-helper.py     |  1 +
 2 files changed, 11 insertions(+)

diff --git a/modules/statistics.py b/modules/statistics.py
index 227f0be..5126a39 100644
--- a/modules/statistics.py
+++ b/modules/statistics.py
@@ -32,6 +32,7 @@ class Statistics(object):
         self.upgrade_stats = dict()
         self.maintainers = set()
         self.total_attempted = 0
+        self.skipped = []
 
     def _update(self, pn, new_ver, maintainer, error):
         if error is None:
@@ -65,6 +66,10 @@ class Statistics(object):
         for p in group['pkgs']:
             self._update(p['PN'],p['NPV'],p['MAINTAINER'],group['error'])
 
+    def skip(self, group, reason):
+        for p in group['pkgs']:
+            self.skipped.append((p['PN'],p['NPV'],p['MAINTAINER'],reason))
+
     def _pkg_stats(self):
         stat_msg = "Recipe upgrade statistics:\n\n"
         for status in self.upgrade_stats:
@@ -78,6 +83,11 @@ class Statistics(object):
                         stat_msg += ", " + maintainer
                     stat_msg += "\n"
 
+        if self.skipped:
+            stat_msg += "    * Skipped: {}\n".format(len(self.skipped))
+            for (pkg, new_ver, maintainer, reason) in self.skipped:
+                stat_msg += "        {}, {}, {}, {}\n".format(pkg, new_ver, reason, maintainer)
+
         if self.total_attempted == 0:
             percent_succeded = 0
             percent_failed = 0
diff --git a/upgrade-helper.py b/upgrade-helper.py
index b4aa99a..eea0fd7 100755
--- a/upgrade-helper.py
+++ b/upgrade-helper.py
@@ -499,6 +499,7 @@ class Updater(object):
                 r = self.state.check(pn, npv)
                 if r['skip']:
                     I(" %s %s: skipping (%s)" % (pn, npv, r['reason']))
+                    self.statistics.skip(g, r['reason'])
                 else:
                     kept.append(g)
             I(" %d/%d package groups skipped (incremental mode)"
-- 
2.47.3
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.