diff options
author | Christopher Larson <chris_larson@mentor.com> | 2018-07-27 22:24:28 +0500 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-08-16 09:49:32 +0100 |
commit | 7a2044df4ae8d80cf25a6bfd9b71978ffefbfa33 (patch) | |
tree | 8fab43ac0234df1c5f7d0d67c546400e4d99efa8 | |
parent | 9ba2f2b1df277b2b881f68166d9cd1c19db66e23 (diff) | |
download | openembedded-core-7a2044df4ae8d80cf25a6bfd9b71978ffefbfa33.tar.gz openembedded-core-7a2044df4ae8d80cf25a6bfd9b71978ffefbfa33.tar.bz2 openembedded-core-7a2044df4ae8d80cf25a6bfd9b71978ffefbfa33.zip |
image-postinst-intercepts.bbclass: add class
This class sets POSTINST_INTERCEPTS and POSTINST_INTERCEPTS_CHECKSUMS,
to allow us to pull intercepts from BBPATH. This is kept as a separate
class, as it's needed by both image construction and sdk construction,
the latter to support meta-toolchain & similar recipes.
Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/image-postinst-intercepts.bbclass | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/meta/classes/image-postinst-intercepts.bbclass b/meta/classes/image-postinst-intercepts.bbclass new file mode 100644 index 0000000000..ed30bbd98d --- /dev/null +++ b/meta/classes/image-postinst-intercepts.bbclass @@ -0,0 +1,23 @@ +# Gather existing and candidate postinst intercepts from BBPATH +POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts" +POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}" + +python find_intercepts() { + intercepts = {} + search_paths = [] + paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':') + overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + [''] + search_paths = [os.path.join(p, op) for p in paths for op in overrides] + searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True) + files, chksums = [], [] + for pathname, candidates in searched: + if os.path.isfile(pathname): + files.append(pathname) + chksums.append('%s:True' % pathname) + chksums.extend('%s:False' % c for c in candidates[:-1]) + + d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums)) + d.setVar('POSTINST_INTERCEPTS', ' '.join(files)) +} +find_intercepts[eventmask] += "bb.event.RecipePreFinalise" +addhandler find_intercepts |