[bitbake-devel] [PATCH] fetch2: Copy out-of-tree files instead of symlinking

John Ernberg john.ernberg at actia.se
Thu Dec 8 08:38:02 UTC 2016


From: Thomas Axelsson <thomas.axelsson at actia.se>

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(-)

diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py
index d6d7850..2ab0ba3 100644
--- a/lib/bb/fetch2/__init__.py
+++ b/lib/bb/fetch2/__init__.py
@@ -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
 
-- 
1.9.1



More information about the bitbake-devel mailing list