summaryrefslogtreecommitdiff
path: root/meta/classes/sstate.bbclass
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:50 +0000
commit94c52d68fc2ce258bcc5b0978ac73413480a1a93 (patch)
treebc3012631f5550e7a7ef744866721919029d0316 /meta/classes/sstate.bbclass
parentd242e637a2b5101985befd93d3b560f17b37504b (diff)
downloadopenembedded-core-94c52d68fc2ce258bcc5b0978ac73413480a1a93.tar.gz
openembedded-core-94c52d68fc2ce258bcc5b0978ac73413480a1a93.tar.bz2
openembedded-core-94c52d68fc2ce258bcc5b0978ac73413480a1a93.tar.xz
openembedded-core-94c52d68fc2ce258bcc5b0978ac73413480a1a93.zip
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 Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Diffstat (limited to 'meta/classes/sstate.bbclass')
-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 ee9bf052a..d20b62a66 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -304,38 +304,31 @@ python sstate_cleanall() {
def sstate_hardcode_path(d):
# Need to remove hardcoded paths and fix these when we install the
# staging packages.
- sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
- p = os.popen("%s" % sstate_scan_cmd)
- file_list = p.read()
-
- if file_list == "":
- p.close()
- return
staging = d.getVar('STAGING_DIR', True)
staging_target = d.getVar('STAGING_DIR_TARGET', True)
staging_host = d.getVar('STAGING_DIR_HOST', True)
sstate_builddir = d.getVar('SSTATE_BUILDDIR', True)
- files = " ".join(file_list.split('\n'))
-
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):
- cmd = "sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging, files)
+ sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIR:g'" % (staging)
elif bb.data.inherits_class('cross', d):
- cmd = "sed -i -e s:%s:FIXMESTAGINGDIRTARGET:g %s \
- sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging_target, files, staging, files)
+ sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRTARGET:g; s:%s:FIXMESTAGINGDIR:g'" % (staging_target, staging)
else:
- cmd = "sed -i -e s:%s:FIXMESTAGINGDIRHOST:g %s" % (staging_host, files)
-
- if files:
- os.system(cmd)
- fix = open("%sfixmepath" % (sstate_builddir), "w")
- fixme = []
- for f in file_list.split('\n'):
- fixme.append(f.replace(sstate_builddir, ""))
- fix.write("\n".join(fixme))
- fix.close()
- p.close()
+ sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host)
+
+ sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True)
+ sstate_filelist_cmd = "tee %sfixmepath" % (sstate_builddir)
+
+ # fixmepath file needs relative paths, drop sstate_builddir prefix
+ sstate_filelist_relative_cmd = "sed -i -e 's:^%s::g' %sfixmepath" % (sstate_builddir, sstate_builddir)
+
+ sstate_hardcode_cmd = "%s | %s | xargs %s" % (sstate_scan_cmd, sstate_filelist_cmd, sstate_sed_cmd)
+
+ print "Removing hardcoded paths from sstate package: '%s'" % (sstate_hardcode_cmd)
+ os.system(sstate_hardcode_cmd)
+ print "Replacing absolute paths in fixmepath file: '%s'" % (sstate_filelist_relative_cmd)
+ os.system(sstate_filelist_relative_cmd)
def sstate_package(ss, d):
import oe.path