summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2015-09-29 13:45:36 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-29 14:42:25 +0100
commitf963541dc040c0c5d7f5378cc0cfda5752208bbd (patch)
tree55c052b99b2cb745d3e9b616e15d29ba83648d82 /meta
parent57eb677f0efe9a4060c764e8e9dfe2440d4e5eb2 (diff)
downloadpoky-f963541dc040c0c5d7f5378cc0cfda5752208bbd.tar.gz
sstate: run recipe-provided hooks outside of ${B}
To avoid races between the sstate tasks/hooks using ${B} as the cwd, and other tasks such as cmake_do_configure which deletes and re-creates ${B}, ensure that all sstate hooks are run in the right directory, and run the prefunc/postfunc in WORKDIR. (From OE-Core rev: 07a7e1a0bee5b8757951e67c9353c786a6ac8500) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/sstate.bbclass30
1 files changed, 14 insertions, 16 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass
index a710305086..5c81a1c69d 100644
--- a/meta/classes/sstate.bbclass
+++ b/meta/classes/sstate.bbclass
@@ -44,16 +44,6 @@ EXTRA_STAGING_FIXMES ?= ""
44 44
45SIGGEN_LOCKEDSIGS_CHECK_LEVEL ?= 'error' 45SIGGEN_LOCKEDSIGS_CHECK_LEVEL ?= 'error'
46 46
47# Specify dirs in which the shell function is executed and don't use ${B}
48# as default dirs to avoid possible race about ${B} with other task.
49sstate_create_package[dirs] = "${SSTATE_BUILDDIR}"
50sstate_unpack_package[dirs] = "${SSTATE_INSTDIR}"
51
52# Do not run sstate_hardcode_path() in ${B}:
53# the ${B} maybe removed by cmake_do_configure() while
54# sstate_hardcode_path() running.
55sstate_hardcode_path[dirs] = "${SSTATE_BUILDDIR}"
56
57python () { 47python () {
58 if bb.data.inherits_class('native', d): 48 if bb.data.inherits_class('native', d):
59 d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH')) 49 d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH'))
@@ -146,6 +136,8 @@ def sstate_install(ss, d):
146 shareddirs = [] 136 shareddirs = []
147 bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}")) 137 bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
148 138
139 sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
140
149 d2 = d.createCopy() 141 d2 = d.createCopy()
150 extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True) 142 extrainf = d.getVarFlag("do_" + ss['task'], 'stamp-extra-info', True)
151 if extrainf: 143 if extrainf:
@@ -239,7 +231,8 @@ def sstate_install(ss, d):
239 oe.path.copyhardlinktree(state[1], state[2]) 231 oe.path.copyhardlinktree(state[1], state[2])
240 232
241 for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split(): 233 for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split():
242 bb.build.exec_func(postinst, d) 234 # All hooks should run in the SSTATE_INSTDIR
235 bb.build.exec_func(postinst, d, (sstateinst,))
243 236
244 for lock in locks: 237 for lock in locks:
245 bb.utils.unlockfile(lock) 238 bb.utils.unlockfile(lock)
@@ -275,7 +268,8 @@ def sstate_installpkg(ss, d):
275 d.setVar('SSTATE_PKG', sstatepkg) 268 d.setVar('SSTATE_PKG', sstatepkg)
276 269
277 for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split(): 270 for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split():
278 bb.build.exec_func(f, d) 271 # All hooks should run in the SSTATE_INSTDIR
272 bb.build.exec_func(f, d, (sstateinst,))
279 273
280 for state in ss['dirs']: 274 for state in ss['dirs']:
281 prepdir(state[1]) 275 prepdir(state[1])
@@ -547,8 +541,9 @@ def sstate_package(ss, d):
547 541
548 for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package'] + \ 542 for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package'] + \
549 (d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split(): 543 (d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split():
550 bb.build.exec_func(f, d) 544 # All hooks should run in SSTATE_BUILDDIR.
551 545 bb.build.exec_func(f, d, (sstatebuild,))
546
552 bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) 547 bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
553 548
554 return 549 return
@@ -606,19 +601,22 @@ python sstate_task_prefunc () {
606 shared_state = sstate_state_fromvars(d) 601 shared_state = sstate_state_fromvars(d)
607 sstate_clean(shared_state, d) 602 sstate_clean(shared_state, d)
608} 603}
604sstate_task_prefunc[dirs] = "${WORKDIR}"
609 605
610python sstate_task_postfunc () { 606python sstate_task_postfunc () {
611 shared_state = sstate_state_fromvars(d) 607 shared_state = sstate_state_fromvars(d)
608
612 sstate_install(shared_state, d) 609 sstate_install(shared_state, d)
613 for intercept in shared_state['interceptfuncs']: 610 for intercept in shared_state['interceptfuncs']:
614 bb.build.exec_func(intercept, d) 611 bb.build.exec_func(intercept, d, (d.getVar("WORKDIR", True),))
615 omask = os.umask(002) 612 omask = os.umask(002)
616 if omask != 002: 613 if omask != 002:
617 bb.note("Using umask 002 (not %0o) for sstate packaging" % omask) 614 bb.note("Using umask 002 (not %0o) for sstate packaging" % omask)
618 sstate_package(shared_state, d) 615 sstate_package(shared_state, d)
619 os.umask(omask) 616 os.umask(omask)
620} 617}
621 618sstate_task_postfunc[dirs] = "${WORKDIR}"
619
622 620
623# 621#
624# Shell function to generate a sstate package from a directory 622# Shell function to generate a sstate package from a directory