From 829bb416b8a4556f735b1d2da7971442b0d0cb8e Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Thu, 14 Jul 2022 13:20:17 +0100 Subject: [PATCH] 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 --- bitbake/lib/bb/fetch2/__init__.py | 2 ++ 1 file changed, 2 insertions(+) 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): def ensure_symlink(target, link_name): if not os.path.exists(link_name): + dirname = os.path.dirname(link_name) + bb.utils.mkdirhier(dirname) if os.path.islink(link_name): # Broken symbolic link os.unlink(link_name)