Przeglądaj źródła

toaster.bbclass: Fix error when toaster is used to monitor a build

The error being corrected looks like:

File: '/home/jenkins/workspace/OEBuild/build-32/oe-core/meta/classes/toaster.bbclass', lineno: 130, function: toaster_package_dumpdata
     0126:    lpkgdata = {}
     0127:    datadir = os.path.join(pkgdatadir, 'runtime')
     0128:
     0129:    # scan and send data for each generated package
 *** 0130:    for datafile in os.listdir(datadir):
     0131:        if not datafile.endswith('.packaged'):
     0132:            lpkgdata = _toaster_load_pkgdatafile(datadir, datafile)
     0133:            # Fire an event containing the pkg data
     0134:            bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d)
Exception: FileNotFoundError: [Errno 2] No such file or directory: '/home/jenkins/workspace/OEBuild/builds/build-32/tmp-glibc/work/core2-64-oe-linux/puzzles/2_0.0+gitAUTOINC+c6e0161dd4-r0/pkgdata/runtime'

There must be a small window before the data is available, but while the monitoring is on-going.

Signed-off-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Mark Hatle 4 lat temu
rodzic
commit
c7329b17cb
1 zmienionych plików z 6 dodań i 5 usunięć
  1. 6 5
      meta/classes/toaster.bbclass

+ 6 - 5
meta/classes/toaster.bbclass

@@ -126,11 +126,12 @@ def _toaster_dumpdata(pkgdatadir, d):
     datadir = os.path.join(pkgdatadir, 'runtime')
 
     # scan and send data for each generated package
-    for datafile in os.listdir(datadir):
-        if not datafile.endswith('.packaged'):
-            lpkgdata = _toaster_load_pkgdatafile(datadir, datafile)
-            # Fire an event containing the pkg data
-            bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d)
+    if os.path.exists(datadir):
+        for datafile in os.listdir(datadir):
+            if not datafile.endswith('.packaged'):
+                lpkgdata = _toaster_load_pkgdatafile(datadir, datafile)
+                # Fire an event containing the pkg data
+                bb.event.fire(bb.event.MetadataEvent("SinglePackageInfo", lpkgdata), d)
 
 python toaster_package_dumpdata() {
     _toaster_dumpdata(d.getVar('PKGDESTWORK'), d)