RE: [Toaster] [PATCH] Add exception treatment to fix missing target_file

"Reyna, David" <[email protected]> Fri, 24 May 2024 07:35:36 +0000
Newsgroups org.yoctoproject.lists.toaster,org.openembedded.lists.bitbake-devel
Message-ID <BY5PR11MB4167BAB5319683E0C6F3A0AFEAF52@BY5PR11MB4167.namprd11.prod.outlook.com>
Hi Marlon,

The patch looks good. Thank you for fixing this edge case.

David

-----Original Message-----
From: [email protected] <[email protected]> On Be=
half Of Marlon Rodriguez Garcia via lists.yoctoproject.org
Sent: Thursday, May 23, 2024 7:56 AM
To: [email protected]; [email protected]
Cc: Marlon Rodriguez Garcia <[email protected]>
Subject: [Toaster] [PATCH] Add exception treatment to fix missing target_fi=
le

Based on the discution on  https://lists.yoctoproject.org/g/toaster/message=
/6157 in some cases the value for Target_file could be missing and is neede=
d to bypass it to finish build

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfaire=
linux.com>
---
 lib/bb/ui/buildinfohelper.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/bb/ui/buildinfohelper.py b/lib/bb/ui/buildinfohelper.py
index 8b212b780..4ee45d67a 100644
--- a/lib/bb/ui/buildinfohelper.py
+++ b/lib/bb/ui/buildinfohelper.py
@@ -559,7 +559,10 @@ class ORMWrapper(object):
                 # we might have an invalid link; no way to detect this. ju=
st set it to None
                 filetarget_obj =3D None
=20
-            parent_obj =3D Target_File.objects.get(target =3D target_obj, =
path =3D parent_path, inodetype =3D Target_File.ITYPE_DIRECTORY)
+            try:
+                parent_obj =3D Target_File.objects.get(target =3D target_o=
bj, path =3D parent_path, inodetype =3D Target_File.ITYPE_DIRECTORY)
+            except Target_File.DoesNotExist:
+                parent_obj =3D None
=20
             Target_File.objects.create(
                         target =3D target_obj,
--=20
2.34.1