meta: cleanup d.getVar(var, 1) and d.getVar(var, 0)
cover meta: cleanup d.getVar(var, 1) and d.getVar(var, 0)
The following changes since commit 4d268abc2fc892c5d34449f78c8e9f2b1a9d6bac:
oeqa.runtime.smart: work around smart race issues (2016-09-09 12:12:17 +0100)
are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib rbt/getvar
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=rbt/getvar
Robert Yang (2):
meta: cleanup d.getVar(var, 1)
meta: cleanup d.getVar(var, 0)
meta/classes/base.bbclass | 2 +- meta/classes/image.bbclass | 2 +- meta/classes/kernel.bbclass | 8 ++++---- meta/classes/package.bbclass | 2 +- meta/classes/package_ipk.bbclass | 2 +- meta/classes/recipe_sanity.bbclass | 22 +++++++++++----------- meta/lib/oe/utils.py | 4 ++-- meta/recipes-devtools/apt/apt-native.inc | 2 +- meta/recipes-devtools/cmake/cmake.inc | 2 +- .../kconfig-frontends_3.12.0.0.bb | 2 +- meta/recipes-devtools/vala/vala.inc | 2 +- meta/recipes-support/boost/boost-1.61.0.inc | 4 ++-- 12 files changed, 27 insertions(+), 27 deletions(-)
Signature · 1 line
2.9.0
PATCH 1/2 meta: cleanup d.getVar(var, 1)
Signed-off-by Robert Yang <[email protected]>
--- meta/classes/kernel.bbclass | 8 ++++---- meta/classes/package_ipk.bbclass | 2 +- meta/lib/oe/utils.py | 4 ++-- meta/recipes-devtools/apt/apt-native.inc | 2 +- meta/recipes-devtools/cmake/cmake.inc | 2 +- .../kconfig-frontends/kconfig-frontends_3.12.0.0.bb | 2 +- meta/recipes-devtools/vala/vala.inc | 2 +- meta/recipes-support/boost/boost-1.61.0.inc | 4 ++-- 8 files changed, 13 insertions(+), 13 deletions(-)
meta/classes/kernel.bbclass +4 -4
@@ -127,9 +127,9 @@ PACKAGES_DYNAMIC += "^kernel-firmware-.*" export OS = "${TARGET_OS}" export CROSS_COMPILE = "${TARGET_PREFIX}" -KERNEL_PRIORITY ?= "${@int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[0]) * 10000 + \ - int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[1]) * 100 + \ - int(d.getVar('PV',1).split('-')[0].split('+')[0].split('.')[-1])}" +KERNEL_PRIORITY ?= "${@int(d.getVar('PV', True).split('-')[0].split('+')[0].split('.')[0]) * 10000 + \ + int(d.getVar('PV', True).split('-')[0].split('+')[0].split('.')[1]) * 100 + \ + int(d.getVar('PV', True).split('-')[0].split('+')[0].split('.')[-1])}" KERNEL_RELEASE ?= "${KERNEL_VERSION}"
@@ -140,7 +140,7 @@ KERNEL_IMAGEDEST = "boot" # # configuration # -export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}" +export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE", True) or "ttyS0"}" KERNEL_VERSION = "${@get_kernelversion_headers('${B}')}"
meta/classes/package_ipk.bbclass +1 -1
@@ -245,7 +245,7 @@ python do_package_ipk () { os.chdir(basedir) ret = subprocess.call("PATH=\"%s\" %s %s %s" % (localdata.getVar("PATH", True), - d.getVar("OPKGBUILDCMD",1), pkg, pkgoutdir), shell=True) + d.getVar("OPKGBUILDCMD", True), pkg, pkgoutdir), shell=True) if ret != 0: bb.utils.unlockfile(lf) raise bb.build.FuncFailed("opkg-build execution failed")
meta/lib/oe/utils.py +2 -2
@@ -23,13 +23,13 @@ def ifelse(condition, iftrue = True, iffalse = False): return iffalse def conditional(variable, checkvalue, truevalue, falsevalue, d): - if d.getVar(variable,1) == checkvalue: + if d.getVar(variable, True) == checkvalue: return truevalue else: return falsevalue def less_or_equal(variable, checkvalue, truevalue, falsevalue, d): - if float(d.getVar(variable,1)) <= float(checkvalue): + if float(d.getVar(variable, True)) <= float(checkvalue): return truevalue else: return falsevalue
meta/recipes-devtools/apt/apt-native.inc +1 -1
@@ -17,7 +17,7 @@ python do_install () { } python do_install_config () { - indir = os.path.dirname(d.getVar('FILE',1)) + indir = os.path.dirname(d.getVar('FILE', True)) infile = open(oe.path.join(indir, 'files', 'apt.conf'), 'r') data = infile.read() infile.close()
meta/recipes-devtools/cmake/cmake.inc +1 -1
@@ -9,7 +9,7 @@ LICENSE = "BSD" LIC_FILES_CHKSUM = "file://Copyright.txt;md5=052f86c15bbde68af55c7f7b340ab639 \ file://Source/cmake.h;beginline=1;endline=10;md5=341736dae83c9e344b53eeb1bc7d7bc2" -CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV',1).split('.')[0:2])}" +CMAKE_MAJOR_VERSION = "${@'.'.join(d.getVar('PV', True).split('.')[0:2])}" SRC_URI = "https://cmake.org/files/v${CMAKE_MAJOR_VERSION}/cmake-${PV}.tar.gz \ file://support-oe-qt4-tools-names.patch \
meta/recipes-devtools/kconfig-frontends/kconfig-frontends_3.12.0.0.bb +1 -1
@@ -32,7 +32,7 @@ EXTRA_OECONF += "--disable-gconf --disable-qconf" # Some packages have the version preceeding the .so instead properly # versioned .so.<version>, so we need to reorder and repackage. -SOLIBS = "-${@d.getVar('PV',1)[:-2]}.so" +SOLIBS = "-${@d.getVar('PV', True)[:-2]}.so" FILES_SOLIBSDEV = "${libdir}/libkconfig-parser.so" BBCLASSEXTEND = "native"
meta/recipes-devtools/vala/vala.inc +1 -1
@@ -11,7 +11,7 @@ HOMEPAGE = "http://vala-project.org" LICENSE = "LGPLv2.1" LIC_FILES_CHKSUM = "file://COPYING;md5=fbc093901857fcd118f065f900982c24" -SHRT_VER = "${@d.getVar('PV',1).split('.')[0]}.${@d.getVar('PV',1).split('.')[1]}" +SHRT_VER = "${@d.getVar('PV', True).split('.')[0]}.${@d.getVar('PV', True).split('.')[1]}" SRC_URI = "http://ftp.gnome.org/pub/GNOME/sources/${BPN}/${SHRT_VER}/${BP}.tar.xz" inherit autotools pkgconfig upstream-version-is-even
meta/recipes-support/boost/boost-1.61.0.inc +2 -2
@@ -7,8 +7,8 @@ HOMEPAGE = "http://www.boost.org/" LICENSE = "BSL-1.0 & MIT & Python-2.0" LIC_FILES_CHKSUM = "file://LICENSE_1_0.txt;md5=e4224ccaecb14d942c71d31bef20d78c" -BOOST_VER = "${@"_".join(d.getVar("PV",1).split("."))}" -BOOST_MAJ = "${@"_".join(d.getVar("PV",1).split(".")[0:2])}" +BOOST_VER = "${@"_".join(d.getVar("PV", True).split("."))}" +BOOST_MAJ = "${@"_".join(d.getVar("PV", True).split(".")[0:2])}" BOOST_P = "boost_${BOOST_VER}" SRC_URI = "${SOURCEFORGE_MIRROR}/boost/${BOOST_P}.tar.bz2"
Signature · 1 line
2.9.0
PATCH 2/2 meta: cleanup d.getVar(var, 0)
In reply to Robert YangSigned-off-by Robert Yang <[email protected]>
--- meta/classes/base.bbclass | 2 +- meta/classes/image.bbclass | 2 +- meta/classes/package.bbclass | 2 +- meta/classes/recipe_sanity.bbclass | 22 +++++++++++----------- 4 files changed, 14 insertions(+), 14 deletions(-)
meta/classes/base.bbclass +1 -1
@@ -472,7 +472,7 @@ python () { else: raise bb.parse.SkipPackage("incompatible with machine %s (not in COMPATIBLE_MACHINE)" % d.getVar('MACHINE', True)) - source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', 0) + source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', False) if not source_mirror_fetch: need_host = d.getVar('COMPATIBLE_HOST', True) if need_host:
meta/classes/image.bbclass +1 -1
@@ -359,7 +359,7 @@ python () { # Without de-duplication, gen_conversion_cmds() below # would create the same compression command multiple times. ctypes = set(d.getVar('CONVERSIONTYPES', True).split()) - old_overrides = d.getVar('OVERRIDES', 0) + old_overrides = d.getVar('OVERRIDES', False) def _image_base_type(type): basetype = type
meta/classes/package.bbclass +1 -1
@@ -1490,7 +1490,7 @@ python package_do_shlibs() { import re, pipes import subprocess as sub - exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', 0) + exclude_shlibs = d.getVar('EXCLUDE_FROM_SHLIBS', False) if exclude_shlibs: bb.note("not generating shlibs") return
meta/classes/recipe_sanity.bbclass +11 -11
@@ -8,7 +8,7 @@ def bad_runtime_vars(cfgdata, d): return for var in d.getVar("__recipe_sanity_badruntimevars", True).split(): - val = d.getVar(var, 0) + val = d.getVar(var, False) if val and val != cfgdata.get(var): __note("%s should be %s_${PN}" % (var, var), d)
@@ -16,11 +16,11 @@ __recipe_sanity_reqvars = "DESCRIPTION" __recipe_sanity_reqdiffvars = "" def req_vars(cfgdata, d): for var in d.getVar("__recipe_sanity_reqvars", True).split(): - if not d.getVar(var, 0): + if not d.getVar(var, False): __note("%s should be set" % var, d) for var in d.getVar("__recipe_sanity_reqdiffvars", True).split(): - val = d.getVar(var, 0) + val = d.getVar(var, False) cfgval = cfgdata.get(var) if not val:
@@ -29,7 +29,7 @@ def req_vars(cfgdata, d): __note("%s should be defined to something other than default (%s)" % (var, cfgval), d) def var_renames_overwrite(cfgdata, d): - renames = d.getVar("__recipe_sanity_renames", 0) + renames = d.getVar("__recipe_sanity_renames", False) if renames: for (key, newkey, oldvalue, newvalue) in renames: if oldvalue != newvalue and oldvalue != cfgdata.get(newkey):
@@ -50,7 +50,7 @@ def can_use_autotools_base(cfgdata, d): if cfg.find(i) != -1: return False - for clsfile in d.getVar("__inherit_cache", 0): + for clsfile in d.getVar("__inherit_cache", False): (base, _) = os.path.splitext(os.path.basename(clsfile)) if cfg.find("%s_do_configure" % base) != -1: __note("autotools_base usage needs verification, spotted %s_do_configure" % base, d)
@@ -60,7 +60,7 @@ def can_use_autotools_base(cfgdata, d): def can_delete_FILESPATH(cfgdata, d): expected = cfgdata.get("FILESPATH") expectedpaths = d.expand(expected) - unexpanded = d.getVar("FILESPATH", 0) + unexpanded = d.getVar("FILESPATH", False) filespath = d.getVar("FILESPATH", True).split(":") filespath = [os.path.normpath(f) for f in filespath if os.path.exists(f)] for fp in filespath:
@@ -73,7 +73,7 @@ def can_delete_FILESPATH(cfgdata, d): def can_delete_FILESDIR(cfgdata, d): expected = cfgdata.get("FILESDIR") #expected = "${@bb.utils.which(d.getVar('FILESPATH', True), '.')}" - unexpanded = d.getVar("FILESDIR", 0) + unexpanded = d.getVar("FILESDIR", False) if unexpanded is None: return False
@@ -90,7 +90,7 @@ def can_delete_others(p, cfgdata, d): for k in ["S", "PV", "PN", "DESCRIPTION", "DEPENDS", "SECTION", "PACKAGES", "EXTRA_OECONF", "EXTRA_OEMAKE"]: #for k in cfgdata: - unexpanded = d.getVar(k, 0) + unexpanded = d.getVar(k, False) cfgunexpanded = cfgdata.get(k) if not cfgunexpanded: continue
@@ -117,7 +117,7 @@ python do_recipe_sanity () { #(can_use_autotools_base, "candidate for use of autotools_base"), (incorrect_nonempty_PACKAGES, "native or cross recipe with non-empty PACKAGES"), ] - cfgdata = d.getVar("__recipe_sanity_cfgdata", 0) + cfgdata = d.getVar("__recipe_sanity_cfgdata", False) for (func, msg) in sanitychecks: if func(cfgdata, d):
@@ -143,8 +143,8 @@ python recipe_sanity_eh () { cfgdata = {} for k in d.keys(): - if not isinstance(d.getVar(k, 0), bb.data_smart.DataSmart): - cfgdata[k] = d.getVar(k, 0) + if not isinstance(d.getVar(k, False), bb.data_smart.DataSmart): + cfgdata[k] = d.getVar(k, False) d.setVar("__recipe_sanity_cfgdata", cfgdata) #d.setVar("__recipe_sanity_cfgdata", d)
Signature · 1 line
2.9.0