xref: /OK3568_Linux_fs/yocto/poky/meta/classes/distrooverrides.bbclass (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# Turns certain DISTRO_FEATURES into overrides with the same
2*4882a593Smuzhiyun# name plus a df- prefix. Ensures that these special
3*4882a593Smuzhiyun# distro features remain set also for native and nativesdk
4*4882a593Smuzhiyun# recipes, so that these overrides can also be used there.
5*4882a593Smuzhiyun#
6*4882a593Smuzhiyun# This makes it simpler to write .bbappends that only change the
7*4882a593Smuzhiyun# task signatures of the recipe if the change is really enabled,
8*4882a593Smuzhiyun# for example with:
9*4882a593Smuzhiyun#   do_install:append:df-my-feature () { ... }
10*4882a593Smuzhiyun# where "my-feature" is a DISTRO_FEATURE.
11*4882a593Smuzhiyun#
12*4882a593Smuzhiyun# The class is meant to be used in a layer.conf or distro
13*4882a593Smuzhiyun# .inc file with:
14*4882a593Smuzhiyun# INHERIT += "distrooverrides"
15*4882a593Smuzhiyun# DISTRO_FEATURES_OVERRIDES += "my-feature"
16*4882a593Smuzhiyun#
17*4882a593Smuzhiyun# Beware that this part of OVERRIDES changes during parsing, so usage
18*4882a593Smuzhiyun# of these overrides should be limited to .bb and .bbappend files,
19*4882a593Smuzhiyun# because then DISTRO_FEATURES is final.
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunDISTRO_FEATURES_OVERRIDES ?= ""
22*4882a593SmuzhiyunDISTRO_FEATURES_OVERRIDES[doc] = "A space-separated list of <feature> entries. \
23*4882a593SmuzhiyunEach entry is added to OVERRIDES as df-<feature> if <feature> is in DISTRO_FEATURES."
24*4882a593Smuzhiyun
25*4882a593SmuzhiyunDISTRO_FEATURES_FILTER_NATIVE:append = " ${DISTRO_FEATURES_OVERRIDES}"
26*4882a593SmuzhiyunDISTRO_FEATURES_FILTER_NATIVESDK:append = " ${DISTRO_FEATURES_OVERRIDES}"
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun# If DISTRO_FEATURES_OVERRIDES or DISTRO_FEATURES show up in a task
29*4882a593Smuzhiyun# signature because of this line, then the task dependency on
30*4882a593Smuzhiyun# OVERRIDES itself should be fixed. Excluding these two variables
31*4882a593Smuzhiyun# with DISTROOVERRIDES[vardepsexclude] would just work around the problem.
32*4882a593SmuzhiyunDISTROOVERRIDES .= "${@ ''.join([':df-' + x for x in sorted(set(d.getVar('DISTRO_FEATURES_OVERRIDES').split()) & set((d.getVar('DISTRO_FEATURES') or '').split()))]) }"
33