- os.path.isdir() follows symlinks, so symlinks to directories were
passed to shutil.rmtree() which raises:
File "scripts/lib/devtool/upgrade.py", line 280, in _extract_new_source
shutil.rmtree(itempath)
File "/usr/lib/python3.12/shutil.py", line 802, in rmtree
onexc(os.path.islink, path, err)
File "/usr/lib/python3.12/shutil.py", line 800, in rmtree
raise OSError("Cannot call rmtree on a symbolic link")
- Same issue reported on AUH while upgrading for man-pages
- Add check for symlinks first and use os.remove() on them.
Signed-off-by: Jaipaul Cheernam <[email protected]>
---
scripts/lib/devtool/upgrade.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 523acf4250..5c2e6ebd46 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -276,7 +276,9 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev,
srcbranch, branch, kee
if item in ['.git', 'oe-local-files']:
continue
itempath = os.path.join(srctree, item)
- if os.path.isdir(itempath):
+ if os.path.islink(itempath):
+ os.remove(itempath)
+ elif os.path.isdir(itempath):
shutil.rmtree(itempath)
else:
os.remove(itempath)
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#244378):
https://lists.openembedded.org/g/openembedded-core/message/244378
Mute This Topic: https://lists.openembedded.org/mt/120934046/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-