Skip to contentSkip to conversation

misc Toaster fixes from Ed

PATCH New Michael Wood 1 participant 6 messages Sep 27, 2016

lore
Share & tools
lore
#0 lore raw

cover misc Toaster fixes from Ed

This patchset contains bug fix for bug 10185 - Image builds not showing as complete in the UI after finishing and bunch of small related and unrelated fixes for toaster script and toasterui.

Review done on the toaster mailing list.

Ed Bartosh (5):
toaster: stop modifying OEROOT in toaster script
toaster: check if file exist
toaster: fix handling of EnvironmentError
toaster: fix 'Unhandled MetadataEvent' error
toaster: make error message more informative

 bin/toaster                  | 10 ++++++----
 lib/bb/ui/buildinfohelper.py |  3 +++
 lib/bb/ui/toasterui.py       | 15 +++++++++++----
 3 files changed, 20 insertions(+), 8 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 toaster: stop modifying OEROOT in toaster script

From: Ed Bartosh <[email protected]>

Setting OEROOT in toaster script makes oe-init-build-env to
break with error:
bash: ../bitbake/bin/../../scripts/oe-buildenv-internal: No such file or directory
This happens because OEROOT contains path relative to build
directory.

Renamed OEROOT to OE_ROOT and unset it after it's used.

---
 bin/toaster | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
bin/toaster +6 -4
index 6641dbc..f92d38e 100755
@@ -129,7 +129,7 @@ fi
 
 export BBBASEDIR=`dirname $TOASTER`/..
 MANAGE="python3 $BBBASEDIR/lib/toaster/manage.py"
-OEROOT=`dirname $TOASTER`/../..
+OE_ROOT=`dirname $TOASTER`/../..
 
 # this is the configuraton file we are using for toaster
 # we are using the same logic that oe-setup-builddir uses
@@ -139,16 +139,18 @@ OEROOT=`dirname $TOASTER`/../..
 # in the local layers that currently make using an arbitrary
 # toasterconf.json difficult.
 
-. $OEROOT/.templateconf
+. $OE_ROOT/.templateconf
 if [ -n "$TEMPLATECONF" ]; then
     if [ ! -d "$TEMPLATECONF" ]; then
         # Allow TEMPLATECONF=meta-xyz/conf as a shortcut
-        if [ -d "$OEROOT/$TEMPLATECONF" ]; then
-            TEMPLATECONF="$OEROOT/$TEMPLATECONF"
+        if [ -d "$OE_ROOT/$TEMPLATECONF" ]; then
+            TEMPLATECONF="$OE_ROOT/$TEMPLATECONF"
         fi
     fi
 fi
 
+unset OE_ROOT
+
 # this defines the dir toaster will use for
 # 1) clones of layers (in _toaster_clones )
 # 2) the build dir (in build)
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/5 toaster: check if file exist

In reply to Michael Wood

From: Ed Bartosh <[email protected]>

Buildinfohelper assumes that all files mentioned in manifest exist in deploy/ directory, which is not always the case. Toaster crashes with OSError trying to call os.stat on non-existing file.

Checking if file exists before processing it should fix this.

[YOCTO #10185]

---
 lib/bb/ui/buildinfohelper.py | 3 +++
 1 file changed, 3 insertions(+)
lib/bb/ui/buildinfohelper.py +3 -0
index b2c74dd..970a941 100644
@@ -1758,6 +1758,9 @@ class BuildInfoHelper(object):
 
                 for basename in basenames:
                     artifact_path = os.path.join(deploy_dir_image, basename)
+                    if not os.path.exists(artifact_path):
+                        logger.warning("artifact %s doesn't exist, skipping" % artifact_path)
+                        continue
                     artifact_size = os.stat(artifact_path).st_size
 
                     # note that the artifact will only be saved against this
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/5 toaster: fix handling of EnvironmentError

In reply to Michael Wood

From: Ed Bartosh <[email protected]>

Due to the bug in processing EnvironmentError exception, toasterui ignores it. As EnvironmentError is a base for OSError and IOError this means that all OSError and IOError exceptions were silently ignored.

---
 lib/bb/ui/toasterui.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
lib/bb/ui/toasterui.py +6 -3
index b5422cf..569957a 100644
@@ -450,9 +450,12 @@ def main(server, eventHandler, params):
             return_value += 1
 
         except EnvironmentError as ioerror:
-            # ignore interrupted io
-            if ioerror.args[0] == 4:
-                pass
+            logger.warning("EnvironmentError: %s" % ioerror)
+            # ignore interrupted io system calls
+            if ioerror.args[0] == 4: # errno 4 is EINTR
+                logger.warning("Skipped EINTR: %s" % ioerror)
+            else:
+                raise
         except KeyboardInterrupt:
             if params.observe_only:
                 print("\nKeyboard Interrupt, exiting observer...")
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/5 toaster: fix 'Unhandled MetadataEvent' error

In reply to Michael Wood

From: Ed Bartosh <[email protected]>

New MetadataEvent 'TaskArtifacts' causes this error. Processing of this event will hopefully be implemented in future. For now it should be enough to just skip it.

---
 lib/bb/ui/toasterui.py | 4 ++++
 1 file changed, 4 insertions(+)
lib/bb/ui/toasterui.py +4 -0
index 569957a..2bc45b6 100644
@@ -431,6 +431,10 @@ def main(server, eventHandler, params):
                     buildinfohelper.scan_sdk_artifacts(event)
                 elif event.type == "SetBRBE":
                     buildinfohelper.brbe = buildinfohelper._get_data_from_event(event)
+                elif event.type == "TaskArtifacts":
+                    # not implemented yet
+                    # see https://bugzilla.yoctoproject.org/show_bug.cgi?id=10283 for details
+                    pass
                 elif event.type == "OSErrorException":
                     logger.error(event)
                 else:
Signature · 1 line
2.7.4
#5 lore raw

PATCH 5/5 toaster: make error message more informative

In reply to Michael Wood

From: Ed Bartosh <[email protected]>

Error message
ERROR: Unprocessed MetadataEvent <bb.event.MetadataEvent object at 0x7f750e671a58>
doesn't give a lot of information about the event. It just prints event object, which is always bb.event.MetadataEvent.

Including event type into the error message should make it more informative:
ERROR: Unprocessed MetadataEvent TaskArtifacts

---
 lib/bb/ui/toasterui.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/ui/toasterui.py +1 -1
index 2bc45b6..9808f6b 100644
@@ -438,7 +438,7 @@ def main(server, eventHandler, params):
                 elif event.type == "OSErrorException":
                     logger.error(event)
                 else:
-                    logger.error("Unprocessed MetadataEvent %s ", str(event))
+                    logger.error("Unprocessed MetadataEvent %s", event.type)
                 continue
 
             if isinstance(event, bb.cooker.CookerExit):
Signature · 1 line
2.7.4