summaryrefslogtreecommitdiff
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2011-03-29 00:20:31 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-07-12 14:38:53 +0100
commitc5913c644d10470e2c3c8b55cf044995fc109d87 (patch)
tree245d488e5838fe253c03bb4dc6c7f541b343dcc5 /meta/classes/sstate.bbclass
parenta4ef9a33c87ef8f8fed6f6aec6998c4a9ce17154 (diff)
downloadopenembedded-core-c5913c644d10470e2c3c8b55cf044995fc109d87.tar.gz
openembedded-core-c5913c644d10470e2c3c8b55cf044995fc109d87.tar.bz2
openembedded-core-c5913c644d10470e2c3c8b55cf044995fc109d87.tar.xz
openembedded-core-c5913c644d10470e2c3c8b55cf044995fc109d87.zip
sstate: Improve performance by moving files rather than using copy and delete
Acked-by: Joshua Lock <josh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass16
1 files changed, 11 insertions, 5 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 0daaf4846..62c7c4327 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -147,6 +147,13 @@ def sstate_install(ss, d):
def sstate_installpkg(ss, d):
import oe.path
+ def prepdir(dir):
+ # remove dir if it exists, ensure any parent directories do exist
+ if os.path.exists(dir):
+ oe.path.remove(dir)
+ bb.mkdirhier(dir)
+ oe.path.remove(dir)
+
sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d)
sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz"
@@ -178,9 +185,8 @@ def sstate_installpkg(ss, d):
os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file))
for state in ss['dirs']:
- if os.path.exists(state[1]):
- oe.path.remove(state[1])
- oe.path.copytree(sstateinst + state[0], state[1])
+ prepdir(state[1])
+ os.rename(sstateinst + state[0], state[1])
sstate_install(ss, d)
for plain in ss['plaindirs']:
@@ -188,8 +194,8 @@ def sstate_installpkg(ss, d):
src = sstateinst + "/" + plain.replace(workdir, '')
dest = plain
bb.mkdirhier(src)
- bb.mkdirhier(dest)
- oe.path.copytree(src, dest)
+ prepdir(dest)
+ os.rename(src, dest)
return True