support/graph-size: report 'Unknown" after all packages, but before "Others"
authorYann E. MORIN <yann.morin.1998@free.fr>
Sat, 17 Aug 2019 17:18:25 +0000 (19:18 +0200)
committerArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Mon, 26 Aug 2019 20:12:37 +0000 (22:12 +0200)
Currently, the "unknown" category may be reported anywhere, so it does
not really stand out when there are a lot of packages in the graph.

Move it towards the end, but right before the "other" category, so that
it is a bit more visible. Like for Others, don't report it if its size
is zero.

Also, make it title case (i.e. "Unknown" instead of "unknown").

Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
support/scripts/size-stats

index 398c256e8be77a0e22b6ac6db776093284f6464a..82258e4606632b86846fce795cad394c544838ae 100755 (executable)
@@ -131,12 +131,18 @@ def draw_graph(pkgsize, outputf):
     labels = []
     values = []
     other_value = 0
+    unknown_value = 0
     for (p, sz) in sorted(pkgsize.items(), key=lambda x: x[1]):
         if sz < (total * 0.01):
             other_value += sz
+        elif p == "unknown":
+            unknown_value = sz
         else:
             labels.append("%s (%d kB)" % (p, sz / 1000.))
             values.append(sz)
+    if unknown_value != 0:
+        labels.append("Unknown (%d kB)" % (unknown_value / 1000.))
+        values.append(unknown_value)
     if other_value != 0:
         labels.append("Other (%d kB)" % (other_value / 1000.))
         values.append(other_value)