summaryrefslogtreecommitdiffstats
path: root/meta/classes/populate_sdk_ext.bbclass
diff options
context:
space:
mode:
authorQi.Chen@windriver.com <Qi.Chen@windriver.com>2015-09-07 13:42:23 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-09-09 14:27:42 +0100
commit164136d31064b28c71bcdc189279c92894a11146 (patch)
tree3e0173f7c5f9dda6ec5854d3fc9a9f9ef8b39e9e /meta/classes/populate_sdk_ext.bbclass
parentd7efdfeb5bf3c942feb152874d686560509ece5b (diff)
downloadpoky-164136d31064b28c71bcdc189279c92894a11146.tar.gz
populate_sdk_ext: consider custom configuration in local.conf
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. Comments and blank lines are filtered out. 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 bb.utils.edit_metadata. In addition, we check to avoid any setting that might lead to host paths bleeding into the 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. The SDK_META_CONF_WHITELIST is removed as it's of no use after this change. SDK_LOCAL_CONF_BLACKLIST can be used to prevent copying specific variable settings to the extensible SDK's local.conf; the default is to exclude PRSERV_HOST (since this is likely to be internal). Similarly, SDK_INHERIT_BLACKLIST to forbit local.conf in SDK to inherit certain classes such as 'buildhistory' or 'icecc' that would not normally make sense in an SDK environment. [YOCTO #7616] (From OE-Core rev: 0dda443bfa5c42f327d8d0ed7b23af11c156a60e) Signed-off-by: Chen Qi <Qi.Chen@windriver.com> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/populate_sdk_ext.bbclass')
-rw-r--r--meta/classes/populate_sdk_ext.bbclass26
1 files changed, 23 insertions, 3 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 5dd60515d5..fa36a9168e 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -15,7 +15,9 @@ SDK_RDEPENDS_append_task-populate-sdk-ext = " ${SDK_TARGETS}"
15 15
16SDK_RELOCATE_AFTER_INSTALL_task-populate-sdk-ext = "0" 16SDK_RELOCATE_AFTER_INSTALL_task-populate-sdk-ext = "0"
17 17
18SDK_META_CONF_WHITELIST ?= "MACHINE DISTRO PACKAGE_CLASSES" 18SDK_LOCAL_CONF_WHITELIST ?= ""
19SDK_LOCAL_CONF_BLACKLIST ?= "CONF_VERSION BB_NUMBER_THREADS PARALLEL_MAKE PRSERV_HOST"
20SDK_INHERIT_BLACKLIST ?= "buildhistory icecc"
19 21
20SDK_TARGETS ?= "${PN}" 22SDK_TARGETS ?= "${PN}"
21OE_INIT_ENV_SCRIPT ?= "oe-init-build-env" 23OE_INIT_ENV_SCRIPT ?= "oe-init-build-env"
@@ -109,15 +111,35 @@ python copy_buildsystem () {
109 f.write(' "\n') 111 f.write(' "\n')
110 112
111 # Create local.conf 113 # Create local.conf
114 local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST', True) or '').split()
115 local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST', True) or '').split()
116 def handle_var(varname, origvalue, op, newlines):
117 if varname in local_conf_blacklist or (origvalue.strip().startswith('/') and not varname in local_conf_whitelist):
118 newlines.append('# Removed original setting of %s\n' % varname)
119 return None, op, 0, True
120 else:
121 return origvalue, op, 0, True
122 varlist = ['[^#=+ ]*']
123 builddir = d.getVar('TOPDIR', True)
124 with open(builddir + '/conf/local.conf', 'r') as f:
125 oldlines = f.readlines()
126 (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var)
127
112 with open(baseoutpath + '/conf/local.conf', 'w') as f: 128 with open(baseoutpath + '/conf/local.conf', 'w') as f:
113 f.write('# WARNING: this configuration has been automatically generated and in\n') 129 f.write('# WARNING: this configuration has been automatically generated and in\n')
114 f.write('# most cases should not be edited. If you need more flexibility than\n') 130 f.write('# most cases should not be edited. If you need more flexibility than\n')
115 f.write('# this configuration provides, it is strongly suggested that you set\n') 131 f.write('# this configuration provides, it is strongly suggested that you set\n')
116 f.write('# up a proper instance of the full build system and use that instead.\n\n') 132 f.write('# up a proper instance of the full build system and use that instead.\n\n')
133 for line in newlines:
134 if line.strip() and not line.startswith('#'):
135 f.write(line)
117 136
118 f.write('INHERIT += "%s"\n\n' % 'uninative') 137 f.write('INHERIT += "%s"\n\n' % 'uninative')
119 f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False)) 138 f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False))
120 139
140 # Some classes are not suitable for SDK, remove them from INHERIT
141 f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST'))
142
121 # This is a bit of a hack, but we really don't want these dependencies 143 # This is a bit of a hack, but we really don't want these dependencies
122 # (we're including them in the SDK as nativesdk- versions instead) 144 # (we're including them in the SDK as nativesdk- versions instead)
123 f.write('POKYQEMUDEPS_forcevariable = ""\n\n') 145 f.write('POKYQEMUDEPS_forcevariable = ""\n\n')
@@ -134,8 +156,6 @@ python copy_buildsystem () {
134 # Ensure locked sstate cache objects are re-used without error 156 # Ensure locked sstate cache objects are re-used without error
135 f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "warn"\n\n') 157 f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "warn"\n\n')
136 158
137 for varname in d.getVar('SDK_META_CONF_WHITELIST', True).split():
138 f.write('%s = "%s"\n' % (varname, d.getVar(varname, True)))
139 f.write('require conf/locked-sigs.inc\n') 159 f.write('require conf/locked-sigs.inc\n')
140 f.write('require conf/work-config.inc\n') 160 f.write('require conf/work-config.inc\n')
141 161