summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavide Gardenal <davidegarde2000@gmail.com>2022-05-04 10:39:04 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-12 16:42:13 +0100
commit8402f346fc100ad71ef2bd0200a9a633b3c78f2c (patch)
tree405432a344126a0dead5f5ddb4516560eb49e2e8
parent431002a1361e46aa8708a09a99ed6342545bdd5d (diff)
downloadpoky-8402f346fc100ad71ef2bd0200a9a633b3c78f2c.tar.gz
rootfs-postcommands: fix symlinks where link and output path are equal
When creating the manifest and the testdata.json links, if the link name is equal to the output name the link is not created, otherwise it is. This prevents a link-to-self in the first case. (From OE-Core rev: aae0ba9a83f4aa0d3812f9fd643a444ece7653f2) 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> (cherry picked from commit bed63756c56f296ff3d5a7eef66e978bd19f1008) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/rootfs-postcommands.bbclass14
1 files changed, 8 insertions, 6 deletions
diff --git a/meta/classes/rootfs-postcommands.bbclass b/meta/classes/rootfs-postcommands.bbclass
index 0452fe4b27..2310e86cdf 100644
--- a/meta/classes/rootfs-postcommands.bbclass
+++ b/meta/classes/rootfs-postcommands.bbclass
@@ -267,9 +267,10 @@ python write_image_manifest () {
267 267
268 if os.path.exists(manifest_name) and link_name: 268 if os.path.exists(manifest_name) and link_name:
269 manifest_link = deploy_dir + "/" + link_name + ".manifest" 269 manifest_link = deploy_dir + "/" + link_name + ".manifest"
270 if os.path.lexists(manifest_link): 270 if manifest_link != manifest_name:
271 os.remove(manifest_link) 271 if os.path.lexists(manifest_link):
272 os.symlink(os.path.basename(manifest_name), manifest_link) 272 os.remove(manifest_link)
273 os.symlink(os.path.basename(manifest_name), manifest_link)
273} 274}
274 275
275# Can be used to create /etc/timestamp during image construction to give a reasonably 276# Can be used to create /etc/timestamp during image construction to give a reasonably
@@ -339,9 +340,10 @@ python write_image_test_data() {
339 340
340 if os.path.exists(testdata_name) and link_name: 341 if os.path.exists(testdata_name) and link_name:
341 testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name) 342 testdata_link = os.path.join(deploy_dir, "%s.testdata.json" % link_name)
342 if os.path.lexists(testdata_link): 343 if testdata_link != testdata_name:
343 os.remove(testdata_link) 344 if os.path.lexists(testdata_link):
344 os.symlink(os.path.basename(testdata_name), testdata_link) 345 os.remove(testdata_link)
346 os.symlink(os.path.basename(testdata_name), testdata_link)
345} 347}
346write_image_test_data[vardepsexclude] += "TOPDIR" 348write_image_test_data[vardepsexclude] += "TOPDIR"
347 349