qemuboot.bbclass: Prevent creating a link loop

When IMAGE_NAME and IMAGE_LINK_NAME are equal, do_write_qemuboot_conf will
create a symlink that links to itself.

Check if this is the case before creating the link.

(From OE-Core rev: f46652e77f467861dc68c3a8e54f27d08659222d)

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 15:43:18 +02:00
committed by Richard Purdie
parent 1f033e4442
commit 322985be23

View File

@@ -114,7 +114,8 @@ python do_write_qemuboot_conf() {
with open(qemuboot, 'w') as f:
cf.write(f)
if os.path.lexists(qemuboot_link):
os.remove(qemuboot_link)
os.symlink(os.path.basename(qemuboot), qemuboot_link)
if qemuboot_link != qemuboot:
if os.path.lexists(qemuboot_link):
os.remove(qemuboot_link)
os.symlink(os.path.basename(qemuboot), qemuboot_link)
}