summaryrefslogtreecommitdiffstats
path: root/meta/classes/sstate.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/sstate.bbclass')
-rw-r--r--meta/classes/sstate.bbclass114
1 files changed, 57 insertions, 57 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index 8643f3d247..546e276d9f 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -11,7 +11,7 @@ def generate_sstatefn(spec, hash, d):
11SSTATE_PKGARCH = "${PACKAGE_ARCH}" 11SSTATE_PKGARCH = "${PACKAGE_ARCH}"
12SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:" 12SSTATE_PKGSPEC = "sstate:${PN}:${PACKAGE_ARCH}${TARGET_VENDOR}-${TARGET_OS}:${PV}:${PR}:${SSTATE_PKGARCH}:${SSTATE_VERSION}:"
13SSTATE_SWSPEC = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:" 13SSTATE_SWSPEC = "sstate:${PN}::${PV}:${PR}::${SSTATE_VERSION}:"
14SSTATE_PKGNAME = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC', True), d.getVar('BB_TASKHASH', True), d)}" 14SSTATE_PKGNAME = "${SSTATE_EXTRAPATH}${@generate_sstatefn(d.getVar('SSTATE_PKGSPEC'), d.getVar('BB_TASKHASH'), d)}"
15SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}" 15SSTATE_PKG = "${SSTATE_DIR}/${SSTATE_PKGNAME}"
16SSTATE_EXTRAPATH = "" 16SSTATE_EXTRAPATH = ""
17SSTATE_EXTRAPATHWILDCARD = "" 17SSTATE_EXTRAPATHWILDCARD = ""
@@ -34,7 +34,7 @@ SSTATE_DUPWHITELIST += "${DEPLOY_DIR_SRC}"
34SSTATE_DUPWHITELIST += "${DEPLOY_DIR}/sdk/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt" 34SSTATE_DUPWHITELIST += "${DEPLOY_DIR}/sdk/README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt"
35 35
36SSTATE_SCAN_FILES ?= "*.la *-config *_config" 36SSTATE_SCAN_FILES ?= "*.la *-config *_config"
37SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES", True).split())}" \) -type f' 37SSTATE_SCAN_CMD ?= 'find ${SSTATE_BUILDDIR} \( -name "${@"\" -o -name \"".join(d.getVar("SSTATE_SCAN_FILES").split())}" \) -type f'
38 38
39BB_HASHFILENAME = "False ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}" 39BB_HASHFILENAME = "False ${SSTATE_PKGSPEC} ${SSTATE_SWSPEC}"
40 40
@@ -84,7 +84,7 @@ python () {
84 d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${SDK_OS}")) 84 d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${SDK_OS}"))
85 elif bb.data.inherits_class('cross-canadian', d): 85 elif bb.data.inherits_class('cross-canadian', d):
86 d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${PACKAGE_ARCH}")) 86 d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${PACKAGE_ARCH}"))
87 elif bb.data.inherits_class('allarch', d) and d.getVar("PACKAGE_ARCH", True) == "all": 87 elif bb.data.inherits_class('allarch', d) and d.getVar("PACKAGE_ARCH") == "all":
88 d.setVar('SSTATE_PKGARCH', "allarch") 88 d.setVar('SSTATE_PKGARCH', "allarch")
89 else: 89 else:
90 d.setVar('SSTATE_MANMACH', d.expand("${PACKAGE_ARCH}")) 90 d.setVar('SSTATE_MANMACH', d.expand("${PACKAGE_ARCH}"))
@@ -100,7 +100,7 @@ python () {
100 scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}" 100 scan_cmd = "grep -Irl ${STAGING_DIR} ${SSTATE_BUILDDIR}"
101 d.setVar('SSTATE_SCAN_CMD', scan_cmd) 101 d.setVar('SSTATE_SCAN_CMD', scan_cmd)
102 102
103 unique_tasks = sorted(set((d.getVar('SSTATETASKS', True) or "").split())) 103 unique_tasks = sorted(set((d.getVar('SSTATETASKS') or "").split()))
104 d.setVar('SSTATETASKS', " ".join(unique_tasks)) 104 d.setVar('SSTATETASKS', " ".join(unique_tasks))
105 for task in unique_tasks: 105 for task in unique_tasks:
106 d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ") 106 d.prependVarFlag(task, 'prefuncs', "sstate_task_prefunc ")
@@ -118,7 +118,7 @@ def sstate_init(task, d):
118 118
119def sstate_state_fromvars(d, task = None): 119def sstate_state_fromvars(d, task = None):
120 if task is None: 120 if task is None:
121 task = d.getVar('BB_CURRENTTASK', True) 121 task = d.getVar('BB_CURRENTTASK')
122 if not task: 122 if not task:
123 bb.fatal("sstate code running without task context?!") 123 bb.fatal("sstate code running without task context?!")
124 task = task.replace("_setscene", "") 124 task = task.replace("_setscene", "")
@@ -200,7 +200,7 @@ def sstate_install(ss, d):
200 shareddirs.append(dstdir) 200 shareddirs.append(dstdir)
201 201
202 # Check the file list for conflicts against files which already exist 202 # Check the file list for conflicts against files which already exist
203 whitelist = (d.getVar("SSTATE_DUPWHITELIST", True) or "").split() 203 whitelist = (d.getVar("SSTATE_DUPWHITELIST") or "").split()
204 match = [] 204 match = []
205 for f in sharedfiles: 205 for f in sharedfiles:
206 if os.path.exists(f): 206 if os.path.exists(f):
@@ -239,7 +239,7 @@ def sstate_install(ss, d):
239 "things (e.g. bluez 4 and bluez 5 and the correct solution for that would " \ 239 "things (e.g. bluez 4 and bluez 5 and the correct solution for that would " \
240 "be to resolve the conflict. If in doubt, please ask on the mailing list, " \ 240 "be to resolve the conflict. If in doubt, please ask on the mailing list, " \
241 "sharing the error and filelist above." % \ 241 "sharing the error and filelist above." % \
242 (d.getVar('PN', True), "\n ".join(match))) 242 (d.getVar('PN'), "\n ".join(match)))
243 bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.") 243 bb.fatal("If the above message is too much, the simpler version is you're advised to wipe out tmp and rebuild (reusing sstate is fine). That will likely fix things in most (but not all) cases.")
244 244
245 # Write out the manifest 245 # Write out the manifest
@@ -260,7 +260,7 @@ def sstate_install(ss, d):
260 260
261 i = d2.expand("${SSTATE_MANIFESTS}/index-${SSTATE_MANMACH}") 261 i = d2.expand("${SSTATE_MANIFESTS}/index-${SSTATE_MANMACH}")
262 l = bb.utils.lockfile(i + ".lock") 262 l = bb.utils.lockfile(i + ".lock")
263 filedata = d.getVar("STAMP", True) + " " + d2.getVar("SSTATE_MANFILEPREFIX", True) + " " + d.getVar("WORKDIR", True) + "\n" 263 filedata = d.getVar("STAMP") + " " + d2.getVar("SSTATE_MANFILEPREFIX") + " " + d.getVar("WORKDIR") + "\n"
264 manifests = [] 264 manifests = []
265 if os.path.exists(i): 265 if os.path.exists(i):
266 with open(i, "r") as f: 266 with open(i, "r") as f:
@@ -275,7 +275,7 @@ def sstate_install(ss, d):
275 if os.path.exists(state[1]): 275 if os.path.exists(state[1]):
276 oe.path.copyhardlinktree(state[1], state[2]) 276 oe.path.copyhardlinktree(state[1], state[2])
277 277
278 for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split(): 278 for postinst in (d.getVar('SSTATEPOSTINSTFUNCS') or '').split():
279 # All hooks should run in the SSTATE_INSTDIR 279 # All hooks should run in the SSTATE_INSTDIR
280 bb.build.exec_func(postinst, d, (sstateinst,)) 280 bb.build.exec_func(postinst, d, (sstateinst,))
281 281
@@ -298,8 +298,8 @@ def sstate_installpkg(ss, d):
298 oe.path.remove(dir) 298 oe.path.remove(dir)
299 299
300 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task']) 300 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
301 sstatefetch = d.getVar('SSTATE_PKGNAME', True) + '_' + ss['task'] + ".tgz" 301 sstatefetch = d.getVar('SSTATE_PKGNAME') + '_' + ss['task'] + ".tgz"
302 sstatepkg = d.getVar('SSTATE_PKG', True) + '_' + ss['task'] + ".tgz" 302 sstatepkg = d.getVar('SSTATE_PKG') + '_' + ss['task'] + ".tgz"
303 303
304 if not os.path.exists(sstatepkg): 304 if not os.path.exists(sstatepkg):
305 pstaging_fetch(sstatefetch, sstatepkg, d) 305 pstaging_fetch(sstatefetch, sstatepkg, d)
@@ -313,12 +313,12 @@ def sstate_installpkg(ss, d):
313 d.setVar('SSTATE_INSTDIR', sstateinst) 313 d.setVar('SSTATE_INSTDIR', sstateinst)
314 d.setVar('SSTATE_PKG', sstatepkg) 314 d.setVar('SSTATE_PKG', sstatepkg)
315 315
316 if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG", True), False): 316 if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
317 signer = get_signer(d, 'local') 317 signer = get_signer(d, 'local')
318 if not signer.verify(sstatepkg + '.sig'): 318 if not signer.verify(sstatepkg + '.sig'):
319 bb.warn("Cannot verify signature on sstate package %s" % sstatepkg) 319 bb.warn("Cannot verify signature on sstate package %s" % sstatepkg)
320 320
321 for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split(): 321 for f in (d.getVar('SSTATEPREINSTFUNCS') or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS') or '').split():
322 # All hooks should run in the SSTATE_INSTDIR 322 # All hooks should run in the SSTATE_INSTDIR
323 bb.build.exec_func(f, d, (sstateinst,)) 323 bb.build.exec_func(f, d, (sstateinst,))
324 324
@@ -328,7 +328,7 @@ def sstate_installpkg(ss, d):
328 sstate_install(ss, d) 328 sstate_install(ss, d)
329 329
330 for plain in ss['plaindirs']: 330 for plain in ss['plaindirs']:
331 workdir = d.getVar('WORKDIR', True) 331 workdir = d.getVar('WORKDIR')
332 src = sstateinst + "/" + plain.replace(workdir, '') 332 src = sstateinst + "/" + plain.replace(workdir, '')
333 dest = plain 333 dest = plain
334 bb.utils.mkdirhier(src) 334 bb.utils.mkdirhier(src)
@@ -344,12 +344,12 @@ python sstate_hardcode_path_unpack () {
344 # sstate_hardcode_path(d) 344 # sstate_hardcode_path(d)
345 import subprocess 345 import subprocess
346 346
347 sstateinst = d.getVar('SSTATE_INSTDIR', True) 347 sstateinst = d.getVar('SSTATE_INSTDIR')
348 fixmefn = sstateinst + "fixmepath" 348 fixmefn = sstateinst + "fixmepath"
349 if os.path.isfile(fixmefn): 349 if os.path.isfile(fixmefn):
350 staging = d.getVar('STAGING_DIR', True) 350 staging = d.getVar('STAGING_DIR')
351 staging_target = d.getVar('STAGING_DIR_TARGET', True) 351 staging_target = d.getVar('STAGING_DIR_TARGET')
352 staging_host = d.getVar('STAGING_DIR_HOST', True) 352 staging_host = d.getVar('STAGING_DIR_HOST')
353 353
354 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): 354 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):
355 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIR:%s:g'" % (staging) 355 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIR:%s:g'" % (staging)
@@ -358,9 +358,9 @@ python sstate_hardcode_path_unpack () {
358 else: 358 else:
359 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host) 359 sstate_sed_cmd = "sed -i -e 's:FIXMESTAGINGDIRHOST:%s:g'" % (staging_host)
360 360
361 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES', True) or '' 361 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
362 for fixmevar in extra_staging_fixmes.split(): 362 for fixmevar in extra_staging_fixmes.split():
363 fixme_path = d.getVar(fixmevar, True) 363 fixme_path = d.getVar(fixmevar)
364 sstate_sed_cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path) 364 sstate_sed_cmd += " -e 's:FIXME_%s:%s:g'" % (fixmevar, fixme_path)
365 365
366 # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed 366 # Add sstateinst to each filename in fixmepath, use xargs to efficiently call sed
@@ -377,12 +377,12 @@ python sstate_hardcode_path_unpack () {
377def sstate_clean_cachefile(ss, d): 377def sstate_clean_cachefile(ss, d):
378 import oe.path 378 import oe.path
379 379
380 sstatepkgfile = d.getVar('SSTATE_PATHSPEC', True) + "*_" + ss['task'] + ".tgz*" 380 sstatepkgfile = d.getVar('SSTATE_PATHSPEC') + "*_" + ss['task'] + ".tgz*"
381 bb.note("Removing %s" % sstatepkgfile) 381 bb.note("Removing %s" % sstatepkgfile)
382 oe.path.remove(sstatepkgfile) 382 oe.path.remove(sstatepkgfile)
383 383
384def sstate_clean_cachefiles(d): 384def sstate_clean_cachefiles(d):
385 for task in (d.getVar('SSTATETASKS', True) or "").split(): 385 for task in (d.getVar('SSTATETASKS') or "").split():
386 ld = d.createCopy() 386 ld = d.createCopy()
387 ss = sstate_state_fromvars(ld, task) 387 ss = sstate_state_fromvars(ld, task)
388 sstate_clean_cachefile(ss, ld) 388 sstate_clean_cachefile(ss, ld)
@@ -424,7 +424,7 @@ def sstate_clean(ss, d):
424 import glob 424 import glob
425 425
426 d2 = d.createCopy() 426 d2 = d.createCopy()
427 stamp_clean = d.getVar("STAMPCLEAN", True) 427 stamp_clean = d.getVar("STAMPCLEAN")
428 extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True) 428 extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True)
429 if extrainf: 429 if extrainf:
430 d2.setVar("SSTATE_MANMACH", extrainf) 430 d2.setVar("SSTATE_MANMACH", extrainf)
@@ -467,7 +467,7 @@ def sstate_clean(ss, d):
467 oe.path.remove(stfile) 467 oe.path.remove(stfile)
468 468
469 # Removes the users/groups created by the package 469 # Removes the users/groups created by the package
470 for cleanfunc in (d.getVar('SSTATECLEANFUNCS', True) or '').split(): 470 for cleanfunc in (d.getVar('SSTATECLEANFUNCS') or '').split():
471 bb.build.exec_func(cleanfunc, d) 471 bb.build.exec_func(cleanfunc, d)
472 472
473sstate_clean[vardepsexclude] = "SSTATE_MANFILEPREFIX" 473sstate_clean[vardepsexclude] = "SSTATE_MANFILEPREFIX"
@@ -475,13 +475,13 @@ sstate_clean[vardepsexclude] = "SSTATE_MANFILEPREFIX"
475CLEANFUNCS += "sstate_cleanall" 475CLEANFUNCS += "sstate_cleanall"
476 476
477python sstate_cleanall() { 477python sstate_cleanall() {
478 bb.note("Removing shared state for package %s" % d.getVar('PN', True)) 478 bb.note("Removing shared state for package %s" % d.getVar('PN'))
479 479
480 manifest_dir = d.getVar('SSTATE_MANIFESTS', True) 480 manifest_dir = d.getVar('SSTATE_MANIFESTS')
481 if not os.path.exists(manifest_dir): 481 if not os.path.exists(manifest_dir):
482 return 482 return
483 483
484 tasks = d.getVar('SSTATETASKS', True).split() 484 tasks = d.getVar('SSTATETASKS').split()
485 for name in tasks: 485 for name in tasks:
486 ld = d.createCopy() 486 ld = d.createCopy()
487 shared_state = sstate_state_fromvars(ld, name) 487 shared_state = sstate_state_fromvars(ld, name)
@@ -497,10 +497,10 @@ python sstate_hardcode_path () {
497 # Note: the logic in this function needs to match the reverse logic 497 # Note: the logic in this function needs to match the reverse logic
498 # in sstate_installpkg(ss, d) 498 # in sstate_installpkg(ss, d)
499 499
500 staging = d.getVar('STAGING_DIR', True) 500 staging = d.getVar('STAGING_DIR')
501 staging_target = d.getVar('STAGING_DIR_TARGET', True) 501 staging_target = d.getVar('STAGING_DIR_TARGET')
502 staging_host = d.getVar('STAGING_DIR_HOST', True) 502 staging_host = d.getVar('STAGING_DIR_HOST')
503 sstate_builddir = d.getVar('SSTATE_BUILDDIR', True) 503 sstate_builddir = d.getVar('SSTATE_BUILDDIR')
504 504
505 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): 505 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):
506 sstate_grep_cmd = "grep -l -e '%s'" % (staging) 506 sstate_grep_cmd = "grep -l -e '%s'" % (staging)
@@ -512,14 +512,14 @@ python sstate_hardcode_path () {
512 sstate_grep_cmd = "grep -l -e '%s'" % (staging_host) 512 sstate_grep_cmd = "grep -l -e '%s'" % (staging_host)
513 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host) 513 sstate_sed_cmd = "sed -i -e 's:%s:FIXMESTAGINGDIRHOST:g'" % (staging_host)
514 514
515 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES', True) or '' 515 extra_staging_fixmes = d.getVar('EXTRA_STAGING_FIXMES') or ''
516 for fixmevar in extra_staging_fixmes.split(): 516 for fixmevar in extra_staging_fixmes.split():
517 fixme_path = d.getVar(fixmevar, True) 517 fixme_path = d.getVar(fixmevar)
518 sstate_sed_cmd += " -e 's:%s:FIXME_%s:g'" % (fixme_path, fixmevar) 518 sstate_sed_cmd += " -e 's:%s:FIXME_%s:g'" % (fixme_path, fixmevar)
519 519
520 fixmefn = sstate_builddir + "fixmepath" 520 fixmefn = sstate_builddir + "fixmepath"
521 521
522 sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD', True) 522 sstate_scan_cmd = d.getVar('SSTATE_SCAN_CMD')
523 sstate_filelist_cmd = "tee %s" % (fixmefn) 523 sstate_filelist_cmd = "tee %s" % (fixmefn)
524 524
525 # fixmepath file needs relative paths, drop sstate_builddir prefix 525 # fixmepath file needs relative paths, drop sstate_builddir prefix
@@ -568,17 +568,17 @@ def sstate_package(ss, d):
568 os.remove(path) 568 os.remove(path)
569 os.symlink(base, path) 569 os.symlink(base, path)
570 570
571 tmpdir = d.getVar('TMPDIR', True) 571 tmpdir = d.getVar('TMPDIR')
572 572
573 sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task']) 573 sstatebuild = d.expand("${WORKDIR}/sstate-build-%s/" % ss['task'])
574 sstatepkg = d.getVar('SSTATE_PKG', True) + '_'+ ss['task'] + ".tgz" 574 sstatepkg = d.getVar('SSTATE_PKG') + '_'+ ss['task'] + ".tgz"
575 bb.utils.remove(sstatebuild, recurse=True) 575 bb.utils.remove(sstatebuild, recurse=True)
576 bb.utils.mkdirhier(sstatebuild) 576 bb.utils.mkdirhier(sstatebuild)
577 bb.utils.mkdirhier(os.path.dirname(sstatepkg)) 577 bb.utils.mkdirhier(os.path.dirname(sstatepkg))
578 for state in ss['dirs']: 578 for state in ss['dirs']:
579 if not os.path.exists(state[1]): 579 if not os.path.exists(state[1]):
580 continue 580 continue
581 if d.getVar('SSTATE_SKIP_CREATION', True) == '1': 581 if d.getVar('SSTATE_SKIP_CREATION') == '1':
582 continue 582 continue
583 srcbase = state[0].rstrip("/").rsplit('/', 1)[0] 583 srcbase = state[0].rstrip("/").rsplit('/', 1)[0]
584 for walkroot, dirs, files in os.walk(state[1]): 584 for walkroot, dirs, files in os.walk(state[1]):
@@ -593,7 +593,7 @@ def sstate_package(ss, d):
593 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0])) 593 bb.debug(2, "Preparing tree %s for packaging at %s" % (state[1], sstatebuild + state[0]))
594 oe.path.copyhardlinktree(state[1], sstatebuild + state[0]) 594 oe.path.copyhardlinktree(state[1], sstatebuild + state[0])
595 595
596 workdir = d.getVar('WORKDIR', True) 596 workdir = d.getVar('WORKDIR')
597 for plain in ss['plaindirs']: 597 for plain in ss['plaindirs']:
598 pdir = plain.replace(workdir, sstatebuild) 598 pdir = plain.replace(workdir, sstatebuild)
599 bb.utils.mkdirhier(plain) 599 bb.utils.mkdirhier(plain)
@@ -603,9 +603,9 @@ def sstate_package(ss, d):
603 d.setVar('SSTATE_BUILDDIR', sstatebuild) 603 d.setVar('SSTATE_BUILDDIR', sstatebuild)
604 d.setVar('SSTATE_PKG', sstatepkg) 604 d.setVar('SSTATE_PKG', sstatepkg)
605 605
606 for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + \ 606 for f in (d.getVar('SSTATECREATEFUNCS') or '').split() + \
607 ['sstate_create_package', 'sstate_sign_package'] + \ 607 ['sstate_create_package', 'sstate_sign_package'] + \
608 (d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split(): 608 (d.getVar('SSTATEPOSTCREATEFUNCS') or '').split():
609 # All hooks should run in SSTATE_BUILDDIR. 609 # All hooks should run in SSTATE_BUILDDIR.
610 bb.build.exec_func(f, d, (sstatebuild,)) 610 bb.build.exec_func(f, d, (sstatebuild,))
611 611
@@ -617,7 +617,7 @@ def pstaging_fetch(sstatefetch, sstatepkg, d):
617 import bb.fetch2 617 import bb.fetch2
618 618
619 # Only try and fetch if the user has configured a mirror 619 # Only try and fetch if the user has configured a mirror
620 mirrors = d.getVar('SSTATE_MIRRORS', True) 620 mirrors = d.getVar('SSTATE_MIRRORS')
621 if not mirrors: 621 if not mirrors:
622 return 622 return
623 623
@@ -635,14 +635,14 @@ def pstaging_fetch(sstatefetch, sstatepkg, d):
635 635
636 # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK, 636 # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK,
637 # we'll want to allow network access for the current set of fetches. 637 # we'll want to allow network access for the current set of fetches.
638 if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1": 638 if localdata.getVar('BB_NO_NETWORK') == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK') == "1":
639 localdata.delVar('BB_NO_NETWORK') 639 localdata.delVar('BB_NO_NETWORK')
640 640
641 # Try a fetch from the sstate mirror, if it fails just return and 641 # Try a fetch from the sstate mirror, if it fails just return and
642 # we will build the package 642 # we will build the package
643 uris = ['file://{0};downloadfilename={0}'.format(sstatefetch), 643 uris = ['file://{0};downloadfilename={0}'.format(sstatefetch),
644 'file://{0}.siginfo;downloadfilename={0}.siginfo'.format(sstatefetch)] 644 'file://{0}.siginfo;downloadfilename={0}.siginfo'.format(sstatefetch)]
645 if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG", True), False): 645 if bb.utils.to_boolean(d.getVar("SSTATE_VERIFY_SIG"), False):
646 uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)] 646 uris += ['file://{0}.sig;downloadfilename={0}.sig'.format(sstatefetch)]
647 647
648 for srcuri in uris: 648 for srcuri in uris:
@@ -671,7 +671,7 @@ python sstate_task_postfunc () {
671 671
672 sstate_install(shared_state, d) 672 sstate_install(shared_state, d)
673 for intercept in shared_state['interceptfuncs']: 673 for intercept in shared_state['interceptfuncs']:
674 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR", True),)) 674 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR"),))
675 omask = os.umask(0o002) 675 omask = os.umask(0o002)
676 if omask != 0o002: 676 if omask != 0o002:
677 bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask) 677 bb.note("Using umask 0o002 (not %0o) for sstate packaging" % omask)
@@ -709,13 +709,13 @@ sstate_create_package () {
709python sstate_sign_package () { 709python sstate_sign_package () {
710 from oe.gpg_sign import get_signer 710 from oe.gpg_sign import get_signer
711 711
712 if d.getVar('SSTATE_SIG_KEY', True): 712 if d.getVar('SSTATE_SIG_KEY'):
713 signer = get_signer(d, 'local') 713 signer = get_signer(d, 'local')
714 sstate_pkg = d.getVar('SSTATE_PKG', True) 714 sstate_pkg = d.getVar('SSTATE_PKG')
715 if os.path.exists(sstate_pkg + '.sig'): 715 if os.path.exists(sstate_pkg + '.sig'):
716 os.unlink(sstate_pkg + '.sig') 716 os.unlink(sstate_pkg + '.sig')
717 signer.detach_sign(sstate_pkg, d.getVar('SSTATE_SIG_KEY', False), None, 717 signer.detach_sign(sstate_pkg, d.getVar('SSTATE_SIG_KEY', False), None,
718 d.getVar('SSTATE_SIG_PASSPHRASE', True), armor=False) 718 d.getVar('SSTATE_SIG_PASSPHRASE'), armor=False)
719} 719}
720 720
721# 721#
@@ -746,7 +746,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
746 splithashfn = sq_hashfn[task].split(" ") 746 splithashfn = sq_hashfn[task].split(" ")
747 spec = splithashfn[1] 747 spec = splithashfn[1]
748 if splithashfn[0] == "True": 748 if splithashfn[0] == "True":
749 extrapath = d.getVar("NATIVELSBSTRING", True) + "/" 749 extrapath = d.getVar("NATIVELSBSTRING") + "/"
750 else: 750 else:
751 extrapath = "" 751 extrapath = ""
752 752
@@ -785,7 +785,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
785 missed.append(task) 785 missed.append(task)
786 bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile) 786 bb.debug(2, "SState: Looked for but didn't find file %s" % sstatefile)
787 787
788 mirrors = d.getVar("SSTATE_MIRRORS", True) 788 mirrors = d.getVar("SSTATE_MIRRORS")
789 if mirrors: 789 if mirrors:
790 # Copy the data object and override DL_DIR and SRC_URI 790 # Copy the data object and override DL_DIR and SRC_URI
791 localdata = bb.data.createCopy(d) 791 localdata = bb.data.createCopy(d)
@@ -801,7 +801,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
801 801
802 # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK, 802 # if BB_NO_NETWORK is set but we also have SSTATE_MIRROR_ALLOW_NETWORK,
803 # we'll want to allow network access for the current set of fetches. 803 # we'll want to allow network access for the current set of fetches.
804 if localdata.getVar('BB_NO_NETWORK', True) == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK', True) == "1": 804 if localdata.getVar('BB_NO_NETWORK') == "1" and localdata.getVar('SSTATE_MIRROR_ALLOW_NETWORK') == "1":
805 localdata.delVar('BB_NO_NETWORK') 805 localdata.delVar('BB_NO_NETWORK')
806 806
807 whitelist = bb.runqueue.get_setscene_enforce_whitelist(d) 807 whitelist = bb.runqueue.get_setscene_enforce_whitelist(d)
@@ -868,7 +868,7 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False):
868 if whitelist and missing: 868 if whitelist and missing:
869 bb.fatal('Required artifacts were unavailable - exiting') 869 bb.fatal('Required artifacts were unavailable - exiting')
870 870
871 inheritlist = d.getVar("INHERIT", True) 871 inheritlist = d.getVar("INHERIT")
872 if "toaster" in inheritlist: 872 if "toaster" in inheritlist:
873 evdata = {'missed': [], 'found': []}; 873 evdata = {'missed': [], 'found': []};
874 for task in missed: 874 for task in missed:
@@ -977,15 +977,15 @@ sstate_eventhandler[eventmask] = "bb.build.TaskSucceeded"
977python sstate_eventhandler() { 977python sstate_eventhandler() {
978 d = e.data 978 d = e.data
979 # When we write an sstate package we rewrite the SSTATE_PKG 979 # When we write an sstate package we rewrite the SSTATE_PKG
980 spkg = d.getVar('SSTATE_PKG', True) 980 spkg = d.getVar('SSTATE_PKG')
981 if not spkg.endswith(".tgz"): 981 if not spkg.endswith(".tgz"):
982 taskname = d.getVar("BB_RUNTASK", True)[3:] 982 taskname = d.getVar("BB_RUNTASK")[3:]
983 spec = d.getVar('SSTATE_PKGSPEC', True) 983 spec = d.getVar('SSTATE_PKGSPEC')
984 swspec = d.getVar('SSTATE_SWSPEC', True) 984 swspec = d.getVar('SSTATE_SWSPEC')
985 if taskname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and swspec: 985 if taskname in ["fetch", "unpack", "patch", "populate_lic", "preconfigure"] and swspec:
986 d.setVar("SSTATE_PKGSPEC", "${SSTATE_SWSPEC}") 986 d.setVar("SSTATE_PKGSPEC", "${SSTATE_SWSPEC}")
987 d.setVar("SSTATE_EXTRAPATH", "") 987 d.setVar("SSTATE_EXTRAPATH", "")
988 sstatepkg = d.getVar('SSTATE_PKG', True) 988 sstatepkg = d.getVar('SSTATE_PKG')
989 bb.siggen.dump_this_task(sstatepkg + '_' + taskname + ".tgz" ".siginfo", d) 989 bb.siggen.dump_this_task(sstatepkg + '_' + taskname + ".tgz" ".siginfo", d)
990} 990}
991 991
@@ -1004,7 +1004,7 @@ python sstate_eventhandler2() {
1004 stamps = e.stamps.values() 1004 stamps = e.stamps.values()
1005 removeworkdir = (d.getVar("SSTATE_PRUNE_OBSOLETEWORKDIR", False) == "1") 1005 removeworkdir = (d.getVar("SSTATE_PRUNE_OBSOLETEWORKDIR", False) == "1")
1006 seen = [] 1006 seen = []
1007 for a in d.getVar("SSTATE_ARCHS", True).split(): 1007 for a in d.getVar("SSTATE_ARCHS").split():
1008 toremove = [] 1008 toremove = []
1009 i = d.expand("${SSTATE_MANIFESTS}/index-" + a) 1009 i = d.expand("${SSTATE_MANIFESTS}/index-" + a)
1010 if not os.path.exists(i): 1010 if not os.path.exists(i):