]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
image.bbclass: remove hardlinks as well
authorMartin Jansa <martin.jansa@gmail.com>
Sat, 18 Nov 2023 21:17:21 +0000 (22:17 +0100)
committerMartin Jansa <martin.jansa@gmail.com>
Fri, 12 Jul 2024 07:36:57 +0000 (09:36 +0200)
* 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

index cb2e439b4bfaec05c9010cf72e2f8022188d07dc..7695b59f26da6adc513dd983af67c8d243df67ae 100644 (file)
@@ -602,7 +602,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: