image-postinst-intercepts.bbclass 1.1 KB

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