diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2013-04-27 05:32:07 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-05-02 17:41:53 +0100 |
commit | c51e8b4532361b11fe73c28613653c0f5aaf566b (patch) | |
tree | 5d692ff27be5a1ec6cf858cc7b9ae6f044cbeb8e /meta/lib/oe/path.py | |
parent | 3dfbedbddeef009bef8da3c18a1eaa8293e22940 (diff) | |
download | poky-c51e8b4532361b11fe73c28613653c0f5aaf566b.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 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/oe/path.py')
-rw-r--r-- | meta/lib/oe/path.py | 9 |
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): | |||
85 | check_output(cmd, shell=True, stderr=subprocess.STDOUT) | 85 | check_output(cmd, shell=True, stderr=subprocess.STDOUT) |
86 | 86 | ||
87 | def copyhardlinktree(src, dst): | 87 | def 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 | ||
96 | def remove(path, recurse=True): | 101 | def remove(path, recurse=True): |
97 | """Equivalent to rm -f or rm -rf""" | 102 | """Equivalent to rm -f or rm -rf""" |