@@ -117,12 +117,11 @@ python do_install_ptest_cargo() {
if not script_exists:
os.chmod(ptest_script, 0o755)
- # this is chown -R root:root ${D}${PTEST_PATH}
+ # Equivalent to 'chown -R root:root ${D}${PTEST_PATH}, which doesn't follow
+ # symlinks
for root, dirs, files in os.walk(ptest_dir):
- for d in dirs:
- shutil.chown(os.path.join(root, d), "root", "root")
- for f in files:
- shutil.chown(os.path.join(root, f), "root", "root")
+ for name in dirs + files:
+ os.lchown(os.path.join(root, name), 0, 0)
}
do_compile_ptest_cargo[dirs] = "${B}"
Use os.lchown() instead of shutil.chown(), as the former follows symlinks. os.lchown changes the owner of the link itself. shutil.chown() didn't add the follow_symlinks option until Python 3.13[1], so we can't just add that argument. [1]: https://docs.python.org/3/library/shutil.html#shutil.chown AI-Generated: Uses Claude Opus 5.5 Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com> --- meta/classes-recipe/ptest-cargo.bbclass | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)