@@ -153,7 +153,7 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
notfound.append(tool)
if notfound and fatal:
- bb.fatal("The following required tools (as specified by HOSTTOOLS) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % " ".join(notfound))
+ bb.fatal("The following required tools (as specified by %s) appear to be unavailable in PATH, please install them in order to proceed:\n %s" % (toolsvar, " ".join(notfound)))
# We can't use vardepvalue against do_fetch directly since that would overwrite
# the other task dependencies so we use an indirect function.
@@ -289,6 +289,15 @@ def buildcfg_neededvars(d):
if pesteruser:
bb.fatal('The following variable(s) were not set: %s\nPlease set them directly, or choose a MACHINE or DISTRO that sets them.' % ', '.join(pesteruser))
+addhandler base_task_eventhandler
+base_task_eventhandler[eventmask] = "bb.build.TaskStarted"
+python base_task_eventhandler() {
+ if d.getVar('RECIPE_HOSTTOOLS'):
+ toolsdir = d.getVar('RECIPE_HOSTTOOLS_DIR')
+ with bb.utils.fileslocked([toolsdir + ".lock"]):
+ setup_hosttools_dir(toolsdir, 'RECIPE_HOSTTOOLS', d)
+}
+
addhandler base_eventhandler
base_eventhandler[eventmask] = "bb.event.ConfigParsed bb.event.MultiConfigParsed bb.event.BuildStarted bb.event.RecipePreFinalise bb.event.RecipeParsed bb.event.RecipePreDeferredInherits"
python base_eventhandler() {
@@ -524,6 +524,7 @@ export PATH
# Directory with symlinks to host tools used by build
HOSTTOOLS_DIR = "${TMPDIR}/hosttools"
+RECIPE_HOSTTOOLS_DIR = "${WORKDIR}/recipe-hosttools"
# Tools needed to run builds with OE-Core
HOSTTOOLS += " \
@@ -138,7 +138,7 @@ DUMMY_PACKAGE_ARCHS_TARGET += "sdk-provides-dummy-target"
# We need to keep bitbake tools in PATH
# Avoid empty path entries
BITBAKEPATH := "${@os.path.dirname(bb.utils.which(d.getVar('PATH'),'bitbake'))}"
-PATH := "${@'${BITBAKEPATH}:' if '${BITBAKEPATH}' != '' else ''}${HOSTTOOLS_DIR}"
+PATH := "${@'${BITBAKEPATH}:' if '${BITBAKEPATH}' != '' else ''}${RECIPE_HOSTTOOLS_DIR}:${HOSTTOOLS_DIR}"
# Only OE-Core should set/change this
BB_GLOBAL_PYMODULES = "os sys time"
Being able to have hosttools added within specific recipes would be useful rather than always in the global hosttools directory. Add support for this, impementing it within the TaskStarted event. We need to use a lockfile to ensure the function doesn't race against other tasks also trying to create the same thing. This directory builds on top of HOSTTOOLS which is left as existing so that we don't have to do any work for recipes which don't need specific additional tools. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> --- meta/classes-global/base.bbclass | 11 ++++++++++- meta/conf/bitbake.conf | 1 + meta/conf/layer.conf | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-)