summaryrefslogtreecommitdiff
path: root/meta/lib
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:11:19 +0000
commit8e373e69acac853213a62afb8bbdf0adc0c5045a (patch)
treefc15cfacd50fbf63167d308130c4629e8a04e8ac /meta/lib
parentef45d35c1d534770f0e0e6d3e897d3f6062147a2 (diff)
downloadopenembedded-core-8e373e69acac853213a62afb8bbdf0adc0c5045a.tar.gz
openembedded-core-8e373e69acac853213a62afb8bbdf0adc0c5045a.tar.bz2
openembedded-core-8e373e69acac853213a62afb8bbdf0adc0c5045a.zip
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. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/path.py8
1 files changed, 8 insertions, 0 deletions
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):
cmd = 'tar -cf - -C %s -ps . | tar -xf - -C %s' % (src, dst)
check_output(cmd, shell=True, stderr=subprocess.STDOUT)
+def copyhardlinktree(src, dst):
+ bb.utils.mkdirhier(dst)
+ 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)
def remove(path, recurse=True):
"""Equivalent to rm -f or rm -rf"""