summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/classes/sstate.bbclass2
-rw-r--r--meta/lib/oe/path.py9
2 files changed, 8 insertions, 3 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 67ddc466ce..0358d14e9a 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -198,7 +198,7 @@ def sstate_install(ss, d):
198 # Run the actual file install 198 # Run the actual file install
199 for state in ss['dirs']: 199 for state in ss['dirs']:
200 if os.path.exists(state[1]): 200 if os.path.exists(state[1]):
201 oe.path.copytree(state[1], state[2]) 201 oe.path.copyhardlinktree(state[1], state[2])
202 202
203 for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split(): 203 for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split():
204 bb.build.exec_func(postinst, d) 204 bb.build.exec_func(postinst, d)
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index faa0f61fab..4f8b66c2f3 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -85,13 +85,18 @@ def copytree(src, dst):
85 check_output(cmd, shell=True, stderr=subprocess.STDOUT) 85 check_output(cmd, shell=True, stderr=subprocess.STDOUT)
86 86
87def copyhardlinktree(src, dst): 87def copyhardlinktree(src, dst):
88 """ Make the hard link when possible, otherwise copy. """
88 bb.utils.mkdirhier(dst) 89 bb.utils.mkdirhier(dst)
90 src_bak = src
89 if os.path.isdir(src): 91 if os.path.isdir(src):
90 if not len(os.listdir(src)): 92 if not len(os.listdir(src)):
91 return 93 return
92 src = src + "/*" 94 src = src + "/*"
93 cmd = 'cp -al %s %s' % (src, dst) 95 if (os.stat(src_bak).st_dev == os.stat(dst).st_dev):
94 check_output(cmd, shell=True, stderr=subprocess.STDOUT) 96 cmd = 'cp -afl %s %s' % (src, dst)
97 check_output(cmd, shell=True, stderr=subprocess.STDOUT)
98 else:
99 copytree(src_bak, dst)
95 100
96def remove(path, recurse=True): 101def remove(path, recurse=True):
97 """Equivalent to rm -f or rm -rf""" 102 """Equivalent to rm -f or rm -rf"""