From: Otavio Salvador Date: Thu, 24 Apr 2014 18:59:19 +0000 (-0300) Subject: Globally replace oe.utils.contains to bb.utils.contains X-Git-Tag: 2015-4~3007 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=93499ebc46547f5bf6dcecd5a786ead9f726de28;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git Globally replace oe.utils.contains to bb.utils.contains BitBake has the exact same code as oe.utils.contains so there's no reason to duplicate it. We now rely on the bb.utils.contains code for metadata. Signed-off-by: Otavio Salvador Signed-off-by: Richard Purdie --- diff --git a/meta/classes/libc-package.bbclass b/meta/classes/libc-package.bbclass index 0af42a002ce..c1bc399c187 100644 --- a/meta/classes/libc-package.bbclass +++ b/meta/classes/libc-package.bbclass @@ -37,9 +37,9 @@ python __anonymous () { break # try to fix disable charsets/locales/locale-code compile fail - 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): + if bb.utils.contains('DISTRO_FEATURES', 'libc-charsets', True, False, d) and \ + bb.utils.contains('DISTRO_FEATURES', 'libc-locales', True, False, d) and \ + bb.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 2bd63a405b7..a6ad723dfdf 100644 --- a/meta/classes/systemd.bbclass +++ b/meta/classes/systemd.bbclass @@ -15,9 +15,9 @@ python __anonymous() { # 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 oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): + if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): d.appendVar("DEPENDS", " systemd-systemctl-native") - if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") } @@ -57,7 +57,7 @@ fi systemd_populate_packages[vardeps] += "systemd_prerm systemd_postinst" python systemd_populate_packages() { - if not oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): + if not bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): return def get_package_var(d, var, pkg): @@ -172,7 +172,7 @@ PACKAGESPLITFUNCS_prepend = "systemd_populate_packages " python rm_systemd_unitdir (){ import shutil - if not oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d): + if not bb.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) @@ -186,8 +186,8 @@ 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 oe.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \ - not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ + if bb.utils.contains('DISTRO_FEATURES', 'systemd', True, False, d) and \ + not bb.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") diff --git a/meta/classes/update-rc.d.bbclass b/meta/classes/update-rc.d.bbclass index 0ac2af7d973..81cc97621ae 100644 --- a/meta/classes/update-rc.d.bbclass +++ b/meta/classes/update-rc.d.bbclass @@ -117,7 +117,7 @@ python populate_packages_updatercd () { # Check that this class isn't being inhibited (generally, by # systemd.bbclass) before doing any work. - if oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ + if bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d) and \ not d.getVar("INHIBIT_UPDATERCD_BBCLASS", True): pkgs = d.getVar('INITSCRIPT_PACKAGES', True) if pkgs == None: diff --git a/meta/classes/utils.bbclass b/meta/classes/utils.bbclass index 89ad8c55314..0ee13e04d72 100644 --- a/meta/classes/utils.bbclass +++ b/meta/classes/utils.bbclass @@ -24,7 +24,7 @@ def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): return oe.utils.version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d) def base_contains(variable, checkvalues, truevalue, falsevalue, d): - return oe.utils.contains(variable, checkvalues, truevalue, falsevalue, d) + return bb.utils.contains(variable, checkvalues, truevalue, falsevalue, d) def base_both_contain(variable1, variable2, checkvalue, d): return oe.utils.both_contain(variable1, variable2, checkvalue, d) diff --git a/meta/lib/oe/rootfs.py b/meta/lib/oe/rootfs.py index dddbef4d64e..3d1111a40ab 100644 --- a/meta/lib/oe/rootfs.py +++ b/meta/lib/oe/rootfs.py @@ -1,6 +1,5 @@ from abc import ABCMeta, abstractmethod from oe.utils import execute_pre_post_process -from oe.utils import contains as base_contains from oe.package_manager import * from oe.manifest import * import oe.path @@ -42,7 +41,7 @@ class Rootfs(object): pass def _insert_feed_uris(self): - if base_contains("IMAGE_FEATURES", "package-management", + if bb.utils.contains("IMAGE_FEATURES", "package-management", True, False, self.d): self.pm.insert_feeds_uris() @@ -108,7 +107,7 @@ class Rootfs(object): execute_pre_post_process(self.d, post_process_cmds) - if base_contains("IMAGE_FEATURES", "read-only-rootfs", + if bb.utils.contains("IMAGE_FEATURES", "read-only-rootfs", True, False, self.d): delayed_postinsts = self._get_delayed_postinsts() if delayed_postinsts is not None: @@ -130,7 +129,7 @@ class Rootfs(object): self._cleanup() def _uninstall_uneeded(self): - if base_contains("IMAGE_FEATURES", "package-management", + if bb.utils.contains("IMAGE_FEATURES", "package-management", True, False, self.d): return diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py index defa53679be..0a1d1080c94 100644 --- a/meta/lib/oe/utils.py +++ b/meta/lib/oe/utils.py @@ -41,19 +41,6 @@ def version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d): else: return falsevalue -def contains(variable, checkvalues, truevalue, falsevalue, d): - val = d.getVar(variable, True) - if not val: - return falsevalue - val = set(val.split()) - if isinstance(checkvalues, basestring): - checkvalues = set(checkvalues.split()) - else: - checkvalues = set(checkvalues) - if checkvalues.issubset(val): - return truevalue - return falsevalue - def both_contain(variable1, variable2, checkvalue, d): if d.getVar(variable1,1).find(checkvalue) != -1 and d.getVar(variable2,1).find(checkvalue) != -1: return checkvalue diff --git a/meta/recipes-core/dbus/dbus.inc b/meta/recipes-core/dbus/dbus.inc index 5727ae77b22..8d348f8f25b 100644 --- a/meta/recipes-core/dbus/dbus.inc +++ b/meta/recipes-core/dbus/dbus.inc @@ -25,7 +25,7 @@ INITSCRIPT_NAME = "dbus-1" INITSCRIPT_PARAMS = "start 02 5 3 2 . stop 20 0 1 6 ." python __anonymous() { - if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") } diff --git a/meta/recipes-core/systemd/systemd-serialgetty.bb b/meta/recipes-core/systemd/systemd-serialgetty.bb index 13b2dbacec6..1c34d5c747c 100644 --- a/meta/recipes-core/systemd/systemd-serialgetty.bb +++ b/meta/recipes-core/systemd/systemd-serialgetty.bb @@ -44,6 +44,6 @@ PACKAGE_ARCH = "${MACHINE_ARCH}" # As this package is tied to systemd, only build it when we're also building systemd. python () { - if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): + if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") } diff --git a/meta/recipes-core/systemd/systemd_211.bb b/meta/recipes-core/systemd/systemd_211.bb index 44b196538a4..278de9fd561 100644 --- a/meta/recipes-core/systemd/systemd_211.bb +++ b/meta/recipes-core/systemd/systemd_211.bb @@ -295,7 +295,7 @@ INITSCRIPT_NAME_udev = "systemd-udevd" INITSCRIPT_PARAMS_udev = "start 03 S ." python __anonymous() { - if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): d.setVar("INHIBIT_UPDATERCD_BBCLASS", "1") } @@ -348,6 +348,6 @@ pkg_prerm_udev-hwdb () { # As this recipe builds udev, respect systemd being in DISTRO_FEATURES so # that we don't build both udev and systemd in world builds. python () { - if not oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): + if not bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): raise bb.parse.SkipPackage("'systemd' not in DISTRO_FEATURES") } diff --git a/meta/recipes-core/udev/udev.inc b/meta/recipes-core/udev/udev.inc index 1b22525436c..f9d544e86a9 100644 --- a/meta/recipes-core/udev/udev.inc +++ b/meta/recipes-core/udev/udev.inc @@ -99,7 +99,7 @@ do_install_append () { # As systemd also builds udev, skip this package if we're doing a systemd build. python () { - if oe.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): + if bb.utils.contains ('DISTRO_FEATURES', 'systemd', True, False, d): raise bb.parse.SkipPackage("'systemd' in DISTRO_FEATURES") } do_compile_ptest() { diff --git a/meta/recipes-devtools/dpkg/dpkg.inc b/meta/recipes-devtools/dpkg/dpkg.inc index eef7ce9d40e..ca44e982325 100644 --- a/meta/recipes-devtools/dpkg/dpkg.inc +++ b/meta/recipes-devtools/dpkg/dpkg.inc @@ -17,7 +17,7 @@ PARALLEL_MAKE = "" inherit autotools gettext perlnative pkgconfig systemd python () { - if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): pn = d.getVar('PN', True) d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'dpkg-configure.service') } diff --git a/meta/recipes-devtools/gcc/gcc-common.inc b/meta/recipes-devtools/gcc/gcc-common.inc index feb402e75d3..1e00249b192 100644 --- a/meta/recipes-devtools/gcc/gcc-common.inc +++ b/meta/recipes-devtools/gcc/gcc-common.inc @@ -19,7 +19,7 @@ def get_gcc_fpu_setting(bb, d): get_gcc_fpu_setting[vardepvalue] = "${@get_gcc_fpu_setting(bb, d)}" def get_gcc_mips_plt_setting(bb, d): - if d.getVar('TRANSLATED_TARGET_ARCH', True) in [ 'mips', 'mipsel' ] and oe.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): + if d.getVar('TRANSLATED_TARGET_ARCH', True) in [ 'mips', 'mipsel' ] and bb.utils.contains('DISTRO_FEATURES', 'mplt', True, False, d): return "--with-mips-plt" return "" @@ -32,7 +32,7 @@ def get_gcc_multiarch_setting(bb, d): "sparc": "--enable-targets=all", } - if oe.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d): + if bb.utils.contains('DISTRO_FEATURES', 'multiarch', True, False, d): if target_arch in multiarch_options : return multiarch_options[target_arch] return "" diff --git a/meta/recipes-devtools/opkg/opkg.inc b/meta/recipes-devtools/opkg/opkg.inc index 9f87df551eb..198e5001af8 100644 --- a/meta/recipes-devtools/opkg/opkg.inc +++ b/meta/recipes-devtools/opkg/opkg.inc @@ -17,7 +17,7 @@ do_configure_prepend() { inherit autotools pkgconfig systemd python () { - if not oe.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): + if not bb.utils.contains('DISTRO_FEATURES', 'sysvinit', True, False, d): pn = d.getVar('PN', True) d.setVar('SYSTEMD_SERVICE_%s' % (pn), 'opkg-configure.service') } diff --git a/meta/recipes-devtools/perl/perl-ptest.inc b/meta/recipes-devtools/perl/perl-ptest.inc index 914ca0f4c0b..9ef7d0a262b 100644 --- a/meta/recipes-devtools/perl/perl-ptest.inc +++ b/meta/recipes-devtools/perl/perl-ptest.inc @@ -42,7 +42,7 @@ python populate_packages_prepend() { # Put all *.t files from the lib dir in the ptest package # do_split_packages requires a pair of () in the regex, but we have nothing # to match, so use an empty pair. - if oe.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d): + if bb.utils.contains('DISTRO_FEATURES', 'ptest', True, False, d): do_split_packages(d, d.expand('${libdir}/perl/${PV}'), '.*\.t()', '${PN}-ptest%s', '%s', recursive=True, match_path=True) } diff --git a/meta/recipes-graphics/xorg-driver/xf86-video-omap_git.bb b/meta/recipes-graphics/xorg-driver/xf86-video-omap_git.bb index 97941ecc0cb..454d0a1fb25 100644 --- a/meta/recipes-graphics/xorg-driver/xf86-video-omap_git.bb +++ b/meta/recipes-graphics/xorg-driver/xf86-video-omap_git.bb @@ -42,7 +42,7 @@ do_compile_prepend_armv7a () { } python () { - if not oe.utils.contains ('DISTRO_FEATURES', 'opengl', True, False, d): + if not bb.utils.contains ('DISTRO_FEATURES', 'opengl', True, False, d): raise bb.parse.SkipPackage("'opengl' not in DISTRO_FEATURES") }