[PATCH] license_image: Prevent do_populate_lic_deploy from using image recipes' recipeinfo
From: Tomasz Dziendzielski <hidden>
Date: 2021-10-26 07:33:02
Subsystem:
the rest · Maintainer:
Linus Torvalds
If image recipe depends on another image recipe it will try to use license recipeinfo that is not deployed. It will result in: | Exception: FileNotFoundError: [Errno 2] No such file or directory: | 'TMPDIR/deploy/licenses/foo-image/recipeinfo' In such case check for image_license.manifest file (which means dep is an image recipe) and skip if true. Signed-off-by: Tomasz Dziendzielski <redacted> Signed-off-by: Jan Brzezanski <redacted> Signed-off-by: Ricardo Rodrigues <redacted> Signed-off-by: Szymon Czarnuch <redacted> Signed-off-by: Kamil Kwiek <redacted> --- meta/classes/license_image.bbclass | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/meta/classes/license_image.bbclass b/meta/classes/license_image.bbclass
index bf70bee99b..cc1d9ea651 100644
--- a/meta/classes/license_image.bbclass
+++ b/meta/classes/license_image.bbclass@@ -201,10 +201,17 @@ def license_deployed_manifest(d): man_dic[dep]["PN"] = dep man_dic[dep]["FILES"] = \ " ".join(get_deployed_files(dep_dic[dep])) - with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f: - for line in f.readlines(): - key,val = line.split(": ", 1) - man_dic[dep][key] = val[:-1] + try: + with open(os.path.join(lic_dir, dep, "recipeinfo"), "r") as f: + for line in f.readlines(): + key,val = line.split(": ", 1) + man_dic[dep][key] = val[:-1] + except FileNotFoundError: + if os.path.exists(os.path.join( + lic_dir, "%s-%s" % (dep, d.getVar("MACHINE")), "image_license.manifest")): + del man_dic[dep] + else: + raise lic_manifest_dir = os.path.join(d.getVar('LICENSE_DIRECTORY'), d.getVar('IMAGE_NAME'))
--
2.33.0