summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2010-12-06 20:26:08 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-25 15:58:42 +0000
commit0d0279a88141616e08515916f4a0e6d9a3e326dd (patch)
treeec608530562b66562cb63c4915992bd41e2b9250 /meta
parentaba80f536f2259df48dc7f8f8c52e5937c296c63 (diff)
downloadpoky-0d0279a88141616e08515916f4a0e6d9a3e326dd.tar.gz
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>
Diffstat (limited to 'meta')
-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 dcece40acd..2f3e9bfd14 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -427,22 +427,13 @@ python populate_packages () {
427 fpath = os.path.join(root,file) 427 fpath = os.path.join(root,file)
428 dpath = os.path.dirname(fpath) 428 dpath = os.path.dirname(fpath)
429 bb.mkdirhier(dpath) 429 bb.mkdirhier(dpath)
430
431 # Check if this is a hardlink to something... if it is
432 # attempt to preserve the link information, instead of copy.
433 if not os.path.islink(file): 430 if not os.path.islink(file):
434 s = os.stat(file) 431 os.link(file, fpath)
435 if s.st_nlink > 1: 432 continue
436 file_reference = "%d_%d" % (s.st_dev, s.st_ino)
437 if file_reference not in file_links:
438 # Save the reference for next time...
439 file_links[file_reference] = fpath
440 else:
441 os.link(file_links[file_reference], fpath)
442 continue
443 ret = bb.copyfile(file, fpath) 433 ret = bb.copyfile(file, fpath)
444 if ret is False or ret == 0: 434 if ret is False or ret == 0:
445 raise bb.build.FuncFailed("File population failed") 435 raise bb.build.FuncFailed("File population failed")
436
446 del localdata 437 del localdata
447 os.chdir(workdir) 438 os.chdir(workdir)
448 439