diff options
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r-- | meta/classes/sstate.bbclass | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index 38f2bb99e6..807e8e39aa 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -1,7 +1,7 @@ | |||
1 | SSTATE_VERSION = "1" | 1 | SSTATE_VERSION = "1" |
2 | 2 | ||
3 | SSTATE_MANIFESTS = "${TMPDIR}/sstate-control" | 3 | SSTATE_MANIFESTS = "${TMPDIR}/sstate-control" |
4 | SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_PKGARCH}-" | 4 | SSTATE_MANFILEBASE = "${SSTATE_MANIFESTS}/manifest-${SSTATE_MANMACH}-" |
5 | SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}" | 5 | SSTATE_MANFILEPREFIX = "${SSTATE_MANFILEBASE}${PN}" |
6 | 6 | ||
7 | 7 | ||
@@ -14,15 +14,22 @@ SSTATE_SCAN_CMD ?= "find ${SSTATE_BUILDDIR} \( -name "*.la" -o -name "*-config" | |||
14 | 14 | ||
15 | BB_HASHFILENAME = "${SSTATE_PKGNAME}" | 15 | BB_HASHFILENAME = "${SSTATE_PKGNAME}" |
16 | 16 | ||
17 | SSTATE_MANMACH ?= "${SSTATE_PKGARCH}" | ||
18 | |||
17 | python () { | 19 | python () { |
18 | if bb.data.inherits_class('native', d): | 20 | if bb.data.inherits_class('native', d): |
19 | bb.data.setVar('SSTATE_PKGARCH', bb.data.getVar('BUILD_ARCH', d), d) | 21 | bb.data.setVar('SSTATE_PKGARCH', bb.data.getVar('BUILD_ARCH', d), d) |
20 | elif bb.data.inherits_class('cross', d) or bb.data.inherits_class('crosssdk', d): | 22 | elif bb.data.inherits_class('cross', d): |
23 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${BASE_PACKAGE_ARCH}", d), d) | ||
24 | bb.data.setVar('SSTATE_MANMACH', bb.data.expand("${BUILD_ARCH}_${MACHINE}", d), d) | ||
25 | elif bb.data.inherits_class('crosssdk', d): | ||
21 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${BASE_PACKAGE_ARCH}", d), d) | 26 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${BUILD_ARCH}_${BASE_PACKAGE_ARCH}", d), d) |
22 | elif bb.data.inherits_class('nativesdk', d): | 27 | elif bb.data.inherits_class('nativesdk', d): |
23 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${SDK_ARCH}", d), d) | 28 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${SDK_ARCH}", d), d) |
24 | elif bb.data.inherits_class('cross-canadian', d): | 29 | elif bb.data.inherits_class('cross-canadian', d): |
25 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${SDK_ARCH}_${BASE_PACKAGE_ARCH}", d), d) | 30 | bb.data.setVar('SSTATE_PKGARCH', bb.data.expand("${SDK_ARCH}_${BASE_PACKAGE_ARCH}", d), d) |
31 | else: | ||
32 | bb.data.setVar('SSTATE_MANMACH', bb.data.expand("${MACHINE}", d), d) | ||
26 | 33 | ||
27 | # These classes encode staging paths into their scripts data so can only be | 34 | # These classes encode staging paths into their scripts data so can only be |
28 | # reused if we manipulate the paths | 35 | # reused if we manipulate the paths |
@@ -147,10 +154,14 @@ def sstate_installpkg(ss, d): | |||
147 | fixmefn = sstateinst + "fixmepath" | 154 | fixmefn = sstateinst + "fixmepath" |
148 | if os.path.isfile(fixmefn): | 155 | if os.path.isfile(fixmefn): |
149 | staging = bb.data.getVar('STAGING_DIR', d, True) | 156 | staging = bb.data.getVar('STAGING_DIR', d, True) |
157 | staging_target = bb.data.getVar('STAGING_DIR_TARGET', d, True) | ||
158 | staging_host = bb.data.getVar('STAGING_DIR_HOST', d, True) | ||
150 | fixmefd = open(fixmefn, "r") | 159 | fixmefd = open(fixmefn, "r") |
151 | fixmefiles = fixmefd.readlines() | 160 | fixmefiles = fixmefd.readlines() |
152 | fixmefd.close() | 161 | fixmefd.close() |
153 | for file in fixmefiles: | 162 | for file in fixmefiles: |
163 | os.system("sed -i -e s:FIXMESTAGINGDIRTARGET:%s:g %s" % (staging_target, sstateinst + file)) | ||
164 | os.system("sed -i -e s:FIXMESTAGINGDIRHOST:%s:g %s" % (staging_host, sstateinst + file)) | ||
154 | os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file)) | 165 | os.system("sed -i -e s:FIXMESTAGINGDIR:%s:g %s" % (staging, sstateinst + file)) |
155 | 166 | ||
156 | for state in ss['dirs']: | 167 | for state in ss['dirs']: |
@@ -248,6 +259,35 @@ python sstate_cleanall() { | |||
248 | sstate_clean(shared_state, d) | 259 | sstate_clean(shared_state, d) |
249 | } | 260 | } |
250 | 261 | ||
262 | def sstate_hardcode_path(d): | ||
263 | # Need to remove hardcoded paths and fix these when we install the | ||
264 | # staging packages. | ||
265 | sstate_scan_cmd = bb.data.getVar('SSTATE_SCAN_CMD', d, True) | ||
266 | p = os.popen("%s" % sstate_scan_cmd) | ||
267 | file_list = p.read() | ||
268 | |||
269 | if file_list == "": | ||
270 | p.close() | ||
271 | return | ||
272 | |||
273 | staging = bb.data.getVar('STAGING_DIR', d, True) | ||
274 | staging_target = bb.data.getVar('STAGING_DIR_TARGET', d, True) | ||
275 | staging_host = bb.data.getVar('STAGING_DIR_HOST', d, True) | ||
276 | sstate_builddir = bb.data.getVar('SSTATE_BUILDDIR', d, True) | ||
277 | |||
278 | for i in file_list.split('\n'): | ||
279 | 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): | ||
280 | cmd = "sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging, i) | ||
281 | elif bb.data.inherits_class('cross', d): | ||
282 | cmd = "sed -i -e s:%s:FIXMESTAGINGDIRTARGET:g %s \ | ||
283 | sed -i -e s:%s:FIXMESTAGINGDIR:g %s" % (staging_target, i, staging, i) | ||
284 | else: | ||
285 | cmd = "sed -i -e s:%s:FIXMESTAGINGDIRHOST:g %s" % (staging_host, i) | ||
286 | |||
287 | os.system(cmd) | ||
288 | os.system("echo %s | sed -e 's:%s::' >> %sfixmepath" % (i, sstate_builddir, sstate_builddir)) | ||
289 | p.close() | ||
290 | |||
251 | def sstate_package(ss, d): | 291 | def sstate_package(ss, d): |
252 | import oe.path | 292 | import oe.path |
253 | 293 | ||
@@ -273,6 +313,7 @@ def sstate_package(ss, d): | |||
273 | 313 | ||
274 | bb.data.setVar('SSTATE_BUILDDIR', sstatebuild, d) | 314 | bb.data.setVar('SSTATE_BUILDDIR', sstatebuild, d) |
275 | bb.data.setVar('SSTATE_PKG', sstatepkg, d) | 315 | bb.data.setVar('SSTATE_PKG', sstatepkg, d) |
316 | sstate_hardcode_path(d) | ||
276 | bb.build.exec_func('sstate_create_package', d) | 317 | bb.build.exec_func('sstate_create_package', d) |
277 | 318 | ||
278 | bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) | 319 | bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) |
@@ -337,13 +378,6 @@ python sstate_task_postfunc () { | |||
337 | # set as SSTATE_BUILDDIR | 378 | # set as SSTATE_BUILDDIR |
338 | # | 379 | # |
339 | sstate_create_package () { | 380 | sstate_create_package () { |
340 | # Need to remove hardcoded paths and fix these when we install the | ||
341 | # staging packages. | ||
342 | for i in `${SSTATE_SCAN_CMD}` ; do \ | ||
343 | sed -i -e s:${STAGING_DIR}:FIXMESTAGINGDIR:g $i | ||
344 | echo $i | sed -e 's:${SSTATE_BUILDDIR}::' >> ${SSTATE_BUILDDIR}fixmepath | ||
345 | done | ||
346 | |||
347 | cd ${SSTATE_BUILDDIR} | 381 | cd ${SSTATE_BUILDDIR} |
348 | tar -cvzf ${SSTATE_PKG} * | 382 | tar -cvzf ${SSTATE_PKG} * |
349 | 383 | ||