summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/buildinfohelper.py
diff options
context:
space:
mode:
authorDavid Reyna <David.Reyna@windriver.com>2023-08-28 01:45:20 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-08-30 10:41:54 +0100
commitddf3b3ecd4b1680dc0dedfd4eaebcf3441b14ca7 (patch)
treeced42cc3f5ebe2fd2ca4b78fb9aac87248c57350 /bitbake/lib/bb/ui/buildinfohelper.py
parent6553377beaded3fa7841dd2da4d4d0a0d04cffce (diff)
downloadpoky-ddf3b3ecd4b1680dc0dedfd4eaebcf3441b14ca7.tar.gz
bitbake: 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] (Bitbake rev: 703792c48c818025163de9c2f35f6ac815500607) 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> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/buildinfohelper.py')
-rw-r--r--bitbake/lib/bb/ui/buildinfohelper.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/buildinfohelper.py b/bitbake/lib/bb/ui/buildinfohelper.py
index 129bb329c3..8b212b7803 100644
--- a/bitbake/lib/bb/ui/buildinfohelper.py
+++ b/bitbake/lib/bb/ui/buildinfohelper.py
@@ -1746,7 +1746,6 @@ class BuildInfoHelper(object):
1746 1746
1747 buildname = self.server.runCommand(['getVariable', 'BUILDNAME'])[0] 1747 buildname = self.server.runCommand(['getVariable', 'BUILDNAME'])[0]
1748 machine = self.server.runCommand(['getVariable', 'MACHINE'])[0] 1748 machine = self.server.runCommand(['getVariable', 'MACHINE'])[0]
1749 image_name = self.server.runCommand(['getVariable', 'IMAGE_NAME'])[0]
1750 1749
1751 # location of the manifest files for this build; 1750 # location of the manifest files for this build;
1752 # note that this file is only produced if an image is produced 1751 # note that this file is only produced if an image is produced
@@ -1767,6 +1766,18 @@ class BuildInfoHelper(object):
1767 # filter out anything which isn't an image target 1766 # filter out anything which isn't an image target
1768 image_targets = [target for target in targets if target.is_image] 1767 image_targets = [target for target in targets if target.is_image]
1769 1768
1769 if len(image_targets) > 0:
1770 #if there are image targets retrieve image_name
1771 image_name = self.server.runCommand(['getVariable', 'IMAGE_NAME'])[0]
1772 if not image_name:
1773 #When build target is an image and image_name is not found as an environment variable
1774 logger.info("IMAGE_NAME not found, extracting from bitbake command")
1775 cmd = self.server.runCommand(['getVariable','BB_CMDLINE'])[0]
1776 #filter out tokens that are command line options
1777 cmd = [token for token in cmd if not token.startswith('-')]
1778 image_name = cmd[1].split(':', 1)[0] # remove everything after : in image name
1779 logger.info("IMAGE_NAME found as : %s " % image_name)
1780
1770 for image_target in image_targets: 1781 for image_target in image_targets:
1771 # this is set to True if we find at least one file relating to 1782 # this is set to True if we find at least one file relating to
1772 # this target; if this remains False after the scan, we copy the 1783 # this target; if this remains False after the scan, we copy the