]> code.ossystems Code Review - openembedded-core.git/commitdiff
rootfs-postcommands.bbclass: Prevent linking testdata to itself
authorMike Looijmans <mike.looijmans@topic.nl>
Thu, 17 Aug 2017 10:49:49 +0000 (12:49 +0200)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 18 Aug 2017 11:35:56 +0000 (12:35 +0100)
testdata and testdata_link may point to the same file, in particular
when IMAGE_LINK_NAME and IMAGE_NAME are equal.

Check if this is the case before creating a symlink that points to
itself and makes the next build fail.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/rootfs-postcommands.bbclass

index 78f7c559333acae1636e7faf32c0a427e09cfb0b..c92df7b0de8d8c5a43ff28a48eaa39b4d20b4aa2 100644 (file)
@@ -300,7 +300,8 @@ python write_image_test_data() {
     searchString = "%s/"%(d.getVar("TOPDIR")).replace("//","/")
     export2json(d, testdata,searchString=searchString,replaceString="")
 
-    if os.path.lexists(testdata_link):
-       os.remove(testdata_link)
-    os.symlink(os.path.basename(testdata), testdata_link)
+    if testdata_link != testdata:
+        if os.path.lexists(testdata_link):
+           os.remove(testdata_link)
+        os.symlink(os.path.basename(testdata), testdata_link)
 }