summaryrefslogtreecommitdiffstats
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 15:00:45 +0100
commitedb24230851bf1c7276c48853ed387b1443e8105 (patch)
treef3365275c32d4cfb855deb29716be771c47400dd /meta/classes/sstate.bbclass
parent84d4af1f411742d321311066067e1384779fa700 (diff)
downloadpoky-edb24230851bf1c7276c48853ed387b1443e8105.tar.gz
sstate: Improve performance by moving files rather than using copy and delete
Acked-by: Joshua Lock <josh@linux.intel.com> (From OE-Core rev: c5913c644d10470e2c3c8b55cf044995fc109d87) 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 0daaf4846e..62c7c4327e 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -147,6 +147,13 @@ def sstate_install(ss, d):
147def sstate_installpkg(ss, d): 147def sstate_installpkg(ss, d):
148 import oe.path 148 import oe.path
149 149
150 def prepdir(dir):
151 # remove dir if it exists, ensure any parent directories do exist
152 if os.path.exists(dir):
153 oe.path.remove(dir)
154 bb.mkdirhier(dir)
155 oe.path.remove(dir)
156
150 sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d) 157 sstateinst = bb.data.expand("${WORKDIR}/sstate-install-%s/" % ss['name'], d)
151 sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz" 158 sstatepkg = bb.data.getVar('SSTATE_PKG', d, True) + '_' + ss['name'] + ".tgz"
152 159
@@ -178,9 +185,8 @@ def sstate_installpkg(ss, d):
178 os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file)) 185 os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file))
179 186
180 for state in ss['dirs']: 187 for state in ss['dirs']:
181 if os.path.exists(state[1]): 188 prepdir(state[1])
182 oe.path.remove(state[1]) 189 os.rename(sstateinst + state[0], state[1])
183 oe.path.copytree(sstateinst + state[0], state[1])
184 sstate_install(ss, d) 190 sstate_install(ss, d)
185 191
186 for plain in ss['plaindirs']: 192 for plain in ss['plaindirs']:
@@ -188,8 +194,8 @@ def sstate_installpkg(ss, d):
188 src = sstateinst + "/" + plain.replace(workdir, '') 194 src = sstateinst + "/" + plain.replace(workdir, '')
189 dest = plain 195 dest = plain
190 bb.mkdirhier(src) 196 bb.mkdirhier(src)
191 bb.mkdirhier(dest) 197 prepdir(dest)
192 oe.path.copytree(src, dest) 198 os.rename(src, dest)
193 199
194 return True 200 return True
195 201