fetch2: Copy out-of-tree files instead of symlinking
PATCH 1/1 fetch2: Copy out-of-tree files instead of symlinking
From: Thomas Axelsson <[email protected]>
If not doing this, generating a file mirror using BB_GENERATE_MIRROR_TARBALLS will not generate a complete mirror due to out-of-tree symlinks, and patching files may fail, due to source file permissions.
--- lib/bb/fetch2/__init__.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
lib/bb/fetch2/__init__.py +13 -1
@@ -35,6 +35,7 @@ import collections import subprocess import pickle +import shutil import bb.persist_data, bb.utils import bb.checksum from bb import data
@@ -982,7 +983,18 @@ def try_mirror_url(fetch, origud, ud, ld, check = False): # Broken symbolic link os.unlink(origud.localpath) - os.symlink(ud.localpath, origud.localpath) + # Copy out-of-tree files into the tree, so the local download dir will be complete + copyfile = True + bblayers = re.split(' +', ld.getVar("BBLAYERS", True).strip()) + for layerpath in bblayers: + if ud.localpath.startswith(layerpath): + copyfile = False + break + + if copyfile: + shutil.copyfile(ud.localpath, origud.localpath) + else: + os.symlink(ud.localpath, origud.localpath) update_stamp(origud, ld) return ud.localpath
Signature · 1 line
1.9.1