summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2010-12-06 20:26:08 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2011-03-01 11:46:39 +0000
commit2c69cb07e97cd46f1cb45f1af06bfbc4ea889499 (patch)
treeff5e8fb3f1d5ac4e09a76fc4f6fcb1412858414b
parentc7ef433f78d67ddd0da1b7be8c1a8fdc7cf6bac2 (diff)
downloadopenembedded-core-2c69cb07e97cd46f1cb45f1af06bfbc4ea889499.tar.gz
openembedded-core-2c69cb07e97cd46f1cb45f1af06bfbc4ea889499.tar.bz2
openembedded-core-2c69cb07e97cd46f1cb45f1af06bfbc4ea889499.tar.xz
openembedded-core-2c69cb07e97cd46f1cb45f1af06bfbc4ea889499.zip
package.bbclass: Use hard link for package split instead of copy
When doing package split, we use hard link instead of copy, which can save about 10% disk space when building poky-image-minimal. If fail, it will fall back to the copyfile function. [Updated by Richard to use os.link and avoid an exec() call per file] Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com>
-rw-r--r--meta/classes/package.bbclass15
1 files changed, 3 insertions, 12 deletions
diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index dcece40ac..2f3e9bfd1 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -427,22 +427,13 @@ python populate_packages () {
fpath = os.path.join(root,file)
dpath = os.path.dirname(fpath)
bb.mkdirhier(dpath)
-
- # Check if this is a hardlink to something... if it is
- # attempt to preserve the link information, instead of copy.
if not os.path.islink(file):
- s = os.stat(file)
- if s.st_nlink > 1:
- file_reference = "%d_%d" % (s.st_dev, s.st_ino)
- if file_reference not in file_links:
- # Save the reference for next time...
- file_links[file_reference] = fpath
- else:
- os.link(file_links[file_reference], fpath)
- continue
+ os.link(file, fpath)
+ continue
ret = bb.copyfile(file, fpath)
if ret is False or ret == 0:
raise bb.build.FuncFailed("File population failed")
+
del localdata
os.chdir(workdir)