mirror of
https://git.yoctoproject.org/poky
synced 2026-04-05 08:02:25 +02:00
Convert to use direct access to the data store (instead of bb.data.*Var*())
This is the result of running the following over the metadata: sed \ -e 's:bb.data.\(setVar([^,()]*,[^,()]*\), *\([^ )]*\) *):\2.\1):g' \ -e 's:bb.data.\(setVarFlag([^,()]*,[^,()]*,[^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^(), ]*\) *,\([^)]*\)):\2.\1,\3):g' \ -e 's:bb.data.\(getVarFlag([^,()]*,[^,()]*\), *\([^() ]*\) *):\2.\1):g' \ -e 's:bb.data.\(getVar([^,()]*\), *\([^) ]*\) *):\2.\1):g' \ -i `grep -ril bb.data *` (From OE-Core rev: b22831fd63164c4db9c0b72934d7d734a6585251) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
@@ -60,9 +60,9 @@ def base_dep_prepend(d):
|
||||
# INHIBIT_DEFAULT_DEPS doesn't apply to the patch command. Whether or not
|
||||
# we need that built is the responsibility of the patch function / class, not
|
||||
# the application.
|
||||
if not bb.data.getVar('INHIBIT_DEFAULT_DEPS', d):
|
||||
if (bb.data.getVar('HOST_SYS', d, 1) !=
|
||||
bb.data.getVar('BUILD_SYS', d, 1)):
|
||||
if not d.getVar('INHIBIT_DEFAULT_DEPS'):
|
||||
if (d.getVar('HOST_SYS', 1) !=
|
||||
d.getVar('BUILD_SYS', 1)):
|
||||
deps += " virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc "
|
||||
return deps
|
||||
|
||||
@@ -73,13 +73,13 @@ DEPENDS_prepend="${BASEDEPENDS} "
|
||||
FILESPATH = "${@base_set_filespath([ "${FILE_DIRNAME}/${PF}", "${FILE_DIRNAME}/${P}", "${FILE_DIRNAME}/${PN}", "${FILE_DIRNAME}/${BP}", "${FILE_DIRNAME}/${BPN}", "${FILE_DIRNAME}/files", "${FILE_DIRNAME}" ], d)}"
|
||||
# THISDIR only works properly with imediate expansion as it has to run
|
||||
# in the context of the location its used (:=)
|
||||
THISDIR = "${@os.path.dirname(bb.data.getVar('FILE', d, True))}"
|
||||
THISDIR = "${@os.path.dirname(d.getVar('FILE', True))}"
|
||||
|
||||
addtask fetch
|
||||
do_fetch[dirs] = "${DL_DIR}"
|
||||
python base_do_fetch() {
|
||||
|
||||
src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split()
|
||||
src_uri = (d.getVar('SRC_URI', True) or "").split()
|
||||
if len(src_uri) == 0:
|
||||
return
|
||||
|
||||
@@ -96,14 +96,14 @@ python base_do_fetch() {
|
||||
addtask unpack after do_fetch
|
||||
do_unpack[dirs] = "${WORKDIR}"
|
||||
python base_do_unpack() {
|
||||
src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split()
|
||||
src_uri = (d.getVar('SRC_URI', True) or "").split()
|
||||
if len(src_uri) == 0:
|
||||
return
|
||||
|
||||
localdata = bb.data.createCopy(d)
|
||||
bb.data.update_data(localdata)
|
||||
|
||||
rootdir = bb.data.getVar('WORKDIR', localdata, True)
|
||||
rootdir = localdata.getVar('WORKDIR', True)
|
||||
|
||||
try:
|
||||
fetcher = bb.fetch2.Fetch(src_uri, localdata)
|
||||
@@ -118,7 +118,7 @@ def generate_git_config(e):
|
||||
from bb import data
|
||||
|
||||
if data.getVar('GIT_CORE_CONFIG', e.data, True):
|
||||
gitconfig_path = bb.data.getVar('GIT_CONFIG', e.data, True)
|
||||
gitconfig_path = e.data.getVar('GIT_CONFIG', True)
|
||||
proxy_command = " gitproxy = %s\n" % data.getVar('GIT_PROXY_COMMAND', e.data, True)
|
||||
|
||||
bb.mkdirhier(bb.data.expand("${STAGING_DIR_NATIVE}/usr/etc/", e.data))
|
||||
@@ -207,11 +207,11 @@ python base_eventhandler() {
|
||||
name = getName(e)
|
||||
|
||||
if name.startswith("BuildStarted"):
|
||||
bb.data.setVar( 'BB_VERSION', bb.__version__, e.data )
|
||||
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, bb.data.getVar(i, e.data, 1) or '') for i in statusvars]
|
||||
statuslines = ["%-17s = \"%s\"" % (i, e.data.getVar(i, 1) or '') for i in statusvars]
|
||||
|
||||
layers = (bb.data.getVar("BBLAYERS", e.data, 1) or "").split()
|
||||
layers = (e.data.getVar("BBLAYERS", 1) 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)) \
|
||||
@@ -237,7 +237,7 @@ python base_eventhandler() {
|
||||
needed_vars = [ "TARGET_ARCH", "TARGET_OS" ]
|
||||
pesteruser = []
|
||||
for v in needed_vars:
|
||||
val = bb.data.getVar(v, e.data, 1)
|
||||
val = e.data.getVar(v, 1)
|
||||
if not val or val == 'INVALID':
|
||||
pesteruser.append(v)
|
||||
if pesteruser:
|
||||
@@ -330,23 +330,23 @@ python () {
|
||||
appendVar('EXTRA_OECONF', extraconf)
|
||||
|
||||
# If PRINC is set, try and increase the PR value by the amount specified
|
||||
princ = bb.data.getVar('PRINC', d, True)
|
||||
princ = d.getVar('PRINC', True)
|
||||
if princ:
|
||||
pr = bb.data.getVar('PR', d, True)
|
||||
pr = d.getVar('PR', True)
|
||||
pr_prefix = re.search("\D+",pr)
|
||||
prval = re.search("\d+",pr)
|
||||
if pr_prefix is None or prval is None:
|
||||
bb.error("Unable to analyse format of PR variable: %s" % pr)
|
||||
nval = int(prval.group(0)) + int(princ)
|
||||
pr = pr_prefix.group(0) + str(nval) + pr[prval.end():]
|
||||
bb.data.setVar('PR', pr, d)
|
||||
d.setVar('PR', pr)
|
||||
|
||||
pn = bb.data.getVar('PN', d, 1)
|
||||
license = bb.data.getVar('LICENSE', d, True)
|
||||
pn = d.getVar('PN', 1)
|
||||
license = d.getVar('LICENSE', True)
|
||||
if license == "INVALID":
|
||||
bb.fatal('This recipe does not have the LICENSE field set (%s)' % pn)
|
||||
|
||||
commercial_license = " %s " % bb.data.getVar('COMMERCIAL_LICENSE', d, 1)
|
||||
commercial_license = " %s " % d.getVar('COMMERCIAL_LICENSE', 1)
|
||||
import re
|
||||
pnr = "[ \t]%s[ \t]" % pn.replace('+', "\+")
|
||||
if commercial_license and re.search(pnr, commercial_license):
|
||||
@@ -356,86 +356,86 @@ python () {
|
||||
# If we're building a target package we need to use fakeroot (pseudo)
|
||||
# in order to capture permissions, owners, groups and special files
|
||||
if not bb.data.inherits_class('native', d) and not bb.data.inherits_class('cross', d):
|
||||
bb.data.setVarFlag('do_configure', 'umask', 022, d)
|
||||
bb.data.setVarFlag('do_compile', 'umask', 022, d)
|
||||
deps = (bb.data.getVarFlag('do_install', 'depends', d) or "").split()
|
||||
d.setVarFlag('do_configure', 'umask', 022)
|
||||
d.setVarFlag('do_compile', 'umask', 022)
|
||||
deps = (d.getVarFlag('do_install', 'depends') or "").split()
|
||||
deps.append('virtual/fakeroot-native:do_populate_sysroot')
|
||||
bb.data.setVarFlag('do_install', 'depends', " ".join(deps),d)
|
||||
bb.data.setVarFlag('do_install', 'fakeroot', 1, d)
|
||||
bb.data.setVarFlag('do_install', 'umask', 022, d)
|
||||
deps = (bb.data.getVarFlag('do_package', 'depends', d) or "").split()
|
||||
d.setVarFlag('do_install', 'fakeroot', 1)
|
||||
d.setVarFlag('do_install', 'umask', 022)
|
||||
deps = (d.getVarFlag('do_package', 'depends') or "").split()
|
||||
deps.append('virtual/fakeroot-native:do_populate_sysroot')
|
||||
bb.data.setVarFlag('do_package', 'depends', " ".join(deps),d)
|
||||
bb.data.setVarFlag('do_package', 'fakeroot', 1, d)
|
||||
bb.data.setVarFlag('do_package', 'umask', 022, d)
|
||||
bb.data.setVarFlag('do_package_setscene', 'fakeroot', 1, d)
|
||||
source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0)
|
||||
d.setVarFlag('do_package', 'fakeroot', 1)
|
||||
d.setVarFlag('do_package', 'umask', 022)
|
||||
d.setVarFlag('do_package_setscene', 'fakeroot', 1)
|
||||
source_mirror_fetch = d.getVar('SOURCE_MIRROR_FETCH', 0)
|
||||
if not source_mirror_fetch:
|
||||
need_host = bb.data.getVar('COMPATIBLE_HOST', d, 1)
|
||||
need_host = d.getVar('COMPATIBLE_HOST', 1)
|
||||
if need_host:
|
||||
import re
|
||||
this_host = bb.data.getVar('HOST_SYS', d, 1)
|
||||
this_host = d.getVar('HOST_SYS', 1)
|
||||
if not re.match(need_host, this_host):
|
||||
raise bb.parse.SkipPackage("incompatible with host %s" % this_host)
|
||||
|
||||
need_machine = bb.data.getVar('COMPATIBLE_MACHINE', d, 1)
|
||||
need_machine = d.getVar('COMPATIBLE_MACHINE', 1)
|
||||
if need_machine:
|
||||
import re
|
||||
this_machine = bb.data.getVar('MACHINE', d, 1)
|
||||
this_machine = d.getVar('MACHINE', 1)
|
||||
if this_machine and not re.match(need_machine, this_machine):
|
||||
this_soc_family = bb.data.getVar('SOC_FAMILY', d, 1)
|
||||
this_soc_family = d.getVar('SOC_FAMILY', 1)
|
||||
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" % this_machine)
|
||||
|
||||
|
||||
dont_want_license = bb.data.getVar('INCOMPATIBLE_LICENSE', d, 1)
|
||||
dont_want_license = d.getVar('INCOMPATIBLE_LICENSE', 1)
|
||||
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 = (bb.data.getVar('HOSTTOOLS_WHITELIST_%s' % dont_want_license, d, 1) or "").split()
|
||||
lgplv2_whitelist = (bb.data.getVar('LGPLv2_WHITELIST_%s' % dont_want_license, d, 1) or "").split()
|
||||
dont_want_whitelist = (bb.data.getVar('WHITELIST_%s' % dont_want_license, d, 1) or "").split()
|
||||
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()
|
||||
if pn not in hosttools_whitelist and pn not in lgplv2_whitelist and pn not in dont_want_whitelist:
|
||||
|
||||
import re
|
||||
this_license = bb.data.getVar('LICENSE', d, 1)
|
||||
this_license = d.getVar('LICENSE', 1)
|
||||
if this_license and re.search(dont_want_license, this_license):
|
||||
bb.note("SKIPPING %s because it's %s" % (pn, this_license))
|
||||
raise bb.parse.SkipPackage("incompatible with license %s" % this_license)
|
||||
|
||||
# Git packages should DEPEND on git-native
|
||||
srcuri = bb.data.getVar('SRC_URI', d, 1)
|
||||
srcuri = d.getVar('SRC_URI', 1)
|
||||
if "git://" in srcuri:
|
||||
depends = bb.data.getVarFlag('do_fetch', 'depends', d) or ""
|
||||
depends = d.getVarFlag('do_fetch', 'depends') or ""
|
||||
depends = depends + " git-native:do_populate_sysroot"
|
||||
bb.data.setVarFlag('do_fetch', 'depends', depends, d)
|
||||
d.setVarFlag('do_fetch', 'depends', depends)
|
||||
|
||||
# Mercurial packages should DEPEND on mercurial-native
|
||||
elif "hg://" in srcuri:
|
||||
depends = bb.data.getVarFlag('do_fetch', 'depends', d) or ""
|
||||
depends = d.getVarFlag('do_fetch', 'depends') or ""
|
||||
depends = depends + " mercurial-native:do_populate_sysroot"
|
||||
bb.data.setVarFlag('do_fetch', 'depends', depends, d)
|
||||
d.setVarFlag('do_fetch', 'depends', depends)
|
||||
|
||||
# OSC packages should DEPEND on osc-native
|
||||
elif "osc://" in srcuri:
|
||||
depends = bb.data.getVarFlag('do_fetch', 'depends', d) or ""
|
||||
depends = d.getVarFlag('do_fetch', 'depends') or ""
|
||||
depends = depends + " osc-native:do_populate_sysroot"
|
||||
bb.data.setVarFlag('do_fetch', 'depends', depends, d)
|
||||
d.setVarFlag('do_fetch', 'depends', depends)
|
||||
|
||||
# *.xz should depends on xz-native for unpacking
|
||||
# Not endswith because of "*.patch.xz;patch=1". Need bb.decodeurl in future
|
||||
if '.xz' in srcuri:
|
||||
depends = bb.data.getVarFlag('do_unpack', 'depends', d) or ""
|
||||
depends = d.getVarFlag('do_unpack', 'depends') or ""
|
||||
depends = depends + " xz-native:do_populate_sysroot"
|
||||
bb.data.setVarFlag('do_unpack', 'depends', depends, d)
|
||||
d.setVarFlag('do_unpack', 'depends', depends)
|
||||
|
||||
# unzip-native should already be staged before unpacking ZIP recipes
|
||||
if ".zip" in srcuri:
|
||||
depends = bb.data.getVarFlag('do_unpack', 'depends', d) or ""
|
||||
depends = d.getVarFlag('do_unpack', 'depends') or ""
|
||||
depends = depends + " unzip-native:do_populate_sysroot"
|
||||
bb.data.setVarFlag('do_unpack', 'depends', depends, d)
|
||||
d.setVarFlag('do_unpack', 'depends', depends)
|
||||
|
||||
# 'multimachine' handling
|
||||
mach_arch = bb.data.getVar('MACHINE_ARCH', d, 1)
|
||||
pkg_arch = bb.data.getVar('PACKAGE_ARCH', d, 1)
|
||||
mach_arch = d.getVar('MACHINE_ARCH', 1)
|
||||
pkg_arch = d.getVar('PACKAGE_ARCH', 1)
|
||||
|
||||
if (pkg_arch == mach_arch):
|
||||
# Already machine specific - nothing further to do
|
||||
@@ -445,7 +445,7 @@ python () {
|
||||
# We always try to scan SRC_URI for urls with machine overrides
|
||||
# unless the package sets SRC_URI_OVERRIDES_PACKAGE_ARCH=0
|
||||
#
|
||||
override = bb.data.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', d, 1)
|
||||
override = d.getVar('SRC_URI_OVERRIDES_PACKAGE_ARCH', 1)
|
||||
if override != '0':
|
||||
paths = []
|
||||
for p in [ "${PF}", "${P}", "${PN}", "files", "" ]:
|
||||
@@ -461,18 +461,18 @@ python () {
|
||||
for mp in paths:
|
||||
if local.startswith(mp):
|
||||
#bb.note("overriding PACKAGE_ARCH from %s to %s" % (pkg_arch, mach_arch))
|
||||
bb.data.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}", d)
|
||||
d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
|
||||
return
|
||||
|
||||
packages = bb.data.getVar('PACKAGES', d, 1).split()
|
||||
packages = d.getVar('PACKAGES', 1).split()
|
||||
for pkg in packages:
|
||||
pkgarch = bb.data.getVar("PACKAGE_ARCH_%s" % pkg, d, 1)
|
||||
pkgarch = d.getVar("PACKAGE_ARCH_%s" % pkg, 1)
|
||||
|
||||
# We could look for != PACKAGE_ARCH here but how to choose
|
||||
# if multiple differences are present?
|
||||
# Look through PACKAGE_ARCHS for the priority order?
|
||||
if pkgarch and pkgarch == mach_arch:
|
||||
bb.data.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}", d)
|
||||
d.setVar('PACKAGE_ARCH', "${MACHINE_ARCH}")
|
||||
bb.warn("Recipe %s is marked as only being architecture specific but seems to have machine specific packages?! The recipe may as well mark itself as machine specific directly." % d.getVar("PN", True))
|
||||
}
|
||||
|
||||
@@ -483,7 +483,7 @@ python do_cleansstate() {
|
||||
|
||||
addtask cleanall after do_cleansstate
|
||||
python do_cleanall() {
|
||||
src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split()
|
||||
src_uri = (d.getVar('SRC_URI', True) or "").split()
|
||||
if len(src_uri) == 0:
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user