Error executing a python function in exec_func_python
Question
ERROR: linux-libc-headers-5.10-custom-r0 do_patch: 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:extend_recipe_sysroot(d)
0003:
File: '/data/home/baifudong/rk3326/sdk-minimal/external/poky/meta/classes/staging.bbclass', lineno: 596, function: extend_recipe_sysroot
0592: dest = newmanifest[l]
0593: m.write(dest.replace(workdir + "/", "") + "\n")
0594: bb.utils.unlockfile(smlock)
0595: try:
*** 0596: os.link(sharedm, taskmanifest)
0597: except OSError as err:
0598: if err.errno == errno.EXDEV:
0599: bb.utils.copyfile(sharedm, taskmanifest)
0600: else:
Exception: FileExistsError: [Errno 17] File exists: '/data/home/baifudong/rk3326/sdk-minimal/build-rk3326-soc/tmp/sysroots-components/manifests/attr-native.82d661571f286c20b0ed1c38d297334f2f75f2b7dca69115056bec9582639782' -> '/data/home/baifudong/rk3326/sdk-minimal/build-rk3326-soc/tmp/work/aarch64-uhos-linux/linux-libc-headers/5.10-custom-r0/recipe-sysroot-native/installeddeps/attr-native.82d661571f286c20b0ed1c38d297334f2f75f2b7dca69115056bec9582639782'
ERROR: Logfile of failure stored in: /data/home/baifudong/rk3326/sdk-minimal/build-rk3326-soc/tmp/work/aarch64-uhos-linux/linux-libc-headers/5.10-custom-r0/temp/log.do_patch.466
ERROR: Task (/data/home/baifudong/rk3326/sdk-minimal/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10-custom.bb:do_patch) failed with exit code '1'
NOTE: Tasks Summary: Attempted 2364 tasks of which 0 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/data/home/baifudong/rk3326/sdk-minimal/bsp/meta-rockchip/recipes-kernel/linux-libc-headers/linux-libc-headers_5.10-custom.bb:do_patch
Summary: There were 21 WARNING messages.
Summary: There was 1 ERROR message, returning a non-zero exit code.
Answer
poky/meta/classes/staging.bbclass
meta/classes/staging.bbclass
@@ -159,6 +159,9 @@ def staging_copyfile(c, target, dest, postinsts, seendirs):
except OSError as err:
if err.errno == errno.EXDEV:
bb.utils.copyfile(c, dest)
+ if err.errno == errno.EEXIST:
+ os.remove(dest)
+ os.link(c, dest)
else:
raise
return dest
@@ -597,6 +600,9 @@ python extend_recipe_sysroot() {
except OSError as err:
if err.errno == errno.EXDEV:
bb.utils.copyfile(sharedm, taskmanifest)
+ if err.errno == errno.EEXIST:
+ os.remove(taskmanifest)
+ os.link(sharedm, taskmanifest)
else:
raise