diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-04 13:09:11 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2013-12-05 12:32:10 +0000 |
commit | 9c93526756e7cbbff027c88eb972f877bcb1f057 (patch) | |
tree | 327939f0ff75f9b439ed8d851af1e552db64acad /meta/classes | |
parent | 9a272ee6d72fc727a2dfe660ceded560a9f1ae88 (diff) | |
download | openembedded-core-9c93526756e7cbbff027c88eb972f877bcb1f057.tar.gz openembedded-core-9c93526756e7cbbff027c88eb972f877bcb1f057.tar.bz2 openembedded-core-9c93526756e7cbbff027c88eb972f877bcb1f057.zip |
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.
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes')
-rw-r--r-- | meta/classes/libc-package.bbclass | 6 | ||||
-rw-r--r-- | meta/classes/systemd.bbclass | 15 | ||||
-rw-r--r-- | meta/classes/update-rc.d.bbclass | 2 |
3 files changed, 11 insertions, 12 deletions
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: |