Skip to content

Add bb.utils.filter()

Peter Kjellerstedt bitbake-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 2 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2lib/bb/utils: Add filter()bitbake/lib/bb/utils.py+24 -00 replies
2/2Make use of the new bb.utils.filter() functionmeta/classes/testimage.bbclass meta/recipes-bsp/u-boot/u-boot.inc meta/recipes-connectivity/connman/connman.inc +71 more+83 -1172 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] Add bb.utils.filter()

The first patch in this set introduces a new utility function to
BitBake: bb.utils.filter(). It can be used to filter a variable containing whitespace separated words based on another set of words. It has been modeled after the bb.utils.contains_any() function.

We have quite a number of recipes where we today use:

PACKAGECONFIG ??= "${MACHINE_FEATURES}"

This is nice and simple. However, the drawback is that it means that we have had to disable the invalid-packageconfig QA warning for these recipes. To be able to re-enable the QA warning for these recipes I came up with the bb.utils.filter() function.

A typical example of how it can be used is to simplify constructs for PACKAGECONFIG that depend on DISTRO_FEATURES:

-PACKAGECONFIG ?= "\
- ${@bb.utils.contains('DISTRO_FEATURES', 'acl', 'acl', '', d)} \
- ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', 'selinux', '', d)} \
-"
+PACKAGECONFIG ?= "${@bb.utils.filter('DISTRO_FEATURES', 'acl selinux', d)}"

An alternative is to write it as:

PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', d.getVarFlags('PACKAGECONFIG'), d)}"

The latter construct may seem to add nothing extra compared to setting PACKAGECONFIG = "${DISTRO_FEATURES}" with the QA warning disabled, but the difference is that the warning can remain enabled and still catch someone doing something like PACKAGECONFIG += "unsupported-feature".

The second patch is for the meta layer and updates all recipes to take advantage of the new function.

//Peter

The following changes since commit e436a6398684d2872cb541f1cfb0f67b3618d15a:

layer.conf: bump version for change in eSDK selftest behaviour (2017-02-19 09:39:03 -0800)

are available in the git repository at:

git://git.yoctoproject.org/poky-contrib pkj/bb.utils.filter
http://git.yoctoproject.org/cgit.cgi/poky-contrib/log/?h=pkj/bb.utils.filter

