summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Gardenal <davidegarde2000@gmail.com>2022-04-14 15:27:47 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-04-19 14:14:12 +0100
commit41fd30c43065da377ccba49860da5bdd53e415ab (patch)
treeb4894a7bc17caa7abe14f4dd1ec4116d50bb2bbb
parentf72889eb00fbb6be645f6c67012c2d81b7a06b64 (diff)
downloadpoky-41fd30c43065da377ccba49860da5bdd53e415ab.tar.gz
create-spdx: fix error when symlink cannot be created
If IMAGE_NAME and IMAGE_LINK_NAME are the same an exception is raised in image_combine_spdx because it cannot create a symlink with the same exact path of the original file. In that case there is no point in creating a link in the first place. Refactor image_combine_spdx to avoid code duplication (From OE-Core rev: 88f76bba705007a7fcda506c79f743060d8f2e52) Signed-off-by: Davide Gardenal <davide.gardenal@huawei.com> Signed-off-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/create-spdx.bbclass10
1 files changed, 4 insertions, 6 deletions
diff --git a/meta/classes/create-spdx.bbclass b/meta/classes/create-spdx.bbclass
index 137db81a5b..47a8764bf0 100644
--- a/meta/classes/create-spdx.bbclass
+++ b/meta/classes/create-spdx.bbclass
@@ -835,16 +835,14 @@ python image_combine_spdx() {
835 835
836 combine_spdx(d, image_name, imgdeploydir, img_spdxid, packages) 836 combine_spdx(d, image_name, imgdeploydir, img_spdxid, packages)
837 837
838 if image_link_name:
839 image_spdx_path = imgdeploydir / (image_name + ".spdx.json")
840 image_spdx_link = imgdeploydir / (image_link_name + ".spdx.json")
841 image_spdx_link.symlink_to(os.path.relpath(image_spdx_path, image_spdx_link.parent))
842
843 def make_image_link(target_path, suffix): 838 def make_image_link(target_path, suffix):
844 if image_link_name: 839 if image_link_name:
845 link = imgdeploydir / (image_link_name + suffix) 840 link = imgdeploydir / (image_link_name + suffix)
846 link.symlink_to(os.path.relpath(target_path, link.parent)) 841 if link != target_path:
842 link.symlink_to(os.path.relpath(target_path, link.parent))
847 843
844 image_spdx_path = imgdeploydir / (image_name + ".spdx.json")
845 make_image_link(image_spdx_path, ".spdx.json")
848 spdx_tar_path = imgdeploydir / (image_name + ".spdx.tar.zst") 846 spdx_tar_path = imgdeploydir / (image_name + ".spdx.tar.zst")
849 make_image_link(spdx_tar_path, ".spdx.tar.zst") 847 make_image_link(spdx_tar_path, ".spdx.tar.zst")
850 spdx_index_path = imgdeploydir / (image_name + ".spdx.index.json") 848 spdx_index_path = imgdeploydir / (image_name + ".spdx.index.json")