summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-03 17:34:54 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-02-06 13:12:59 +0000
commitdd61d225843346f2c4500a54a609e63394f4cc35 (patch)
treedca2c837bdac2c18e7d7b4a47c9b1eb447040117 /meta
parent6c7d6d6c8a35568c7e7db6e32fa86825bd2cda65 (diff)
downloadpoky-dd61d225843346f2c4500a54a609e63394f4cc35.tar.gz
sstate/path.py: Add copyhardlinktree() function and use for performance optimisation
Add a function which copys a tree as a set of hardlinks to the original files, then use this in sstate to reduce some of the overhead of sstate package creation since the file isn't actually copied. (From OE-Core rev: 8e373e69acac853213a62afb8bbdf0adc0c5045a) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/sstate.bbclass4
-rw-r--r--meta/lib/oe/path.py8
2 files changed, 10 insertions, 2 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index a79d2b557e..6f77bb9013 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -458,14 +458,14 @@ def sstate_package(ss, d):
458 dstpath = srcpath.replace(state[1], sstatebuild + state[0]) 458 dstpath = srcpath.replace(state[1], sstatebuild + state[0])
459 make_relative_symlink(srcpath, dstpath, d) 459 make_relative_symlink(srcpath, dstpath, d)
460 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) 460 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
461 oe.path.copytree(state[1], sstatebuild + state[0]) 461 oe.path.copyhardlinktree(state[1], sstatebuild + state[0])
462 462
463 workdir = d.getVar('WORKDIR', True) 463 workdir = d.getVar('WORKDIR', True)
464 for plain in ss['plaindirs']: 464 for plain in ss['plaindirs']:
465 pdir = plain.replace(workdir, sstatebuild) 465 pdir = plain.replace(workdir, sstatebuild)
466 bb.mkdirhier(plain) 466 bb.mkdirhier(plain)
467 bb.mkdirhier(pdir) 467 bb.mkdirhier(pdir)
468 oe.path.copytree(plain, pdir) 468 oe.path.copyhardlinktree(plain, pdir)
469 469
470 d.setVar('SSTATE_BUILDDIR', sstatebuild) 470 d.setVar('SSTATE_BUILDDIR', sstatebuild)
471 d.setVar('SSTATE_PKG', sstatepkg) 471 d.setVar('SSTATE_PKG', sstatepkg)
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py
index 7197b23650..ea58bedc8b 100644
--- a/meta/lib/oe/path.py
+++ b/meta/lib/oe/path.py
@@ -83,6 +83,14 @@ def copytree(src, dst):
83 cmd = 'tar -cf - -C %s -ps . | tar -xf - -C %s' % (src, dst) 83 cmd = 'tar -cf - -C %s -ps . | tar -xf - -C %s' % (src, dst)
84 check_output(cmd, shell=True, stderr=subprocess.STDOUT) 84 check_output(cmd, shell=True, stderr=subprocess.STDOUT)
85 85
86def copyhardlinktree(src, dst):
87 bb.utils.mkdirhier(dst)
88 if os.path.isdir(src):
89 if not len(os.listdir(src)):
90 return
91 src = src + "/*"
92 cmd = 'cp -al %s %s' % (src, dst)
93 check_output(cmd, shell=True, stderr=subprocess.STDOUT)
86 94
87def remove(path, recurse=True): 95def remove(path, recurse=True):
88 """Equivalent to rm -f or rm -rf""" 96 """Equivalent to rm -f or rm -rf"""