aboutsummaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2013-04-27 05:32:07 -0400
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-07-08 10:30:20 +0100
commit729439d3b00bab2d061bbc9d5d7a375eb014b192 (patch)
treeb23ff9ed71ed3e18f51285b596e7d8bfc85b937e /meta/lib
parent94ba93a04099866af91bfc86dca0633e7fef8ffb (diff)
downloadopenembedded-core-729439d3b00bab2d061bbc9d5d7a375eb014b192.tar.gz
sstate.bbclass: make hard links for staging files
Make hard links for staging files instead of copy to save the disk space (3G will be saved for a core-image-sato build), and it doesn't affect much on the build time. The following directories are affected: 1) The sysroot 2) The DEPLOY_DIR 3) The pkgdata [YOCTO #4372] (From OE-Core master rev: 5853e0f482b22258c909268fe71673a29e31989b) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/path.py9
1 files changed, 7 insertions, 2 deletions
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):
check_output(cmd, shell=True, stderr=subprocess.STDOUT)
def copyhardlinktree(src, dst):
+ """ Make the hard link when possible, otherwise copy. """
bb.utils.mkdirhier(dst)
+ src_bak = src
if os.path.isdir(src):
if not len(os.listdir(src)):
return
src = src + "/*"
- cmd = 'cp -al %s %s' % (src, dst)
- check_output(cmd, shell=True, stderr=subprocess.STDOUT)
+ if (os.stat(src_bak).st_dev == os.stat(dst).st_dev):
+ cmd = 'cp -afl %s %s' % (src, dst)
+ check_output(cmd, shell=True, stderr=subprocess.STDOUT)
+ else:
+ copytree(src_bak, dst)
def remove(path, recurse=True):
"""Equivalent to rm -f or rm -rf"""