rootfs-postcommands.bbclass: Prevent linking testdata to itself

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.

(From OE-Core rev: f8ceec50af68650d6548738e5b5582e2b25424d7)

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Mike Looijmans 2017-08-17 12:49:49 +02:00 committed by Richard Purdie
parent 87b52832e8
commit 9842f64154
1 changed files with 4 additions and 3 deletions

View File

@ -298,7 +298,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)
}