scripts: remove True option to getVar calls

getVar() now defaults to expanding by default, thus remove the True
option from getVar() calls with a regex search and replace.

Search made with the following regex: getVar ?\(( ?[^,()]*), True\)

(From OE-Core rev: 0a36bd96e6b29fd99a296efc358ca3e9fb5af735)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Joshua Lock
2016-12-14 21:13:05 +00:00
committed by Richard Purdie
parent c4e2c59088
commit c0f2890c01
22 changed files with 106 additions and 106 deletions

View File

@@ -87,13 +87,13 @@ def exec_watch(cmd, **options):
def exec_fakeroot(d, cmd, **kwargs):
"""Run a command under fakeroot (pseudo, in fact) so that it picks up the appropriate file permissions"""
# Grab the command and check it actually exists
fakerootcmd = d.getVar('FAKEROOTCMD', True)
fakerootcmd = d.getVar('FAKEROOTCMD')
if not os.path.exists(fakerootcmd):
logger.error('pseudo executable %s could not be found - have you run a build yet? pseudo-native should install this and if you have run any build then that should have been built')
return 2
# Set up the appropriate environment
newenv = dict(os.environ)
fakerootenv = d.getVar('FAKEROOTENV', True)
fakerootenv = d.getVar('FAKEROOTENV')
for varvalue in fakerootenv.split():
if '=' in varvalue:
splitval = varvalue.split('=', 1)
@@ -179,7 +179,7 @@ def use_external_build(same_dir, no_same_dir, d):
logger.info('Using source tree as build directory since --same-dir specified')
elif bb.data.inherits_class('autotools-brokensep', d):
logger.info('Using source tree as build directory since recipe inherits autotools-brokensep')
elif d.getVar('B', True) == os.path.abspath(d.getVar('S', True)):
elif d.getVar('B') == os.path.abspath(d.getVar('S')):
logger.info('Using source tree as build directory since that would be the default for this recipe')
else:
b_is_s = False
@@ -256,7 +256,7 @@ def ensure_npm(config, basepath, fixed_setup=False):
"""
tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
try:
nativepath = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE', True)
nativepath = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE')
finally:
tinfoil.shutdown()

View File

@@ -34,8 +34,8 @@ def _get_packages(tinfoil, workspace, config):
result = []
for recipe in workspace:
data = parse_recipe(config, tinfoil, recipe, True)
if 'class-target' in data.getVar('OVERRIDES', True).split(':'):
if recipe in data.getVar('PACKAGES', True).split():
if 'class-target' in data.getVar('OVERRIDES').split(':'):
if recipe in data.getVar('PACKAGES').split():
result.append(recipe)
else:
logger.warning("Skipping recipe %s as it doesn't produce a "
@@ -95,7 +95,7 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
raise TargetNotImageError()
# Get the actual filename used and strip the .bb and full path
target_basename = rd.getVar('FILE', True)
target_basename = rd.getVar('FILE')
target_basename = os.path.splitext(os.path.basename(target_basename))[0]
config.set('SDK', 'target_basename', target_basename)
config.write()
@@ -132,9 +132,9 @@ def build_image_task(config, basepath, workspace, image, add_packages=None, task
afile.write('%s\n' % line)
if task in ['populate_sdk', 'populate_sdk_ext']:
outputdir = rd.getVar('SDK_DEPLOY', True)
outputdir = rd.getVar('SDK_DEPLOY')
else:
outputdir = rd.getVar('DEPLOY_DIR_IMAGE', True)
outputdir = rd.getVar('DEPLOY_DIR_IMAGE')
tmp_tinfoil = tinfoil
tinfoil = None

View File

@@ -160,7 +160,7 @@ def deploy(args, config, basepath, workspace):
except Exception as e:
raise DevtoolError('Exception parsing recipe %s: %s' %
(args.recipename, e))
recipe_outdir = rd.getVar('D', True)
recipe_outdir = rd.getVar('D')
if not os.path.exists(recipe_outdir) or not os.listdir(recipe_outdir):
raise DevtoolError('No files to deploy - have you built the %s '
'recipe? If so, the install step has not installed '

View File

@@ -32,7 +32,7 @@ def package(args, config, basepath, workspace):
try:
image_pkgtype = config.get('Package', 'image_pkgtype', '')
if not image_pkgtype:
image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE', True)
image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE')
deploy_dir_pkg = tinfoil.config_data.getVar('DEPLOY_DIR_%s' % image_pkgtype.upper(), True)
finally:

View File

@@ -31,8 +31,8 @@ def runqemu(args, config, basepath, workspace):
tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
try:
machine = tinfoil.config_data.getVar('MACHINE', True)
bindir_native = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE', True)
machine = tinfoil.config_data.getVar('MACHINE')
bindir_native = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE')
finally:
tinfoil.shutdown()

View File

@@ -132,9 +132,9 @@ def sdk_update(args, config, basepath, workspace):
# Grab variable values
tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
try:
stamps_dir = tinfoil.config_data.getVar('STAMPS_DIR', True)
sstate_mirrors = tinfoil.config_data.getVar('SSTATE_MIRRORS', True)
site_conf_version = tinfoil.config_data.getVar('SITE_CONF_VERSION', True)
stamps_dir = tinfoil.config_data.getVar('STAMPS_DIR')
sstate_mirrors = tinfoil.config_data.getVar('SSTATE_MIRRORS')
site_conf_version = tinfoil.config_data.getVar('SITE_CONF_VERSION')
finally:
tinfoil.shutdown()
@@ -273,7 +273,7 @@ def sdk_install(args, config, basepath, workspace):
rd = parse_recipe(config, tinfoil, recipe, True)
if not rd:
return 1
stampprefixes[recipe] = '%s.%s' % (rd.getVar('STAMP', True), tasks[0])
stampprefixes[recipe] = '%s.%s' % (rd.getVar('STAMP'), tasks[0])
if checkstamp(recipe):
logger.info('%s is already installed' % recipe)
else:

View File

@@ -31,7 +31,7 @@ def search(args, config, basepath, workspace):
tinfoil = setup_tinfoil(config_only=False, basepath=basepath)
try:
pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True)
pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR')
defsummary = tinfoil.config_data.getVar('SUMMARY', False) or ''
keyword_rc = re.compile(args.keyword)
@@ -70,7 +70,7 @@ def search(args, config, basepath, workspace):
if match:
rd = parse_recipe(config, tinfoil, fn, True)
summary = rd.getVar('SUMMARY', True)
summary = rd.getVar('SUMMARY')
if summary == rd.expand(defsummary):
summary = ''
print("%s %s" % (fn.ljust(20), summary))

View File

@@ -303,7 +303,7 @@ def _check_compatible_recipe(pn, d):
raise DevtoolError("The %s recipe is a meta-recipe, and therefore is "
"not supported by this tool" % pn, 4)
if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC', True):
if bb.data.inherits_class('externalsrc', d) and d.getVar('EXTERNALSRC'):
# Not an incompatibility error per se, so we don't pass the error code
raise DevtoolError("externalsrc is currently enabled for the %s "
"recipe. This prevents the normal do_patch task "
@@ -439,7 +439,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
"""Extract sources of a recipe"""
import oe.recipeutils
pn = d.getVar('PN', True)
pn = d.getVar('PN')
_check_compatible_recipe(pn, d)
@@ -473,13 +473,13 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
# Make a subdir so we guard against WORKDIR==S
workdir = os.path.join(tempdir, 'workdir')
crd.setVar('WORKDIR', workdir)
if not crd.getVar('S', True).startswith(workdir):
if not crd.getVar('S').startswith(workdir):
# Usually a shared workdir recipe (kernel, gcc)
# Try to set a reasonable default
if bb.data.inherits_class('kernel', d):
crd.setVar('S', '${WORKDIR}/source')
else:
crd.setVar('S', '${WORKDIR}/%s' % os.path.basename(d.getVar('S', True)))
crd.setVar('S', '${WORKDIR}/%s' % os.path.basename(d.getVar('S')))
if bb.data.inherits_class('kernel', d):
# We don't want to move the source to STAGING_KERNEL_DIR here
crd.setVar('STAGING_KERNEL_DIR', '${S}')
@@ -533,7 +533,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
# Extra step for kernel to populate the source directory
runtask(fn, 'kernel_checkout')
srcsubdir = crd.getVar('S', True)
srcsubdir = crd.getVar('S')
# Move local source files into separate subdir
recipe_patches = [os.path.basename(patch) for patch in
@@ -581,7 +581,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
"doesn't use any source or the correct source "
"directory could not be determined" % pn)
setup_git_repo(srcsubdir, crd.getVar('PV', True), devbranch, d=d)
setup_git_repo(srcsubdir, crd.getVar('PV'), devbranch, d=d)
(stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srcsubdir)
initial_rev = stdout.rstrip()
@@ -596,7 +596,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
# Store generate and store kernel config
logger.info('Generating kernel config')
runtask(fn, 'configure')
kconfig = os.path.join(crd.getVar('B', True), '.config')
kconfig = os.path.join(crd.getVar('B'), '.config')
tempdir_localdir = os.path.join(tempdir, 'oe-local-files')
@@ -628,7 +628,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
shutil.move(srcsubdir, srctree)
if os.path.abspath(d.getVar('S', True)) == os.path.abspath(d.getVar('WORKDIR', True)):
if os.path.abspath(d.getVar('S')) == os.path.abspath(d.getVar('WORKDIR')):
# If recipe extracts to ${WORKDIR}, symlink the files into the srctree
# (otherwise the recipe won't build as expected)
local_files_dir = os.path.join(srctree, 'oe-local-files')
@@ -725,7 +725,7 @@ def modify(args, config, basepath, workspace):
if not rd:
return 1
pn = rd.getVar('PN', True)
pn = rd.getVar('PN')
if pn != args.recipename:
logger.info('Mapping %s to %s' % (args.recipename, pn))
if pn in workspace:
@@ -747,7 +747,7 @@ def modify(args, config, basepath, workspace):
# Error already shown
return 1
recipefile = rd.getVar('FILE', True)
recipefile = rd.getVar('FILE')
appendfile = recipe_to_append(recipefile, config, args.wildcard)
if os.path.exists(appendfile):
raise DevtoolError("Another variant of recipe %s is already in your "
@@ -784,8 +784,8 @@ def modify(args, config, basepath, workspace):
initial_rev = stdout.rstrip()
# Check that recipe isn't using a shared workdir
s = os.path.abspath(rd.getVar('S', True))
workdir = os.path.abspath(rd.getVar('WORKDIR', True))
s = os.path.abspath(rd.getVar('S'))
workdir = os.path.abspath(rd.getVar('WORKDIR'))
if s.startswith(workdir) and s != workdir and os.path.dirname(s) != workdir:
# Handle if S is set to a subdirectory of the source
srcsubdir = os.path.relpath(s, workdir).split(os.sep, 1)[1]
@@ -866,17 +866,17 @@ def rename(args, config, basepath, workspace):
if not rd:
return 1
bp = rd.getVar('BP', True)
bpn = rd.getVar('BPN', True)
bp = rd.getVar('BP')
bpn = rd.getVar('BPN')
if newname != args.recipename:
localdata = rd.createCopy()
localdata.setVar('PN', newname)
newbpn = localdata.getVar('BPN', True)
newbpn = localdata.getVar('BPN')
else:
newbpn = bpn
s = rd.getVar('S', False)
src_uri = rd.getVar('SRC_URI', False)
pv = rd.getVar('PV', True)
pv = rd.getVar('PV')
# Correct variable values that refer to the upstream source - these
# values must stay the same, so if the name/version are changing then
@@ -1277,8 +1277,8 @@ def _export_local_files(srctree, rd, destdir):
elif fname != '.gitignore':
added[fname] = None
workdir = rd.getVar('WORKDIR', True)
s = rd.getVar('S', True)
workdir = rd.getVar('WORKDIR')
s = rd.getVar('S')
if not s.endswith(os.sep):
s += os.sep
@@ -1300,14 +1300,14 @@ def _export_local_files(srctree, rd, destdir):
def _determine_files_dir(rd):
"""Determine the appropriate files directory for a recipe"""
recipedir = rd.getVar('FILE_DIRNAME', True)
for entry in rd.getVar('FILESPATH', True).split(':'):
recipedir = rd.getVar('FILE_DIRNAME')
for entry in rd.getVar('FILESPATH').split(':'):
relpth = os.path.relpath(entry, recipedir)
if not os.sep in relpth:
# One (or zero) levels below only, so we don't put anything in machine-specific directories
if os.path.isdir(entry):
return entry
return os.path.join(recipedir, rd.getVar('BPN', True))
return os.path.join(recipedir, rd.getVar('BPN'))
def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remove):
@@ -1315,7 +1315,7 @@ def _update_recipe_srcrev(srctree, rd, appendlayerdir, wildcard_version, no_remo
import bb
import oe.recipeutils
recipefile = rd.getVar('FILE', True)
recipefile = rd.getVar('FILE')
logger.info('Updating SRCREV in recipe %s' % os.path.basename(recipefile))
# Get HEAD revision
@@ -1397,7 +1397,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
import bb
import oe.recipeutils
recipefile = rd.getVar('FILE', True)
recipefile = rd.getVar('FILE')
append = workspace[recipename]['bbappend']
if not os.path.exists(append):
raise DevtoolError('unable to find workspace bbappend for recipe %s' %
@@ -1408,7 +1408,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil
raise DevtoolError('Unable to find initial revision - please specify '
'it with --initial-rev')
dl_dir = rd.getVar('DL_DIR', True)
dl_dir = rd.getVar('DL_DIR')
if not dl_dir.endswith('/'):
dl_dir += '/'
@@ -1567,7 +1567,7 @@ def update_recipe(args, config, basepath, workspace):
updated = _update_recipe(args.recipename, workspace, rd, args.mode, args.append, args.wildcard_version, args.no_remove, args.initial_rev)
if updated:
rf = rd.getVar('FILE', True)
rf = rd.getVar('FILE')
if rf.startswith(config.workspace_path):
logger.warn('Recipe file %s has been updated but is inside the workspace - you will need to move it (and any associated files next to it) out to the desired layer before using "devtool reset" in order to keep any changes' % rf)
finally:
@@ -1671,7 +1671,7 @@ def reset(args, config, basepath, workspace):
def _get_layer(layername, d):
"""Determine the base layer path for the specified layer name/path"""
layerdirs = d.getVar('BBLAYERS', True).split()
layerdirs = d.getVar('BBLAYERS').split()
layers = {os.path.basename(p): p for p in layerdirs}
# Provide some shortcuts
if layername.lower() in ['oe-core', 'openembedded-core']:
@@ -1697,7 +1697,7 @@ def finish(args, config, basepath, workspace):
return 1
destlayerdir = _get_layer(args.destination, tinfoil.config_data)
origlayerdir = oe.recipeutils.find_layerdir(rd.getVar('FILE', True))
origlayerdir = oe.recipeutils.find_layerdir(rd.getVar('FILE'))
if not os.path.isdir(destlayerdir):
raise DevtoolError('Unable to find layer or directory matching "%s"' % args.destination)
@@ -1728,7 +1728,7 @@ def finish(args, config, basepath, workspace):
if not destpath:
raise DevtoolError("Unable to determine destination layer path - check that %s specifies an actual layer and %s/conf/layer.conf specifies BBFILES. You may also need to specify a more complete path." % (args.destination, destlayerdir))
# Warn if the layer isn't in bblayers.conf (the code to create a bbappend will do this in other cases)
layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS', True).split()]
layerdirs = [os.path.abspath(layerdir) for layerdir in rd.getVar('BBLAYERS').split()]
if not os.path.abspath(destlayerdir) in layerdirs:
bb.warn('Specified destination layer is not currently enabled in bblayers.conf, so the %s recipe will now be unavailable in your current configuration until you add the layer there' % args.recipename)
@@ -1758,7 +1758,7 @@ def finish(args, config, basepath, workspace):
# associated files to the specified layer
no_clean = True
logger.info('Moving recipe file to %s' % destpath)
recipedir = os.path.dirname(rd.getVar('FILE', True))
recipedir = os.path.dirname(rd.getVar('FILE'))
for root, _, files in os.walk(recipedir):
for fn in files:
srcpath = os.path.join(root, fn)

View File

@@ -68,7 +68,7 @@ def _remove_patch_dirs(recipefolder):
shutil.rmtree(os.path.join(root,d))
def _recipe_contains(rd, var):
rf = rd.getVar('FILE', True)
rf = rd.getVar('FILE')
varfiles = oe.recipeutils.get_var_files(rf, [var], rd)
for var, fn in varfiles.items():
if fn and fn.startswith(os.path.dirname(rf) + os.sep):
@@ -132,7 +132,7 @@ def _write_append(rc, srctree, same_dir, no_same_dir, rev, copied, workspace, d)
if rev:
f.write('# initial_rev: %s\n' % rev)
if copied:
f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE', True)))
f.write('# original_path: %s\n' % os.path.dirname(d.getVar('FILE')))
f.write('# original_files: %s\n' % ' '.join(copied))
return af
@@ -154,7 +154,7 @@ def _upgrade_error(e, rf, srctree):
raise DevtoolError(e)
def _get_uri(rd):
srcuris = rd.getVar('SRC_URI', True).split()
srcuris = rd.getVar('SRC_URI').split()
if not len(srcuris):
raise DevtoolError('SRC_URI not found on recipe')
# Get first non-local entry in SRC_URI - usually by convention it's
@@ -185,7 +185,7 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin
crd = rd.createCopy()
pv = crd.getVar('PV', True)
pv = crd.getVar('PV')
crd.setVar('PV', newpv)
tmpsrctree = None
@@ -270,15 +270,15 @@ def _extract_new_source(newpv, srctree, no_patch, srcrev, branch, keep_temp, tin
def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil, rd):
"""Creates the new recipe under workspace"""
bpn = rd.getVar('BPN', True)
bpn = rd.getVar('BPN')
path = os.path.join(workspace, 'recipes', bpn)
bb.utils.mkdirhier(path)
copied, _ = oe.recipeutils.copy_recipe_files(rd, path)
oldpv = rd.getVar('PV', True)
oldpv = rd.getVar('PV')
if not newpv:
newpv = oldpv
origpath = rd.getVar('FILE', True)
origpath = rd.getVar('FILE')
fullpath = _rename_recipe_files(origpath, bpn, oldpv, newpv, path)
logger.debug('Upgraded %s => %s' % (origpath, fullpath))
@@ -341,7 +341,7 @@ def upgrade(args, config, basepath, workspace):
if not rd:
return 1
pn = rd.getVar('PN', True)
pn = rd.getVar('PN')
if pn != args.recipename:
logger.info('Mapping %s to %s' % (args.recipename, pn))
if pn in workspace:
@@ -353,12 +353,12 @@ def upgrade(args, config, basepath, workspace):
srctree = standard.get_default_srctree(config, pn)
standard._check_compatible_recipe(pn, rd)
old_srcrev = rd.getVar('SRCREV', True)
old_srcrev = rd.getVar('SRCREV')
if old_srcrev == 'INVALID':
old_srcrev = None
if old_srcrev and not args.srcrev:
raise DevtoolError("Recipe specifies a SRCREV value; you must specify a new one when upgrading")
if rd.getVar('PV', True) == args.version and old_srcrev == args.srcrev:
if rd.getVar('PV') == args.version and old_srcrev == args.srcrev:
raise DevtoolError("Current and upgrade versions are the same version")
rf = None

View File

@@ -39,7 +39,7 @@ def edit_recipe(args, config, basepath, workspace):
rd = parse_recipe(config, tinfoil, args.recipename, True)
if not rd:
return 1
recipefile = rd.getVar('FILE', True)
recipefile = rd.getVar('FILE')
finally:
tinfoil.shutdown()
else:
@@ -62,20 +62,20 @@ def configure_help(args, config, basepath, workspace):
rd = parse_recipe(config, tinfoil, args.recipename, appends=True, filter_workspace=False)
if not rd:
return 1
b = rd.getVar('B', True)
s = rd.getVar('S', True)
b = rd.getVar('B')
s = rd.getVar('S')
configurescript = os.path.join(s, 'configure')
confdisabled = 'noexec' in rd.getVarFlags('do_configure') or 'do_configure' not in (rd.getVar('__BBTASKS', False) or [])
configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS', True) or '')
extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF', True) or '')
extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE', True) or '')
do_configure = rd.getVar('do_configure', True) or ''
configureopts = oe.utils.squashspaces(rd.getVar('CONFIGUREOPTS') or '')
extra_oeconf = oe.utils.squashspaces(rd.getVar('EXTRA_OECONF') or '')
extra_oecmake = oe.utils.squashspaces(rd.getVar('EXTRA_OECMAKE') or '')
do_configure = rd.getVar('do_configure') or ''
do_configure_noexpand = rd.getVar('do_configure', False) or ''
packageconfig = rd.getVarFlags('PACKAGECONFIG') or []
autotools = bb.data.inherits_class('autotools', rd) and ('oe_runconf' in do_configure or 'autotools_do_configure' in do_configure)
cmake = bb.data.inherits_class('cmake', rd) and ('cmake_do_configure' in do_configure)
cmake_do_configure = rd.getVar('cmake_do_configure', True)
pn = rd.getVar('PN', True)
cmake_do_configure = rd.getVar('cmake_do_configure')
pn = rd.getVar('PN')
finally:
tinfoil.shutdown()