From 6ab56c54f316154d89f03ec0c6c2cb39d1736cff Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Wed, 4 Dec 2013 13:09:11 +0000 Subject: classes/recipes: More optimal DISTRO_FEATURES references Using the contains function results in more optimal sstate checksums resulting in better cache reuse as we as more consistent code. (From OE-Core rev: 9c93526756e7cbbff027c88eb972f877bcb1f057) Signed-off-by: Richard Purdie --- meta/classes/libc-package.bbclass | 6 +++--- meta/classes/systemd.bbclass | 15 +++++++-------- meta/classes/update-rc.d.bbclass | 2 +- 3 files changed, 11 insertions(+), 12 deletions(-) (limited to 'meta/classes') diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index 454ee76602..0af42a002c 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass @@ -36,10 +36,10 @@ python __anonymous () { d.setVar("GLIBC_INTERNAL_USE_BINARY_LOCALE", "compile") break - distro_features = (d.getVar('DISTRO_FEATURES', True) or '').split() - # try to fix disable charsets/locales/locale-code compile fail - if 'libc-charsets' in distro_features and 'libc-locales' in distro_features and 'libc-locale-code' in distro_features: + if oe.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d) and \ + oe.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d) and \ + oe.utils.contains('DISTRO_FEATURES', 'libc-locale-code', True, False, d): d.setVar('PACKAGE_NO_GCONV', '0') else: d.setVar('PACKAGE_NO_GCONV', '1') diff --git a/meta/classes/systemd.bbclass b/meta/classes/systemd.bbclass index 7a8d35cd2f..efc1adcacb 100644 --- a/meta/classes/systemd.bbclass +++ b/meta/classes/systemd.bbclass @@ -12,13 +12,12 @@ SYSTEMD_AUTO_ENABLE ??= "enable" # even if systemd is not in DISTRO_FEATURES. As such don't make any changes # directly but check the DISTRO_FEATURES first. python __anonymous() { - features = d.getVar("DISTRO_FEATURES", True).split() # If the distro features have systemd but not sysvinit, inhibit update-rcd # from doing any work so that pure-systemd images don't have redundant init # files. - if "systemd" in features: + if oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): d.appendVar("DEPENDS", " systemd-systemctl-native") - if "sysvinit" not in features: + if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") } @@ -52,7 +51,7 @@ fi systemd_populate_packages[vardeps] += "systemd_prerm systemd_postinst" python systemd_populate_packages() { - if "systemd" not in d.getVar("DISTRO_FEATURES", True).split(): + if not oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): return def get_package_var(d, var, pkg): @@ -167,7 +166,7 @@ PACKAGESPLITFUNCS_prepend = "systemd_populate_packages " python rm_systemd_unitdir (){ import shutil - if "systemd" not in d.getVar("DISTRO_FEATURES", True).split(): + if not oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True)) if os.path.exists(systemd_unitdir): shutil.rmtree(systemd_unitdir) @@ -181,9 +180,9 @@ python rm_sysvinit_initddir (){ import shutil sysv_initddir = oe.path.join(d.getVar("D", True), (d.getVar('INIT_D_DIR', True) or "/etc/init.d")) - if ("systemd" in d.getVar("DISTRO_FEATURES", True).split() and - "sysvinit" not in d.getVar("DISTRO_FEATURES", True).split() and - os.path.exists(sysv_initddir)): + if oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \ + not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ + os.path.exists(sysv_initddir): systemd_unitdir = oe.path.join(d.getVar("D", True), d.getVar('systemd_unitdir', True), "system") # If systemd_unitdir contains anything, delete sysv_initddir diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass index 29b5a8ea27..c9bf04c4f8 100644 --- a/meta/classes/update-rc.d.bbclass +++ b/meta/classes/update-rc.d.bbclass @@ -105,7 +105,7 @@ python populate_packages_updatercd () { # Check that this class isn't being inhibited (generally, by # systemd.bbclass) before doing any work. - if "sysvinit" in d.getVar("DISTRO_FEATURES").split() or \ + if oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) or \ not d.getVar("INHIBIT_UPDATERCD_BBCLASS", True): pkgs = d.getVar('INITSCRIPT_PACKAGES', True) if pkgs == None: -- cgit v1.2.3-54-g00ecf