From fdb3d80011f23b009acc8a56f372dfe99e303f59 Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Sat, 18 Nov 2023 22:17:21 +0100 Subject: [PATCH] image.bbclass: remove hardlinks as well * 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: 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 --- meta/classes-recipe/image.bbclass | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/classes-recipe/image.bbclass b/meta/classes-recipe/image.bbclass index cb2e439b4bf..7695b59f26d 100644 --- a/meta/classes-recipe/image.bbclass +++ b/meta/classes-recipe/image.bbclass @@ -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: -- 2.47.2