diff options
author | Hombourger, Cedric <Cedric_Hombourger@mentor.com> | 2020-11-18 16:36:13 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-11-24 15:26:12 +0000 |
commit | 53217b1121da0bc9895edce16cc483dd1f166cc0 (patch) | |
tree | 8e591c039447588b34f051a936e6596c650d9fda | |
parent | 7ae3a24079384573bb988bcd1f065548c05b13fd (diff) | |
download | poky-53217b1121da0bc9895edce16cc483dd1f166cc0.tar.gz poky-53217b1121da0bc9895edce16cc483dd1f166cc0.tar.bz2 poky-53217b1121da0bc9895edce16cc483dd1f166cc0.zip |
bitbake: fetch2: use relative symlinks for anything pulled from PREMIRRORS
try_mirror_url() creates a symlink named as the original file to make
everything look like files specified in SRC_URI were downloaded from
their original location. The link is however created as an absolute
reference, this makes DL_DIR non-relocatable. This also causes issues
with the Isar project since it bind mounts DL_DIR to /downloads to
perform some of its build tasks in a chrooted environment (rendering
all symbolic links from DL_DIR invalid). Modify ensure_symlink() to
take an optional "relative" argument and have that function use
os.path.relpath() to produce a relative symlink.
(Bitbake rev: 481e66ea8fc2fc91903127d66b0f1b0fe86baedb)
Signed-off-by: Cedric Hombourger <Cedric_Hombourger@mentor.com>
Cc: Chris Larson <Chris_Larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/fetch2/__init__.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bitbake/lib/bb/fetch2/__init__.py b/bitbake/lib/bb/fetch2/__init__.py index 07b7ae41b4..290773072f 100644 --- a/bitbake/lib/bb/fetch2/__init__.py +++ b/bitbake/lib/bb/fetch2/__init__.py @@ -1021,7 +1021,8 @@ def try_mirror_url(fetch, origud, ud, ld, check = False): origud.method.build_mirror_data(origud, ld) return origud.localpath # Otherwise the result is a local file:// and we symlink to it - ensure_symlink(ud.localpath, origud.localpath) + ensure_symlink(ud.localpath, origud.localpath, relative=True) + update_stamp(origud, ld) return ud.localpath @@ -1055,7 +1056,7 @@ def try_mirror_url(fetch, origud, ud, ld, check = False): bb.utils.unlockfile(lf) -def ensure_symlink(target, link_name): +def ensure_symlink(target, link_name, relative=False): if not os.path.exists(link_name): if os.path.islink(link_name): # Broken symbolic link @@ -1066,6 +1067,8 @@ def ensure_symlink(target, link_name): # same time, in which case we do not want the second task to # fail when the link has already been created by the first task. try: + if relative is True: + target = os.path.relpath(target, os.path.dirname(link_name)) os.symlink(target, link_name) except FileExistsError: pass |