Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@kergoth
Last active January 3, 2016 04:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kergoth/8410245 to your computer and use it in GitHub Desktop.
Save kergoth/8410245 to your computer and use it in GitHub Desktop.
# A class which enables task-level variable exports
#
# This allows one to export a variable without affecting the checksums of
# unrelated tasks for shared state.
#
# Example usage:
#
# inherit task_level_exports
#
# # Optional, but makes it explicit:
# TASKS_WITH_EXPORTS = "do_compile"
#
# do_compile[exports] += "SRCREV"
# do_compile_prepend () {
# bbfatal SRCREV: $SRCREV
# }
TASKS_WITH_EXPORTS ?= "${_ALL_TASKS}"
TASKS_WITH_EXPORTS[doc] = "List of tasks to enable. Defaults to all tasks"
TASKS_WITH_EXPORTS[type] = "list"
_ALL_TASKS = "${@' '.join(set(d.getVar('__BBTASKS') or []) - set(d.getVar('__BBDELTASKS') or []))}"
python () {
for task in oe.data.typed_value('TASKS_WITH_EXPORTS', d):
exports = d.getVarFlag(task, 'exports', True)
if exports is not None:
d.prependVarFlag(task, 'prefuncs', 'add_task_exports ')
d.appendVarFlag(task, 'vardeps', ' ' + exports)
}
python add_task_exports () {
task = d.getVar('BB_CURRENTTASK', True)
exports = d.getVarFlag('do_' + task, 'exports', True) or ''
for export in exports.split():
d.setVarFlag(export, 'export', '1')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment