[PATCH] Add exception treatment to fix missing target_file

Marlon Rodriguez Garcia <[email protected]> Thu, 23 May 2024 10:55:41 -0400
Newsgroups org.yoctoproject.lists.toaster,org.openembedded.lists.bitbake-devel
Message-ID <20240523145541.198353-1-marlon.rodriguez-garcia@savoirfairelinux.com>
Based on the discution on  https://lists.yoctoproject.org/g/toaster/messa=
ge/6157 in some cases the value for Target_file could be missing and is n=
eeded to bypass it to finish build

Signed-off-by: Marlon Rodriguez Garcia <marlon.rodriguez-garcia@savoirfai=
relinux.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. =
just 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=
_obj, 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