summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/lib/oe/path.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 4f8b66c2f3..76a6ed8314 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -87,16 +87,20 @@ def copytree(src, dst):
87def copyhardlinktree(src, dst): 87def copyhardlinktree(src, dst):
88 """ Make the hard link when possible, otherwise copy. """ 88 """ Make the hard link when possible, otherwise copy. """
89 bb.utils.mkdirhier(dst) 89 bb.utils.mkdirhier(dst)
90 src_bak = src 90 if os.path.isdir(src) and not len(os.listdir(src)):
91 if os.path.isdir(src): 91 return
92 if not len(os.listdir(src)): 92
93 return 93 if (os.stat(src).st_dev == os.stat(dst).st_dev):
94 src = src + "/*" 94 # Need to copy directories only with tar first since cp will error if two
95 if (os.stat(src_bak).st_dev == os.stat(dst).st_dev): 95 # writers try and create a directory at the same time
96 cmd = 'cd %s; find . -type d -print | tar -cf - -C %s -ps --files-from - | tar -xf - -C %s' % (src, src, dst)
97 check_output(cmd, shell=True, stderr=subprocess.STDOUT)
98 if os.path.isdir(src):
99 src = src + "/*"
96 cmd = 'cp -afl %s %s' % (src, dst) 100 cmd = 'cp -afl %s %s' % (src, dst)
97 check_output(cmd, shell=True, stderr=subprocess.STDOUT) 101 check_output(cmd, shell=True, stderr=subprocess.STDOUT)
98 else: 102 else:
99 copytree(src_bak, dst) 103 copytree(src, dst)
100 104
101def remove(path, recurse=True): 105def remove(path, recurse=True):
102 """Equivalent to rm -f or rm -rf""" 106 """Equivalent to rm -f or rm -rf"""