From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: openembedded-core <openembedded-core@lists.openembedded.org>
Subject: [PATCH] sstate: Improve performance by moving files rather than using copy and delete
Date: Mon, 11 Jul 2011 16:48:18 +0100 [thread overview]
Message-ID: <1310399298.20015.969.camel@rex> (raw)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
meta/classes/sstate.bbclass | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 0daaf48..62c7c43 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
--
1.7.4.1
next reply other threads:[~2011-07-11 15:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-11 15:48 Richard Purdie [this message]
2011-07-11 16:59 ` [PATCH] sstate: Improve performance by moving files rather than using copy and delete Joshua Lock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310399298.20015.969.camel@rex \
--to=richard.purdie@linuxfoundation.org \
--cc=openembedded-core@lists.openembedded.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox