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.

(From OE-Core rev: 93499ebc46547f5bf6dcecd5a786ead9f726de28)

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Otavio Salvador 2014-04-24 15:59:19 -03:00 committed by Richard Purdie
parent f11e9e295d
commit 08a38a7865
15 changed files with 25 additions and 39 deletions

View File

@ -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')

View File

@ -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")

View File

@ -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:

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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")
}

View File

@ -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() {

View File

@ -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')
}

View File

@ -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 ""

View File

@ -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')
}

View File

@ -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)
}

View File

@ -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")
}