summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-13 04:26:40 -1000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-09-16 17:53:22 +0100
commit9c26cd5d7049f5eb1e1ed68e67f5a4582e34045e (patch)
treeb3ecba84ba3c65e19f359e7851f268960d7fbf78 /bitbake
parent34ce1874911fcb34052ab6c032e1b342e51f9567 (diff)
downloadpoky-9c26cd5d7049f5eb1e1ed68e67f5a4582e34045e.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: ff3afb1c1bb236c4a52c62a74f2917071e0af55b) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit eff16e474ee7dc49ae433420a4c8d15d3314a618) Signed-off-by: Steve Sakoman <steve@sakoman.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-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 ac557176d7..a31406263f 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)