[OE-core] [PATCH V2 3/3] populate_sdk_ext: consider custom configuration in local.conf
Paul Eggleton
paul.eggleton at linux.intel.com
Mon Jun 15 16:26:38 UTC 2015
On Wednesday 10 June 2015 15:25:24 Chen Qi wrote:
> Copy the contents of local.conf under TOPDIR into the final generated
> local.conf. In this way, custom settings are also made into the final
> local.conf like IMAGE_INSTALL, DISTRO_FEATURES, VIRTUAL-RUNTIME_xxx, etc.
>
> Before this change, installing extensible SDK would usually report failure
> when preparing the build system if the user has custom configuration for
> DISTRO_FEATURES in local.conf. Also, items in IMAGE_INSTALL_append in
> local.conf also don't get built correctly.
>
> This patch solves the above problem by making use of the
> bb.utils.edit_metadata.
>
> In addition, we check to avoid any setting that might lead to host path
> bleeding into SDK's configuration. Basically, variables with values starting
> with '/' are removed. A whitelist mechanism is introduced so that users
> could specify variables that should not be ignored. The name of the
> whitelist is SDK_LOCAL_CONF_WHITELIST.
>
> [YOCTO #7616]
>
> Signed-off-by: Chen Qi <Qi.Chen at windriver.com>
> ---
> meta/classes/populate_sdk_ext.bbclass | 17 +++++++++++++++++
> 1 file changed, 17 insertions(+)
>
> diff --git a/meta/classes/populate_sdk_ext.bbclass
> b/meta/classes/populate_sdk_ext.bbclass index 2fc4c11..08130d4 100644
> --- a/meta/classes/populate_sdk_ext.bbclass
> +++ b/meta/classes/populate_sdk_ext.bbclass
> @@ -16,6 +16,7 @@ SDK_RDEPENDS_append_task-populate-sdk-ext = "
> ${SDK_TARGETS}" SDK_RELOCATE_AFTER_INSTALL_task-populate-sdk-ext = "0"
>
> SDK_META_CONF_WHITELIST ?= "MACHINE DISTRO PACKAGE_CLASSES"
> +SDK_LOCAL_CONF_WHITELIST ?= ""
>
> SDK_TARGETS ?= "${PN}"
> OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
> @@ -108,12 +109,28 @@ python copy_buildsystem () {
> f.write(' "\n')
>
> # Create local.conf
> + local_conf_whitelist = d.getVar('SDK_LOCAL_CONF_WHITELIST',
> True).split() + def handle_var(varname, origvalue, op, newlines):
> + if origvalue.strip().startswith('/') and not varname in
> local_conf_whitelist: + newlines.append('# Removed original
> setting of %s\n' % varname) + return None, op, 0, True
> + else:
> + return origvalue, op, 0, True
> + varlist = ['[^#=+ ]*']
> + builddir = d.getVar('TOPDIR', True)
> + with open(builddir + '/conf/local.conf', 'r') as f:
> + oldlines = f.readlines()
> + (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist,
> handle_var) +
> with open(baseoutpath + '/conf/local.conf', 'w') as f:
> f.write('# WARNING: this configuration has been automatically
> generated and in\n') f.write('# most cases should not be edited. If you
> need more flexibility than\n') f.write('# this configuration provides, it
> is strongly suggested that you set\n') f.write('# up a proper instance of
> the full build system and use that instead.\n\n')
>
> + for line in newlines:
> + f.write(line)
> +
> f.write('INHERIT += "%s"\n\n' % 'uninative')
> f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION'))
OK, this looks good - but do we really need two whitelists now
(SDK_META_CONF_WHITELIST and SDK_LOCAL_CONF_WHITELIST)?
Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
More information about the Openembedded-core
mailing list