summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jansa <Martin.Jansa@gmail.com>2012-02-23 15:54:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-02-24 17:06:57 +0000
commitdb94ad4cf32d8ce3e97a8287d1c89a58d008a142 (patch)
tree6ad981af53dd0d7e9286d38b507ab3e4f49436b7
parentc8af05547ed94a700da3475a77ccf243d1b94da8 (diff)
downloadpoky-db94ad4cf32d8ce3e97a8287d1c89a58d008a142.tar.gz
sstate.bbclass: improve performance of sstate package creation
* also fixes replacing paths for perl where cmd line was probably too long for os.system(cmd) (it had 560410 characters because a lot of files from sstate_scan_cmd). * also print those 2 commands so we can find them in log.do_package (From OE-Core rev: 94c52d68fc2ce258bcc5b0978ac73413480a1a93) Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/sstate.bbclass39
1 files changed, 16 insertions, 23 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index ee9bf052ae..d20b62a66e 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -304,38 +304,31 @@ python sstate_cleanall() {
304def sstate_hardcode_path(d): 304def sstate_hardcode_path(d):
305 # Need to remove hardcoded paths and fix these when we install the 305 # Need to remove hardcoded paths and fix these when we install the
306 # staging packages. 306 # staging packages.
307 sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
308 p = os.popen("%s" % sstate_scan_cmd)
309 file_list = p.read()
310
311 if file_list == "":
312 p.close()
313 return
314 307
315 staging = d.getVar('STAGING_DIR', True) 308 staging = d.getVar('STAGING_DIR', True)
316 staging_target = d.getVar('STAGING_DIR_TARGET', True) 309 staging_target = d.getVar('STAGING_DIR_TARGET', True)
317 staging_host = d.getVar('STAGING_DIR_HOST', True) 310 staging_host = d.getVar('STAGING_DIR_HOST', True)
318 sstate_builddir = d.getVar('SSTATE_BUILDDIR', True) 311 sstate_builddir = d.getVar('SSTATE_BUILDDIR', True)
319 312
320 files = " ".join(file_list.split('\n'))
321
322 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d): 313 if bb.data.inherits_class('native', d) or bb.data.inherits_class('nativesdk', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross-canadian', d):
323 cmd = "sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging, files) 314 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIR:g'" % (staging)
324 elif bb.data.inherits_class('cross', d): 315 elif bb.data.inherits_class('cross', d):
325 cmd = "sed -i -e s:%s:FIXMESTAGINGDIRTARGET:g %s \ 316 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g; s:%s:FIXMESTAGINGDIR:g'" % (staging_target, staging)
326 sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging_target, files, staging, files)
327 else: 317 else:
328 cmd = "sed -i -e s:%s:FIXMESTAGINGDIRHOST:g %s" % (staging_host, files) 318 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host)
329 319
330 if files: 320 sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
331 os.system(cmd) 321 sstate_filelist_cmd = "tee %sfixmepath" % (sstate_builddir)
332 fix = open("%sfixmepath" % (sstate_builddir), "w") 322
333 fixme = [] 323 # fixmepath file needs relative paths, drop sstate_builddir prefix
334 for f in file_list.split('\n'): 324 sstate_filelist_relative_cmd = "sed -i -e 's:^%s::g' %sfixmepath" % (sstate_builddir, sstate_builddir)
335 fixme.append(f.replace(sstate_builddir, "")) 325
336 fix.write("\n".join(fixme)) 326 sstate_hardcode_cmd = "%s | %s | xargs %s" % (sstate_scan_cmd, sstate_filelist_cmd, sstate_sed_cmd)
337 fix.close() 327
338 p.close() 328 print "Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)
329 os.system(sstate_hardcode_cmd)
330 print "Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)
331 os.system(sstate_filelist_relative_cmd)
339 332
340def sstate_package(ss, d): 333def sstate_package(ss, d):
341 import oe.path 334 import oe.path