mirror of
https://git.yoctoproject.org/poky
synced 2026-05-30 12:29:55 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
3fb464f6af
commit
5fd30897f5
+14
-16
@@ -61,16 +61,6 @@ SSTATE_SIG_PASSPHRASE ?= ""
|
|||||||
# Whether to verify the GnUPG signatures when extracting sstate archives
|
# Whether to verify the GnUPG signatures when extracting sstate archives
|
||||||
SSTATE_VERIFY_SIG ?= "0"
|
SSTATE_VERIFY_SIG ?= "0"
|
||||||
|
|
||||||
# Specify dirs in which the shell function is executed and don't use ${B}
|
|
||||||
# as default dirs to avoid possible race about ${B} with other task.
|
|
||||||
sstate_create_package[dirs] = "${SSTATE_BUILDDIR}"
|
|
||||||
sstate_unpack_package[dirs] = "${SSTATE_INSTDIR}"
|
|
||||||
|
|
||||||
# Do not run sstate_hardcode_path() in ${B}:
|
|
||||||
# the ${B} maybe removed by cmake_do_configure() while
|
|
||||||
# sstate_hardcode_path() running.
|
|
||||||
sstate_hardcode_path[dirs] = "${SSTATE_BUILDDIR}"
|
|
||||||
|
|
||||||
python () {
|
python () {
|
||||||
if bb.data.inherits_class('native', d):
|
if bb.data.inherits_class('native', d):
|
||||||
d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False))
|
d.setVar('SSTATE_PKGARCH', d.getVar('BUILD_ARCH', False))
|
||||||
@@ -164,6 +154,8 @@ def sstate_install(ss, d):
|
|||||||
shareddirs = []
|
shareddirs = []
|
||||||
bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
|
bb.utils.mkdirhier(d.expand("${SSTATE_MANIFESTS}"))
|
||||||
|
|
||||||
|
sstateinst = d.expand("${WORKDIR}/sstate-install-%s/" % ss['task'])
|
||||||
|
|
||||||
manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d)
|
manifest, d2 = oe.sstatesig.sstate_get_manifest_filename(ss['task'], d)
|
||||||
|
|
||||||
if os.access(manifest, os.R_OK):
|
if os.access(manifest, os.R_OK):
|
||||||
@@ -267,7 +259,8 @@ def sstate_install(ss, d):
|
|||||||
oe.path.copyhardlinktree(state[1], state[2])
|
oe.path.copyhardlinktree(state[1], state[2])
|
||||||
|
|
||||||
for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split():
|
for postinst in (d.getVar('SSTATEPOSTINSTFUNCS', True) or '').split():
|
||||||
bb.build.exec_func(postinst, d)
|
# All hooks should run in the SSTATE_INSTDIR
|
||||||
|
bb.build.exec_func(postinst, d, (sstateinst,))
|
||||||
|
|
||||||
for lock in locks:
|
for lock in locks:
|
||||||
bb.utils.unlockfile(lock)
|
bb.utils.unlockfile(lock)
|
||||||
@@ -307,7 +300,8 @@ def sstate_installpkg(ss, d):
|
|||||||
bb.warn("Cannot verify signature on sstate package %s" % sstatepkg)
|
bb.warn("Cannot verify signature on sstate package %s" % sstatepkg)
|
||||||
|
|
||||||
for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split():
|
for f in (d.getVar('SSTATEPREINSTFUNCS', True) or '').split() + ['sstate_unpack_package'] + (d.getVar('SSTATEPOSTUNPACKFUNCS', True) or '').split():
|
||||||
bb.build.exec_func(f, d)
|
# All hooks should run in the SSTATE_INSTDIR
|
||||||
|
bb.build.exec_func(f, d, (sstateinst,))
|
||||||
|
|
||||||
for state in ss['dirs']:
|
for state in ss['dirs']:
|
||||||
prepdir(state[1])
|
prepdir(state[1])
|
||||||
@@ -579,8 +573,9 @@ def sstate_package(ss, d):
|
|||||||
|
|
||||||
for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package'] + \
|
for f in (d.getVar('SSTATECREATEFUNCS', True) or '').split() + ['sstate_create_package'] + \
|
||||||
(d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split():
|
(d.getVar('SSTATEPOSTCREATEFUNCS', True) or '').split():
|
||||||
bb.build.exec_func(f, d)
|
# All hooks should run in SSTATE_BUILDDIR.
|
||||||
|
bb.build.exec_func(f, d, (sstatebuild,))
|
||||||
|
|
||||||
bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
|
bb.siggen.dump_this_task(sstatepkg + ".siginfo", d)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -642,19 +637,22 @@ python sstate_task_prefunc () {
|
|||||||
shared_state = sstate_state_fromvars(d)
|
shared_state = sstate_state_fromvars(d)
|
||||||
sstate_clean(shared_state, d)
|
sstate_clean(shared_state, d)
|
||||||
}
|
}
|
||||||
|
sstate_task_prefunc[dirs] = "${WORKDIR}"
|
||||||
|
|
||||||
python sstate_task_postfunc () {
|
python sstate_task_postfunc () {
|
||||||
shared_state = sstate_state_fromvars(d)
|
shared_state = sstate_state_fromvars(d)
|
||||||
|
|
||||||
sstate_install(shared_state, d)
|
sstate_install(shared_state, d)
|
||||||
for intercept in shared_state['interceptfuncs']:
|
for intercept in shared_state['interceptfuncs']:
|
||||||
bb.build.exec_func(intercept, d)
|
bb.build.exec_func(intercept, d, (d.getVar("WORKDIR", True),))
|
||||||
omask = os.umask(002)
|
omask = os.umask(002)
|
||||||
if omask != 002:
|
if omask != 002:
|
||||||
bb.note("Using umask 002 (not %0o) for sstate packaging" % omask)
|
bb.note("Using umask 002 (not %0o) for sstate packaging" % omask)
|
||||||
sstate_package(shared_state, d)
|
sstate_package(shared_state, d)
|
||||||
os.umask(omask)
|
os.umask(omask)
|
||||||
}
|
}
|
||||||
|
sstate_task_postfunc[dirs] = "${WORKDIR}"
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Shell function to generate a sstate package from a directory
|
# Shell function to generate a sstate package from a directory
|
||||||
|
|||||||
Reference in New Issue
Block a user