Peter Kjellerstedt (2):
lib/bb/utils: Add filter()
Make use of the new bb.utils.filter() function

 bitbake/lib/bb/utils.py                            | 24 ++++++++++++++++++++++
 meta/classes/testimage.bbclass                     |  2 +-
 meta/recipes-bsp/u-boot/u-boot.inc                 |  2 +-
 meta/recipes-connectivity/connman/connman.inc      |  4 +---
 meta/recipes-connectivity/libpcap/libpcap.inc      |  2 +-
 meta/recipes-connectivity/neard/neard_0.16.bb      |  2 +-
 .../nfs-utils/nfs-utils_1.3.4.bb                   |  2 +-
 meta/recipes-connectivity/ofono/ofono.inc          |  2 +-
 meta/recipes-connectivity/openssh/openssh_7.4p1.bb |  4 ++--
 meta/recipes-core/coreutils/coreutils_6.9.bb       |  2 +-
 meta/recipes-core/coreutils/coreutils_8.26.bb      |  3 +--
 meta/recipes-core/dbus/dbus_1.10.14.bb             |  4 +---
 meta/recipes-core/dropbear/dropbear.inc            |  2 +-
 meta/recipes-core/kbd/kbd_2.0.3.bb                 |  2 +-
 meta/recipes-core/libxml/libxml2_2.9.4.bb          |  2 +-
 meta/recipes-core/systemd/systemd_232.bb           |  4 +---
 meta/recipes-core/util-linux/util-linux.inc        |  4 ++--
 meta/recipes-devtools/mtd/mtd-utils_git.bb         |  2 +-
 meta/recipes-devtools/patch/patch_2.7.5.bb         |  2 +-
 meta/recipes-devtools/pax-utils/pax-utils_1.2.2.bb |  2 +-
 meta/recipes-devtools/qemu/qemu.inc                |  3 +--
 meta/recipes-devtools/rsync/rsync_2.6.9.bb         |  2 +-
 meta/recipes-devtools/rsync/rsync_3.1.2.bb         |  2 +-
 meta/recipes-devtools/ruby/ruby_2.3.3.bb           |  2 +-
 meta/recipes-extended/at/at_3.1.20.bb              |  2 +-
 meta/recipes-extended/cronie/cronie_1.5.1.bb       |  2 +-
 meta/recipes-extended/cups/cups.inc                |  3 +--
 meta/recipes-extended/iptables/iptables_1.6.0.bb   |  2 +-
 .../libarchive/libarchive_3.2.2.bb                 |  4 +---
 meta/recipes-extended/lighttpd/lighttpd_1.4.45.bb  |  2 +-
 meta/recipes-extended/logrotate/logrotate_3.9.1.bb |  5 +----
 meta/recipes-extended/psmisc/psmisc.inc            |  2 +-
 meta/recipes-extended/rpcbind/rpcbind_0.2.4.bb     |  2 +-
 meta/recipes-extended/screen/screen_4.4.0.bb       |  2 +-
 meta/recipes-extended/shadow/shadow.inc            |  2 +-
 meta/recipes-extended/sudo/sudo_1.8.18p1.bb        |  2 +-
 meta/recipes-extended/wget/wget.inc                |  2 +-
 meta/recipes-gnome/gdk-pixbuf/gdk-pixbuf_2.36.1.bb |  2 +-
 meta/recipes-gnome/gtk+/gtk+.inc                   |  4 +---
 meta/recipes-gnome/gtk+/gtk+3.inc                  |  6 ++----
 meta/recipes-graphics/cairo/cairo.inc              |  2 +-
 meta/recipes-graphics/clutter/clutter-1.0.inc      |  2 +-
 meta/recipes-graphics/libepoxy/libepoxy_1.4.0.bb   |  2 +-
 meta/recipes-graphics/libsdl/libsdl_1.2.15.bb      |  9 +++-----
 meta/recipes-graphics/libsdl2/libsdl2_2.0.5.bb     |  7 ++-----
 meta/recipes-graphics/libva/libva_1.7.3.bb         |  3 +--
 meta/recipes-graphics/mesa/mesa-demos_8.3.0.bb     |  2 +-
 meta/recipes-graphics/mesa/mesa-gl_13.0.4.bb       |  2 +-
 meta/recipes-graphics/mesa/mesa.inc                |  3 +--
 meta/recipes-graphics/pango/pango_1.40.3.bb        |  2 +-
 meta/recipes-graphics/wayland/weston_1.11.1.bb     |  6 ++----
 meta/recipes-graphics/xorg-app/xauth_1.0.9.bb      |  2 +-
 meta/recipes-graphics/xorg-app/xhost_1.0.7.bb      |  2 +-
 meta/recipes-graphics/xorg-lib/libice_1.0.9.bb     |  2 +-
 meta/recipes-graphics/xorg-lib/libsm_1.2.2.bb      |  2 +-
 meta/recipes-graphics/xorg-lib/libxfont2_2.0.1.bb  |  2 +-
 meta/recipes-graphics/xorg-lib/libxfont_1.5.2.bb   |  2 +-
 .../xorg-lib/libxkbcommon_0.7.1.bb                 |  2 +-
 meta/recipes-graphics/xorg-lib/libxmu_1.1.2.bb     |  2 +-
 .../recipes-graphics/xorg-xserver/xserver-xorg.inc |  4 ++--
 meta/recipes-kernel/latencytop/latencytop_0.5.bb   |  2 +-
 meta/recipes-multimedia/alsa/alsa-plugins_1.1.1.bb |  2 +-
 .../gstreamer/gstreamer1.0-plugins-bad.inc         |  2 +-
 .../gstreamer/gstreamer1.0-plugins-base.inc        |  3 +--
 .../gstreamer/gstreamer1.0-plugins-good.inc        |  3 +--
 .../gstreamer/gstreamer1.0-vaapi.inc               |  5 ++---
 .../libsndfile/libsndfile1_1.0.27.bb               |  2 +-
 meta/recipes-multimedia/mpeg2dec/mpeg2dec_0.4.1.bb |  2 +-
 meta/recipes-multimedia/mpg123/mpg123_1.23.8.bb    |  2 +-
 meta/recipes-multimedia/pulseaudio/pulseaudio.inc  |  4 +---
 meta/recipes-support/apr/apr_1.5.2.bb              |  2 +-
 .../recipes-support/consolekit/consolekit_0.4.6.bb |  3 +--
 meta/recipes-support/curl/curl_7.52.1.bb           |  2 +-
 meta/recipes-support/libcap/libcap_2.25.bb         |  2 +-
 meta/recipes-support/nspr/nspr_4.13.1.bb           |  2 +-
 75 files changed, 107 insertions(+), 117 deletions(-)
Signature · 1 line
2.9.0