xref: /OK3568_Linux_fs/yocto/poky/meta/classes/image-postinst-intercepts.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1# Gather existing and candidate postinst intercepts from BBPATH
2POSTINST_INTERCEPTS_DIR ?= "${COREBASE}/scripts/postinst-intercepts"
3POSTINST_INTERCEPTS_PATHS ?= "${@':'.join('%s/postinst-intercepts' % p for p in '${BBPATH}'.split(':'))}:${POSTINST_INTERCEPTS_DIR}"
4
5python 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}
22find_intercepts[eventmask] += "bb.event.RecipePreFinalise"
23addhandler find_intercepts
24