Skip to contentSkip to conversation

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

PATCH In review Mark Hatle 2 participants 5 messages Jan 22, 2020 – Jan 28, 2020

lore
Share & tools
lore

Mark Hatle

author
#0 lore raw

PATCH 1/2 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.

---
 meta/classes/toaster.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/classes/toaster.bbclass +6 -5
index 6a65ecb957..9518ddf7a4 100644
@@ -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)
Signature · 1 line
2.17.1
author
#1 lore raw

PATCH 2/2 libgcc.inc: Fix an issue w/ a recursive symlink

From: Mark Hatle <[email protected]>

If the OS is not Linux, the code could end up generating a recursive symlink. This can happen because the same symlink can be created twice in a row. If this happenes, the second symlink becomes a link to itself within the directory pointed to by the original link.

In order to prevent this, verify that the destination does not already exist.

---
 meta/recipes-devtools/gcc/libgcc.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/recipes-devtools/gcc/libgcc.inc +6 -2
index e008d14f36..6d48ec9809 100644
@@ -9,14 +9,18 @@ do_install_append_class-target () {
 			"linux-musleabi") extra_target_os="linux-gnueabi";;
 			*) extra_target_os="linux";;
 		esac
-		ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+		if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
+			ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+		fi
 	fi
 	if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then
 		case "${TARGET_OS}" in
 			"linux-musleabi") extra_target_os="linux-musleabihf";;
 			"linux-gnueabi") extra_target_os="linux-gnueabihf";;
 		esac
-		ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+		if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
+			ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+		fi
 	fi
 }
 
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] libgcc.inc: Fix an issue w/ a recursive symlink

Quoted 10 lines · Mark Hatle

From: Mark Hatle <[email protected]>

If the OS is not Linux, the code could end up generating a recursive symlink. This can happen because the same symlink can be created twice in a row. If this happenes, the second symlink becomes a link to itself within the directory pointed to by the original link.

In order to prevent this, verify that the destination does not already exist.

does this happen with ln -sf too ? if not then perhaps that will be simpler

Quoted 39 lines
---
 meta/recipes-devtools/gcc/libgcc.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/recipes-devtools/gcc/libgcc.inc +6 -3
index e008d14f36..6d48ec9809 100644
@@ -9,14 +9,18 @@ do_install_append_class-target () {
                        "linux-musleabi") extra_target_os="linux-gnueabi";;
                        *) extra_target_os="linux";;
                esac
-               ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
+                       ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               fi
        fi
        if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then
                case "${TARGET_OS}" in
                        "linux-musleabi") extra_target_os="linux-musleabihf";;
                        "linux-gnueabi") extra_target_os="linux-gnueabihf";;
                esac
-               ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
+                       ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               fi
        fi
 }
 
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#3 lore raw

Re: [PATCH 2/2] libgcc.inc: Fix an issue w/ a recursive symlink

Quoted 10 lines · Khem Raj
Quoted 8 lines · Mark Hatle

From: Mark Hatle <[email protected]>

If the OS is not Linux, the code could end up generating a recursive symlink. This can happen because the same symlink can be created twice in a row. If this happenes, the second symlink becomes a link to itself within the directory pointed to by the original link.

Quoted 4 lines
Quoted 2 lines

In order to prevent this, verify that the destination does not already exist.

does this happen with ln -sf too ? if not then perhaps that will be simpler

Yes, because the path being listed is assumed to be a directory path instead of a file path.

--Mark

Quoted 39 lines
Quoted 39 lines
---
 meta/recipes-devtools/gcc/libgcc.inc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
meta/recipes-devtools/gcc/libgcc.inc +6 -3
index e008d14f36..6d48ec9809 100644
@@ -9,14 +9,18 @@ do_install_append_class-target () {
                        "linux-musleabi") extra_target_os="linux-gnueabi";;
                        *) extra_target_os="linux";;
                esac
-               ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
+                       ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               fi
        fi
        if [ -n "${@ bb.utils.contains('TUNE_CCARGS_MFLOAT', 'hard', 'hf', '', d)}" ]; then
                case "${TARGET_OS}" in
                        "linux-musleabi") extra_target_os="linux-musleabihf";;
                        "linux-gnueabi") extra_target_os="linux-gnueabihf";;
                esac
-               ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               if [ ! -e ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os ]; then
+                       ln -s ${TARGET_SYS} ${D}${libdir}/${TARGET_ARCH}${TARGET_VENDOR}-$extra_target_os
+               fi
        fi
 }
 
--

2.17.1

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core

author
#4 lore raw
In reply to Mark Hatle

Ping.

Quoted 44 lines · Mark Hatle

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.

---
 meta/classes/toaster.bbclass | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
meta/classes/toaster.bbclass +6 -5
index 6a65ecb957..9518ddf7a4 100644
@@ -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)