diff options
author | Ross Burton <ross.burton@intel.com> | 2015-09-24 09:54:33 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-28 12:00:22 +0100 |
commit | 5fd30897f5e623d558d0720b24322210a67bb615 (patch) | |
tree | 5b9c01c9c0fa4baa845364016837b4a19bfa85db | |
parent | 3fb464f6af2ab7c8510996a675e45749a4f985b5 (diff) | |
download | poky-5fd30897f5e623d558d0720b24322210a67bb615.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: 1d3bde02641f4b40030cf7e305ee3d7c2faabe29)
(From OE-Core rev: a026dbfa0ce4ee769ae2c714f27f4c4eaa4a0c73)
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/sstate.bbclass | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index b9ad6da9dd..d09e27aee4 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -61,16 +61,6 @@ SSTATE_SIG_PASSPHRASE ?= "" | |||
61 | # Whether to verify the GnUPG signatures when extracting sstate archives | 61 | # Whether to verify the GnUPG signatures when extracting sstate archives |
62 | SSTATE_VERIFY_SIG ?= "0" | 62 | SSTATE_VERIFY_SIG ?= "0" |
63 | 63 | ||
64 | # Specify dirs in which the shell function is executed and don't use ${B} | ||
65 | # as default dirs to avoid possible race about ${B} with other task. | ||
66 | sstate_create_package[dirs] = "${SSTATE_BUILDDIR}" | ||
67 | sstate_unpack_package[dirs] = "${SSTATE_INSTDIR}" | ||
68 | |||
69 | # Do not run sstate_hardcode_path() in ${B}: | ||
70 | # the ${B} maybe removed by cmake_do_configure() while | ||
71 | # sstate_hardcode_path() running. | ||
72 | sstate_hardcode_path[dirs] = "${SSTATE_BUILDDIR}" | ||
73 | |||
74 | python () { | 64 | python () { |
75 | if bb.data.inherits_class('native', d): | 65 | if bb.data.inherits_class('native', d): |
76 | d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False)) | 66 | d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False)) |
@@ -164,6 +154,8 @@ def sstate_install(ss, d): | |||
164 | shareddirs = [] | 154 | shareddirs = [] |
165 | bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}")) | 155 | bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}")) |
166 | 156 | ||
157 | sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task']) | ||
158 | |||
167 | manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d) | 159 | manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d) |
168 | 160 | ||
169 | if os.access(manifest, os.R_OK): | 161 | if os.access(manifest, os.R_OK): |
@@ -267,7 +259,8 @@ def sstate_install(ss, d): | |||
267 | oe.path.copyhardlinktree(state[1], state[2]) | 259 | oe.path.copyhardlinktree(state[1], state[2]) |
268 | 260 | ||
269 | for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split(): | 261 | for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split(): |
270 | bb.build.exec_func(postinst, d) | 262 | # All hooks should run in the SSTATE_INSTDIR |
263 | bb.build.exec_func(postinst, d, (sstateinst,)) | ||
271 | 264 | ||
272 | for lock in locks: | 265 | for lock in locks: |
273 | bb.utils.unlockfile(lock) | 266 | bb.utils.unlockfile(lock) |
@@ -307,7 +300,8 @@ def sstate_installpkg(ss, d): | |||
307 | bb.warn("Cannot verify signature on sstate package %s" % sstatepkg) | 300 | bb.warn("Cannot verify signature on sstate package %s" % sstatepkg) |
308 | 301 | ||
309 | for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split(): | 302 | for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split(): |
310 | bb.build.exec_func(f, d) | 303 | # All hooks should run in the SSTATE_INSTDIR |
304 | bb.build.exec_func(f, d, (sstateinst,)) | ||
311 | 305 | ||
312 | for state in ss['dirs']: | 306 | for state in ss['dirs']: |
313 | prepdir(state[1]) | 307 | prepdir(state[1]) |
@@ -579,8 +573,9 @@ def sstate_package(ss, d): | |||
579 | 573 | ||
580 | for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package'] + \ | 574 | for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package'] + \ |
581 | (d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split(): | 575 | (d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split(): |
582 | bb.build.exec_func(f, d) | 576 | # All hooks should run in SSTATE_BUILDDIR. |
583 | 577 | bb.build.exec_func(f, d, (sstatebuild,)) | |
578 | |||
584 | bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) | 579 | bb.siggen.dump_this_task(sstatepkg + ".siginfo", d) |
585 | 580 | ||
586 | return | 581 | return |
@@ -642,19 +637,22 @@ python sstate_task_prefunc () { | |||
642 | shared_state = sstate_state_fromvars(d) | 637 | shared_state = sstate_state_fromvars(d) |
643 | sstate_clean(shared_state, d) | 638 | sstate_clean(shared_state, d) |
644 | } | 639 | } |
640 | sstate_task_prefunc[dirs] = "${WORKDIR}" | ||
645 | 641 | ||
646 | python sstate_task_postfunc () { | 642 | python sstate_task_postfunc () { |
647 | shared_state = sstate_state_fromvars(d) | 643 | shared_state = sstate_state_fromvars(d) |
644 | |||
648 | sstate_install(shared_state, d) | 645 | sstate_install(shared_state, d) |
649 | for intercept in shared_state['interceptfuncs']: | 646 | for intercept in shared_state['interceptfuncs']: |
650 | bb.build.exec_func(intercept, d) | 647 | bb.build.exec_func(intercept, d, (d.getVar("WORKDIR", True),)) |
651 | omask = os.umask(002) | 648 | omask = os.umask(002) |
652 | if omask != 002: | 649 | if omask != 002: |
653 | bb.note("Using umask 002 (not %0o) for sstate packaging" % omask) | 650 | bb.note("Using umask 002 (not %0o) for sstate packaging" % omask) |
654 | sstate_package(shared_state, d) | 651 | sstate_package(shared_state, d) |
655 | os.umask(omask) | 652 | os.umask(omask) |
656 | } | 653 | } |
657 | 654 | sstate_task_postfunc[dirs] = "${WORKDIR}" | |
655 | |||
658 | 656 | ||
659 | # | 657 | # |
660 | # Shell function to generate a sstate package from a directory | 658 | # Shell function to generate a sstate package from a directory |