[poky] [PATCH 1/3] package.bbclass: Use hard link for package split instead of copy

Dongxiao Xu dongxiao.xu at intel.com
Mon Dec 6 04:26:08 PST 2010


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.

Signed-off-by: Dongxiao Xu <dongxiao.xu at intel.com>
---
 meta/classes/package.bbclass |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index d39c694..2b4747b 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -406,9 +406,11 @@ python populate_packages () {
 			fpath = os.path.join(root,file)
 			dpath = os.path.dirname(fpath)
 			bb.mkdirhier(dpath)
-			ret = bb.copyfile(file, fpath)
-			if ret is False or ret == 0:
-				raise bb.build.FuncFailed("File population failed")
+			ret = os.system("ln -f %s %s" % (file, fpath))
+			if ret is False:
+				ret = bb.copyfile(file, fpath)
+				if ret is False or ret == 0:
+					raise bb.build.FuncFailed("File population failed")
 		del localdata
 	os.chdir(workdir)
 
-- 
1.6.3.3




More information about the poky mailing list