From 41bc192c0b5795561b239872008c91a867732219 Mon Sep 17 00:00:00 2001 From: Richard Purdie Date: Sat, 3 Mar 2012 10:59:25 +0000 Subject: meta: Convert getVar/getVarFlag(xxx, 1) -> (xxx, True) Using "1" with getVar is bad coding style and "True" is preferred. This patch is a sed over the meta directory of the form: sed \ -e 's:\(\.getVar([^,()]*, \)1 *):\1True):g' \ -e 's:\(\.getVarFlag([^,()]*, [^,()]*, \)1 *):\1True):g' \ -i `grep -ril getVar *` Signed-off-by: Richard Purdie --- meta/classes/base.bbclass | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'meta/classes/base.bbclass') diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index cab56deb3..48e4a28d8 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass @@ -60,8 +60,8 @@ def base_dep_prepend(d): # we need that built is the responsibility of the patch function / class, not # the application. if not d.getVar('INHIBIT_DEFAULT_DEPS'): - if (d.getVar('HOST_SYS', 1) != - d.getVar('BUILD_SYS', 1)): + if (d.getVar('HOST_SYS', True) != + d.getVar('BUILD_SYS', True)): deps += " virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc " return deps @@ -203,7 +203,7 @@ def preferred_ml_updates(d): def get_layers_branch_rev(d): - layers = (d.getVar("BBLAYERS", 1) or "").split() + layers = (d.getVar("BBLAYERS", True) or "").split() layers_branch_rev = ["%-17s = \"%s:%s\"" % (os.path.basename(i), \ base_get_metadata_git_branch(i, None).strip(), \ base_get_metadata_git_revision(i, None)) \ @@ -233,7 +233,7 @@ python base_eventhandler() { if name.startswith("BuildStarted"): e.data.setVar( 'BB_VERSION', bb.__version__) statusvars = ['BB_VERSION', 'TARGET_ARCH', 'TARGET_OS', 'MACHINE', 'DISTRO', 'DISTRO_VERSION','TUNE_FEATURES', 'TARGET_FPU'] - statuslines = ["%-17s = \"%s\"" % (i, e.data.getVar(i, 1) or '') for i in statusvars] + statuslines = ["%-17s = \"%s\"" % (i, e.data.getVar(i, True) or '') for i in statusvars] statuslines += get_layers_branch_rev(e.data) statusmsg = "\nOE Build Configuration:\n%s\n" % '\n'.join(statuslines) @@ -242,7 +242,7 @@ python base_eventhandler() { needed_vars = [ "TARGET_ARCH", "TARGET_OS" ] pesteruser = [] for v in needed_vars: - val = e.data.getVar(v, 1) + val = e.data.getVar(v, True) if not val or val == 'INVALID': pesteruser.append(v) if pesteruser: @@ -344,7 +344,7 @@ python () { pr = pr_prefix.group(0) + str(nval) + pr[prval.end():] d.setVar('PR', pr) - pn = d.getVar('PN', 1) + pn = d.getVar('PN', True) license = d.getVar('LICENSE', True) if license == "INVALID": bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn) @@ -370,36 +370,36 @@ python () { d.setVarFlag('do_package_setscene', 'fakeroot', 1) source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', 0) if not source_mirror_fetch: - need_host = d.getVar('COMPATIBLE_HOST', 1) + need_host = d.getVar('COMPATIBLE_HOST', True) if need_host: import re - this_host = d.getVar('HOST_SYS', 1) + this_host = d.getVar('HOST_SYS', True) if not re.match(need_host, this_host): raise bb.parse.SkipPackage("incompatible with host %s (not in COMPATIBLE_HOST)" % this_host) - need_machine = d.getVar('COMPATIBLE_MACHINE', 1) + need_machine = d.getVar('COMPATIBLE_MACHINE', True) if need_machine: import re - this_machine = d.getVar('MACHINE', 1) + this_machine = d.getVar('MACHINE', True) if this_machine and not re.match(need_machine, this_machine): - this_soc_family = d.getVar('SOC_FAMILY', 1) + this_soc_family = d.getVar('SOC_FAMILY', True) if (this_soc_family and not re.match(need_machine, this_soc_family)) or not this_soc_family: raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % this_machine) - dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', 1) + dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', True) if dont_want_license and not pn.endswith("-native") and not pn.endswith("-cross") and not pn.endswith("-cross-initial") and not pn.endswith("-cross-intermediate") and not pn.endswith("-crosssdk-intermediate") and not pn.endswith("-crosssdk") and not pn.endswith("-crosssdk-initial"): - hosttools_whitelist = (d.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, 1) or "").split() - lgplv2_whitelist = (d.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, 1) or "").split() - dont_want_whitelist = (d.getVar('WHITELIST_%s' % dont_want_license, 1) or "").split() + hosttools_whitelist = (d.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, True) or "").split() + lgplv2_whitelist = (d.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, True) or "").split() + dont_want_whitelist = (d.getVar('WHITELIST_%s' % dont_want_license, True) or "").split() if pn not in hosttools_whitelist and pn not in lgplv2_whitelist and pn not in dont_want_whitelist: - this_license = d.getVar('LICENSE', 1) + this_license = d.getVar('LICENSE', True) if incompatible_license(d,dont_want_license): bb.note("SKIPPING %s because it's %s" % (pn, this_license)) raise bb.parse.SkipPackage("incompatible with license %s" % this_license) - srcuri = d.getVar('SRC_URI', 1) + srcuri = d.getVar('SRC_URI', True) # Svn packages should DEPEND on subversion-native if "svn://" in srcuri: d.appendVarFlag('do_fetch', 'depends', ' subversion-native:do_populate_sysroot') @@ -426,8 +426,8 @@ python () { d.appendVarFlag('do_unpack', 'depends', ' unzip-native:do_populate_sysroot') # 'multimachine' handling - mach_arch = d.getVar('MACHINE_ARCH', 1) - pkg_arch = d.getVar('PACKAGE_ARCH', 1) + mach_arch = d.getVar('MACHINE_ARCH', True) + pkg_arch = d.getVar('PACKAGE_ARCH', True) if (pkg_arch == mach_arch): # Already machine specific - nothing further to do @@ -458,9 +458,9 @@ python () { d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}") return - packages = d.getVar('PACKAGES', 1).split() + packages = d.getVar('PACKAGES', True).split() for pkg in packages: - pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg, 1) + pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg, True) # We could look for != PACKAGE_ARCH here but how to choose # if multiple differences are present? -- cgit v1.2.3