image-postinst-intercepts.bbclass 1.1 KB

123456789101112131415161718192021222324252627
  1. #
  2. # Copyright OpenEmbedded Contributors
  3. #
  4. # Gather existing and candidate postinst intercepts from BBPATH
  5. POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts"
  6. POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}"
  7. python find_intercepts() {
  8. intercepts = {}
  9. search_paths = []
  10. paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':')
  11. overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + ['']
  12. search_paths = [os.path.join(p, op) for p in paths for op in overrides]
  13. searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True)
  14. files, chksums = [], []
  15. for pathname, candidates in searched:
  16. if os.path.isfile(pathname):
  17. files.append(pathname)
  18. chksums.append('%s:True' % pathname)
  19. chksums.extend('%s:False' % c for c in candidates[:-1])
  20. d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums))
  21. d.setVar('POSTINST_INTERCEPTS', ' '.join(files))
  22. }
  23. find_intercepts[eventmask] += "bb.event.RecipePreFinalise"
  24. addhandler find_intercepts