diff options
| author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-03 10:59:25 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-05 10:33:18 -0800 |
| commit | 41bc192c0b5795561b239872008c91a867732219 (patch) | |
| tree | a21feb51bde721ba553296676ce4b5ea2662bf37 | |
| parent | 3b57de68e70e77dbc03c0616a83a29a2e99e40b4 (diff) | |
| download | openembedded-core-41bc192c0b5795561b239872008c91a867732219.tar.gz openembedded-core-41bc192c0b5795561b239872008c91a867732219.tar.bz2 openembedded-core-41bc192c0b5795561b239872008c91a867732219.zip | |
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 <richard.purdie@linuxfoundation.org>
83 files changed, 290 insertions, 290 deletions
diff --git a/meta/classes/autotools.bbclass b/meta/classes/autotools.bbclass index a8d2b5f32e..66eba9fad0 100644 --- a/meta/classes/autotools.bbclass +++ b/meta/classes/autotools.bbclass @@ -1,8 +1,8 @@ def autotools_dep_prepend(d): - if d.getVar('INHIBIT_AUTOTOOLS_DEPS', 1): + if d.getVar('INHIBIT_AUTOTOOLS_DEPS', True): return '' - pn = d.getVar('PN', 1) + pn = d.getVar('PN', True) deps = '' if pn in ['autoconf-native', 'automake-native', 'help2man-native']: @@ -13,7 +13,7 @@ def autotools_dep_prepend(d): deps += 'libtool-native ' if not bb.data.inherits_class('native', d) \ and not bb.data.inherits_class('cross', d) \ - and not d.getVar('INHIBIT_DEFAULT_DEPS', 1): + and not d.getVar('INHIBIT_DEFAULT_DEPS', True): deps += 'libtool-cross ' return deps + 'gnu-config-native ' diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index cab56deb39..48e4a28d83 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? diff --git a/meta/classes/copyleft_compliance.bbclass b/meta/classes/copyleft_compliance.bbclass index 2eb9dedd24..4082e7e15d 100644 --- a/meta/classes/copyleft_compliance.bbclass +++ b/meta/classes/copyleft_compliance.bbclass @@ -69,8 +69,8 @@ python do_prepare_copyleft_sources () { else: bb.debug(1, 'copyleft: %s is included' % p) - sources_dir = d.getVar('COPYLEFT_SOURCES_DIR', 1) - src_uri = d.getVar('SRC_URI', 1).split() + sources_dir = d.getVar('COPYLEFT_SOURCES_DIR', True) + src_uri = d.getVar('SRC_URI', True).split() fetch = bb.fetch2.Fetch(src_uri, d) ud = fetch.ud diff --git a/meta/classes/cpan-base.bbclass b/meta/classes/cpan-base.bbclass index 79582ca76c..6cb1fefc29 100644 --- a/meta/classes/cpan-base.bbclass +++ b/meta/classes/cpan-base.bbclass @@ -28,7 +28,7 @@ def get_perl_version(d): # Determine where the library directories are def perl_get_libdirs(d): - libdir = d.getVar('libdir', 1) + libdir = d.getVar('libdir', True) if is_target(d) == "no": libdir += '/perl-native' libdir += '/perl' diff --git a/meta/classes/cpan_build.bbclass b/meta/classes/cpan_build.bbclass index 981332c4fa..36ffc56b85 100644 --- a/meta/classes/cpan_build.bbclass +++ b/meta/classes/cpan_build.bbclass @@ -10,9 +10,9 @@ inherit cpan-base # libmodule-build-perl) # def cpan_build_dep_prepend(d): - if d.getVar('CPAN_BUILD_DEPS', 1): + if d.getVar('CPAN_BUILD_DEPS', True): return '' - pn = d.getVar('PN', 1) + pn = d.getVar('PN', True) if pn in ['libmodule-build-perl', 'libmodule-build-perl-native']: return '' return 'libmodule-build-perl-native ' diff --git a/meta/classes/debian.bbclass b/meta/classes/debian.bbclass index 025abcfad0..3637e2ebe7 100644 --- a/meta/classes/debian.bbclass +++ b/meta/classes/debian.bbclass @@ -22,8 +22,8 @@ python () { python debian_package_name_hook () { import glob, copy, stat, errno, re - pkgdest = d.getVar('PKGDEST', 1) - packages = d.getVar('PACKAGES', 1) + pkgdest = d.getVar('PKGDEST', True) + packages = d.getVar('PACKAGES', True) bin_re = re.compile(".*/s?" + os.path.basename(d.getVar("bindir", True)) + "$") lib_re = re.compile(".*/" + os.path.basename(d.getVar("libdir", True)) + "$") so_re = re.compile("lib.*\.so") @@ -60,7 +60,7 @@ python debian_package_name_hook () { for f in files: if so_re.match(f): fp = os.path.join(root, f) - cmd = (d.getVar('BUILD_PREFIX', 1) or "") + "objdump -p " + fp + " 2>/dev/null" + cmd = (d.getVar('BUILD_PREFIX', True) or "") + "objdump -p " + fp + " 2>/dev/null" fd = os.popen(cmd) lines = fd.readlines() fd.close() @@ -74,7 +74,7 @@ python debian_package_name_hook () { if len(sonames) == 1: soname = sonames[0] elif len(sonames) > 1: - lead = d.getVar('LEAD_SONAME', 1) + lead = d.getVar('LEAD_SONAME', True) if lead: r = re.compile(lead) filtered = [] @@ -117,7 +117,7 @@ python debian_package_name_hook () { # and later # DEBUG: LIBNAMES: pkgname libtic5 devname libtic pkg ncurses-libticw orig_pkg ncurses-libtic debian_pn None newpkg libticw # so we need to handle ncurses-libticw->libticw5 before ncurses-libtic->libtic5 - for pkg in sorted((d.getVar('AUTO_LIBNAME_PKGS', 1) or "").split(), reverse=True): + for pkg in sorted((d.getVar('AUTO_LIBNAME_PKGS', True) or "").split(), reverse=True): auto_libname(packages, pkg) } diff --git a/meta/classes/distrodata.bbclass b/meta/classes/distrodata.bbclass index ff5b836871..aba4bd7fa6 100644 --- a/meta/classes/distrodata.bbclass +++ b/meta/classes/distrodata.bbclass @@ -372,7 +372,7 @@ python do_checkpkg() { f.close() if status != "ErrHostNoDir" and re.match("Err", status): - logpath = d.getVar('LOG_DIR', 1) + logpath = d.getVar('LOG_DIR', True) os.system("cp %s %s/" % (f.name, logpath)) os.unlink(f.name) return status diff --git a/meta/classes/distutils-base.bbclass b/meta/classes/distutils-base.bbclass index e7d0bb8071..6d18e08f14 100644 --- a/meta/classes/distutils-base.bbclass +++ b/meta/classes/distutils-base.bbclass @@ -1,4 +1,4 @@ -DEPENDS += "${@["python-native python", ""][(d.getVar('PACKAGES', 1) == '')]}" +DEPENDS += "${@["python-native python", ""][(d.getVar('PACKAGES', True) == '')]}" RDEPENDS_${PN} += "${@['', 'python-core']['${PN}' == '${BPN}']}" inherit distutils-common-base diff --git a/meta/classes/distutils-native-base.bbclass b/meta/classes/distutils-native-base.bbclass index 47367d796b..ceda512e39 100644 --- a/meta/classes/distutils-native-base.bbclass +++ b/meta/classes/distutils-native-base.bbclass @@ -1,3 +1,3 @@ -DEPENDS += "${@["python-native", ""][(d.getVar('PACKAGES', 1) == '')]}" +DEPENDS += "${@["python-native", ""][(d.getVar('PACKAGES', True) == '')]}" inherit distutils-common-base diff --git a/meta/classes/gconf.bbclass b/meta/classes/gconf.bbclass index 7bfa871bd2..095d04b1b8 100644 --- a/meta/classes/gconf.bbclass +++ b/meta/classes/gconf.bbclass @@ -32,8 +32,8 @@ done python populate_packages_append () { import re - packages = d.getVar('PACKAGES', 1).split() - pkgdest = d.getVar('PKGDEST', 1) + packages = d.getVar('PACKAGES', True).split() + pkgdest = d.getVar('PKGDEST', True) for pkg in packages: schema_dir = '%s/%s/etc/gconf/schemas' % (pkgdest, pkg) @@ -46,15 +46,15 @@ python populate_packages_append () { if schemas != []: bb.note("adding gconf postinst and prerm scripts to %s" % pkg) d.setVar('SCHEMA_FILES', " ".join(schemas)) - postinst = d.getVar('pkg_postinst_%s' % pkg, 1) or d.getVar('pkg_postinst', 1) + postinst = d.getVar('pkg_postinst_%s' % pkg, True) or d.getVar('pkg_postinst', True) if not postinst: postinst = '#!/bin/sh\n' |
