Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH 0/1] sstate.bbclass: make hard links for staging files
@ 2013-04-27  9:32 Robert Yang
  2013-04-27  9:32 ` [PATCH 1/1] " Robert Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Yang @ 2013-04-27  9:32 UTC (permalink / raw)
  To: openembedded-core

The following changes since commit addcfcda84ed6b43b00f569a6060e3b78196ef52:

  glib-2.0: disable tests for native builds, and respect ptest for LSB (2013-04-23 13:00:43 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib robert/hardlink
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=robert/hardlink

Robert Yang (1):
  sstate.bbclass: make hard links for staging files

 meta/classes/sstate.bbclass |    2 +-
 meta/lib/oe/path.py         |    9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

-- 
1.7.10.4




^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 1/1] sstate.bbclass: make hard links for staging files
  2013-04-27  9:32 [PATCH 0/1] sstate.bbclass: make hard links for staging files Robert Yang
@ 2013-04-27  9:32 ` Robert Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Robert Yang @ 2013-04-27  9:32 UTC (permalink / raw)
  To: openembedded-core

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]

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
 meta/classes/sstate.bbclass |    2 +-
 meta/lib/oe/path.py         |    9 +++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 67ddc46..0358d14 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -198,7 +198,7 @@ def sstate_install(ss, d):
     # Run the actual file install
     for state in ss['dirs']:
         if os.path.exists(state[1]):
-            oe.path.copytree(state[1], state[2])
+            oe.path.copyhardlinktree(state[1], state[2])
 
     for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split():
         bb.build.exec_func(postinst, d)
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index faa0f61..4f8b66c 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"""
-- 
1.7.10.4




^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-27  9:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27  9:32 [PATCH 0/1] sstate.bbclass: make hard links for staging files Robert Yang
2013-04-27  9:32 ` [PATCH 1/1] " Robert Yang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox