summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/__init__.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-14 13:20:17 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-07-15 12:22:08 +0100
commit829bb416b8a4556f735b1d2da7971442b0d0cb8e (patch)
tree26d2275d9da221f60ad609ff5070293079c27f54 /bitbake/lib/bb/fetch2/__init__.py
parent9b398909bd446c32923e80125c4555463f87fa8e (diff)
downloadpoky-829bb416b8a4556f735b1d2da7971442b0d0cb8e.tar.gz
bitbake: fetch2: Ensure directory exists before creating symlink
If the mirrors code is trying to create a symlink and the parent directory doesn't exist, as might be the case for sstate mirrors where the fetch is into a subdir, it can silently fail. Ensure the directory exists in this case to avoid issues. (Bitbake rev: eff16e474ee7dc49ae433420a4c8d15d3314a618) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/fetch2/__init__.py')
-rw-r--r--bitbake/lib/bb/fetch2/__init__.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py
index cd7dc4f132..c1523fc1c1 100644
--- a/bitbake/lib/bb/fetch2/__init__.py
+++ b/bitbake/lib/bb/fetch2/__init__.py
@@ -1097,6 +1097,8 @@ def try_mirror_url(fetch, origud, ud, ld, check = False):
1097 1097
1098def ensure_symlink(target, link_name): 1098def ensure_symlink(target, link_name):
1099 if not os.path.exists(link_name): 1099 if not os.path.exists(link_name):
1100 dirname = os.path.dirname(link_name)
1101 bb.utils.mkdirhier(dirname)
1100 if os.path.islink(link_name): 1102 if os.path.islink(link_name):
1101 # Broken symbolic link 1103 # Broken symbolic link
1102 os.unlink(link_name) 1104 os.unlink(link_name)