Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 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 | |
| 5 | python find_intercepts() { |
| 6 | intercepts = {} |
| 7 | search_paths = [] |
| 8 | paths = d.getVar('POSTINST_INTERCEPTS_PATHS').split(':') |
| 9 | overrides = (':' + d.getVar('FILESOVERRIDES')).split(':') + [''] |
| 10 | search_paths = [os.path.join(p, op) for p in paths for op in overrides] |
| 11 | searched = oe.path.which_wild('*', ':'.join(search_paths), candidates=True) |
| 12 | files, chksums = [], [] |
| 13 | for pathname, candidates in searched: |
| 14 | if os.path.isfile(pathname): |
| 15 | files.append(pathname) |
| 16 | chksums.append('%s:True' % pathname) |
| 17 | chksums.extend('%s:False' % c for c in candidates[:-1]) |
| 18 | |
| 19 | d.setVar('POSTINST_INTERCEPT_CHECKSUMS', ' '.join(chksums)) |
| 20 | d.setVar('POSTINST_INTERCEPTS', ' '.join(files)) |
| 21 | } |
| 22 | find_intercepts[eventmask] += "bb.event.RecipePreFinalise" |
| 23 | addhandler find_intercepts |