distrooverrides.bbclass 1.6 KB

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