summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2023-08-28 01:45:20 -0700
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2023-08-29 16:40:17 +0200
commit703792c48c818025163de9c2f35f6ac815500607 (patch)
treeb1fa201874d12f9e077bb966882cc6b0545c219a
parente73c4d7685a3bd6b806a8f1a3600a3a86266f0b6 (diff)
downloadbitbake-703792c48c818025163de9c2f35f6ac815500607.tar.gz
toaster: accommodate missing 'Image Name' value in buildinfohelper
The value "Image Name" in bitbake events was missing for certain builds. Update 'buildinfohelper' to extract the image name elsewhere in this circumstance and not crash. [YOCTO #13191] Signed-off-by: Kieran McNulty <Kieran.McNulty@windriver.com> Signed-off-by: David Reyna <David.Reyna@windriver.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--lib/bb/ui/buildinfohelper.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 129bb329c..8b212b780 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -1746,7 +1746,6 @@ class BuildInfoHelper(object):
buildname = self.server.runCommand(['getVariable', 'BUILDNAME'])[0]
machine = self.server.runCommand(['getVariable', 'MACHINE'])[0]
- image_name = self.server.runCommand(['getVariable', 'IMAGE_NAME'])[0]
# location of the manifest files for this build;
# note that this file is only produced if an image is produced
@@ -1767,6 +1766,18 @@ class BuildInfoHelper(object):
# filter out anything which isn't an image target
image_targets = [target for target in targets if target.is_image]
+ if len(image_targets) > 0:
+ #if there are image targets retrieve image_name
+ image_name = self.server.runCommand(['getVariable', 'IMAGE_NAME'])[0]
+ if not image_name:
+ #When build target is an image and image_name is not found as an environment variable
+ logger.info("IMAGE_NAME not found, extracting from bitbake command")
+ cmd = self.server.runCommand(['getVariable','BB_CMDLINE'])[0]
+ #filter out tokens that are command line options
+ cmd = [token for token in cmd if not token.startswith('-')]
+ image_name = cmd[1].split(':', 1)[0] # remove everything after : in image name
+ logger.info("IMAGE_NAME found as : %s " % image_name)
+
for image_target in image_targets:
# this is set to True if we find at least one file relating to
# this target; if this remains False after the scan, we copy the