diff mbox series

[19/21] image.bbclass: remove hardlinks as well

Message ID e1b5df456e05f2634c4181b82eeb4520334a9941.1700600804.git.martin.jansa@gmail.com
State New
Headers show
Series [01/21] image*.bbclass, kernel*.bbclass: create version-less artifacts and versioned hard links | expand

Commit Message

Martin Jansa Nov. 22, 2023, 12:44 p.m. UTC
* it was removing only destination symlinks, but sometimes hardlink might be regenerated
  as well, e.g. in oeqa test wic.Wic.test_permissions which was failing with:

NOTE: recipe core-image-minimal-1.0-r0: task do_image_wic: Started
ERROR: core-image-minimal-1.0-r0 do_image_wic: Error executing a python function in exec_func_python() autogenerated:

The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_func_python() autogenerated', lineno: 2, function: <module>
     0001:
 *** 0002:create_hardlinks(d)
     0003:
File: '/OE/build/poky/meta/classes-recipe/image.bbclass', lineno: 606, function: create_hardlinks
     0602:        if os.path.exists(src):
     0603:            bb.note("Creating hardlink: %s -> %s" % (dst, src))
     0604:            if os.path.islink(dst):
     0605:                os.remove(dst)
 *** 0606:            os.link(src, dst)
     0607:        else:
     0608:            bb.note("Skipping hardlink, source does not exist: %s -> %s" % (dst, src))
     0609:}
     0610:
Exception: FileExistsError: [Errno 17] File exists: 'tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/deploy-core-image-minimal-image-complete/core-image-minimal-qemux86-64.rootfs.wic' -> 'tmp/work/qemux86_64-poky-linux/core-image-minimal/1.0/deploy-core-image-minimal-image-complete/core-image-minimal-qemux86-64.rootfs--1.0-r0-20110405230000.wic'

[YOCTO #12937]

Signed-off-by: Martin Jansa <martin.jansa@gmail.com>
---
 meta/classes-recipe/image.bbclass | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass
index e68b8034ea..081f1927fb 100644
--- a/meta/classes-recipe/image.bbclass
+++ b/meta/classes-recipe/image.bbclass
@@ -601,7 +601,7 @@  python create_hardlinks() {
         src = os.path.join(deploy_dir, img_name + "." + type)
         if os.path.exists(src):
             bb.note("Creating hardlink: %s -> %s" % (dst, src))
-            if os.path.islink(dst):
+            if os.path.isfile(dst):
                 os.remove(dst)
             os.link(src, dst)
         else: