Skip to contentSkip to conversation

toasterui.py: warn if buildstats is missing

PATCH Superseded Olaf Mandel 2 participants 3 messages Oct 27, 2016 – Oct 28, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toasterui.py: warn if buildstats is missing

Like for buildhistory and INHERIT, warn if buildstats is missing from USER_CLASSES.

---
 lib/bb/ui/toasterui.py | 5 +++++
 1 file changed, 5 insertions(+)
lib/bb/ui/toasterui.py +5 -0
index 9808f6b..2687faf 100644
@@ -168,6 +168,11 @@ def main(server, eventHandler, params):
         logger.warning("buildhistory is not enabled. Please enable INHERIT += \"buildhistory\" to see image details.")
         build_history_enabled = False
 
+    userclasseslist, _ = server.runCommand(["getVariable", "USER_CLASSES"])
+
+    if not "buildstats" in userclasseslist.split(" "):
+        logger.warning("buildstats is not enabled. Please enable USER_CLASSES += \"buildstats\" to generate build statistics.")
+
     if not params.observe_only:
         params.updateFromServer(server)
         params.updateToServer(server, os.environ.copy())
Signature · 1 line
2.1.4
#1 lore raw
Quoted 15 lines · Olaf Mandel

Like for buildhistory and INHERIT, warn if buildstats is missing from USER_CLASSES.

---
 lib/bb/ui/toasterui.py | 5 +++++

 1 file changed, 5 insertions(+)
lib/bb/ui/toasterui.py +0 -0
index 9808f6b..2687faf 100644
@@ -168,6 +168,11 @@ def main(server, eventHandler, params):

         logger.warning("buildhistory is not enabled. Please enable INHERIT += \"buildhistory\" to see image details.")

Quoted 8 lines

         build_history_enabled = False

+    userclasseslist, _ = server.runCommand(["getVariable", "USER_CLASSES"])
+
+    if not "buildstats" in userclasseslist.split(" "):
+        logger.warning("buildstats is not enabled. Please enable USER_CLASSES += \"buildstats\" to generate build statistics.")

As USER_CLASSES is an intermediate variable whose value becomes part of the INHERIT assignment it'd be better to check whether buildstats is in INHERIT, rather than USER_CLASSES.

This should better handle configurations which include buildstats in a different manner.

Quoted 7 lines

+
     if not params.observe_only:
         params.updateFromServer(server) params.updateToServer(server, os.environ.copy()) --
2.1.4

#2 lore raw

PATCH v2 1/1 toasterui.py: warn if buildstats is missing

Like for buildhistory, warn if buildstats is missing from INHERIT.

---
 lib/bb/ui/toasterui.py | 3 +++
 1 file changed, 3 insertions(+)
lib/bb/ui/toasterui.py +3 -0
index 9808f6b..b1b3684 100644
@@ -168,6 +168,9 @@ def main(server, eventHandler, params):
         logger.warning("buildhistory is not enabled. Please enable INHERIT += \"buildhistory\" to see image details.")
         build_history_enabled = False
 
+    if not "buildstats" in inheritlist.split(" "):
+        logger.warning("buildstats is not enabled. Please enable INHERIT += \"buildstats\" to generate build statistics.")
+
     if not params.observe_only:
         params.updateFromServer(server)
         params.updateToServer(server, os.environ.copy())
Signature · 1 line
2.1.4