summaryrefslogtreecommitdiffstats
path: root/meta/classes/populate_sdk_ext.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'meta/classes/populate_sdk_ext.bbclass')
-rw-r--r--meta/classes/populate_sdk_ext.bbclass148
1 files changed, 89 insertions, 59 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 6079166980..6afc53d284 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -89,7 +89,14 @@ python copy_buildsystem () {
89 # Copy in all metadata layers + bitbake (as repositories) 89 # Copy in all metadata layers + bitbake (as repositories)
90 buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d) 90 buildsystem = oe.copy_buildsystem.BuildSystem('extensible SDK', d)
91 baseoutpath = d.getVar('SDK_OUTPUT', True) + '/' + d.getVar('SDKPATH', True) 91 baseoutpath = d.getVar('SDK_OUTPUT', True) + '/' + d.getVar('SDKPATH', True)
92 layers_copied = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers') 92
93 # Determine if we're building a derivative extensible SDK (from devtool build-sdk)
94 derivative = (d.getVar('SDK_DERIVATIVE', True) or '') == '1'
95 if derivative:
96 workspace_name = 'orig-workspace'
97 else:
98 workspace_name = None
99 layers_copied = buildsystem.copy_bitbake_and_layers(baseoutpath + '/layers', workspace_name)
93 100
94 sdkbblayers = [] 101 sdkbblayers = []
95 corebase = os.path.basename(d.getVar('COREBASE', True)) 102 corebase = os.path.basename(d.getVar('COREBASE', True))
@@ -158,75 +165,81 @@ python copy_buildsystem () {
158 f.write(' "\n') 165 f.write(' "\n')
159 166
160 # Create local.conf 167 # Create local.conf
161 local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST', True) or '').split()
162 local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST', True) or '').split()
163 def handle_var(varname, origvalue, op, newlines):
164 if varname in local_conf_blacklist or (origvalue.strip().startswith('/') and not varname in local_conf_whitelist):
165 newlines.append('# Removed original setting of %s\n' % varname)
166 return None, op, 0, True
167 else:
168 return origvalue, op, 0, True
169 varlist = ['[^#=+ ]*']
170 builddir = d.getVar('TOPDIR', True) 168 builddir = d.getVar('TOPDIR', True)
171 with open(builddir + '/conf/local.conf', 'r') as f: 169 if derivative:
172 oldlines = f.readlines() 170 shutil.copyfile(builddir + '/conf/local.conf', baseoutpath + '/conf/local.conf')
173 (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) 171 else:
172 local_conf_whitelist = (d.getVar('SDK_LOCAL_CONF_WHITELIST', True) or '').split()
173 local_conf_blacklist = (d.getVar('SDK_LOCAL_CONF_BLACKLIST', True) or '').split()
174 def handle_var(varname, origvalue, op, newlines):
175 if varname in local_conf_blacklist or (origvalue.strip().startswith('/') and not varname in local_conf_whitelist):
176 newlines.append('# Removed original setting of %s\n' % varname)
177 return None, op, 0, True
178 else:
179 return origvalue, op, 0, True
180 varlist = ['[^#=+ ]*']
181 with open(builddir + '/conf/local.conf', 'r') as f:
182 oldlines = f.readlines()
183 (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var)
174 184
175 with open(baseoutpath + '/conf/local.conf', 'w') as f: 185 with open(baseoutpath + '/conf/local.conf', 'w') as f:
176 f.write('# WARNING: this configuration has been automatically generated and in\n') 186 f.write('# WARNING: this configuration has been automatically generated and in\n')
177 f.write('# most cases should not be edited. If you need more flexibility than\n') 187 f.write('# most cases should not be edited. If you need more flexibility than\n')
178 f.write('# this configuration provides, it is strongly suggested that you set\n') 188 f.write('# this configuration provides, it is strongly suggested that you set\n')
179 f.write('# up a proper instance of the full build system and use that instead.\n\n') 189 f.write('# up a proper instance of the full build system and use that instead.\n\n')
180 for line in newlines: 190 for line in newlines:
181 if line.strip() and not line.startswith('#'): 191 if line.strip() and not line.startswith('#'):
182 f.write(line) 192 f.write(line)
183 # Write a newline just in case there's none at the end of the original 193 # Write a newline just in case there's none at the end of the original
184 f.write('\n') 194 f.write('\n')
185 195
186 f.write('INHERIT += "%s"\n\n' % 'uninative') 196 f.write('INHERIT += "%s"\n\n' % 'uninative')
187 f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False)) 197 f.write('CONF_VERSION = "%s"\n\n' % d.getVar('CONF_VERSION', False))
188 198
189 # Some classes are not suitable for SDK, remove them from INHERIT 199 # Some classes are not suitable for SDK, remove them from INHERIT
190 f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST', False)) 200 f.write('INHERIT_remove = "%s"\n' % d.getVar('SDK_INHERIT_BLACKLIST', False))
191 201
192 # Bypass the default connectivity check if any 202 # Bypass the default connectivity check if any
193 f.write('CONNECTIVITY_CHECK_URIS = ""\n\n') 203 f.write('CONNECTIVITY_CHECK_URIS = ""\n\n')
194 204
195 # Ensure locked sstate cache objects are re-used without error 205 # Ensure locked sstate cache objects are re-used without error
196 f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "none"\n\n') 206 f.write('SIGGEN_LOCKEDSIGS_CHECK_LEVEL = "none"\n\n')
197 207
198 # Hide the config information from bitbake output (since it's fixed within the SDK) 208 # Hide the config information from bitbake output (since it's fixed within the SDK)
199 f.write('BUILDCFG_HEADER = ""\n') 209 f.write('BUILDCFG_HEADER = ""\n')
200 210
201 # Allow additional config through sdk-extra.conf 211 # Allow additional config through sdk-extra.conf
202 fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d) 212 fn = bb.cookerdata.findConfigFile('sdk-extra.conf', d)
203 if fn: 213 if fn:
204 with open(fn, 'r') as xf: 214 with open(fn, 'r') as xf:
205 for line in xf: 215 for line in xf:
206 f.write(line) 216 f.write(line)
207 217
208 # If you define a sdk_extraconf() function then it can contain additional config 218 # If you define a sdk_extraconf() function then it can contain additional config
209 # (Though this is awkward; sdk-extra.conf should probably be used instead) 219 # (Though this is awkward; sdk-extra.conf should probably be used instead)
210 extraconf = (d.getVar('sdk_extraconf', True) or '').strip() 220 extraconf = (d.getVar('sdk_extraconf', True) or '').strip()
211 if extraconf: 221 if extraconf:
212 # Strip off any leading / trailing spaces 222 # Strip off any leading / trailing spaces
213 for line in extraconf.splitlines(): 223 for line in extraconf.splitlines():
214 f.write(line.strip() + '\n') 224 f.write(line.strip() + '\n')
215 225
216 f.write('require conf/locked-sigs.inc\n') 226 f.write('require conf/locked-sigs.inc\n')
217 227
218 if os.path.exists(builddir + '/conf/auto.conf'): 228 if os.path.exists(builddir + '/conf/auto.conf'):
219 with open(builddir + '/conf/auto.conf', 'r') as f: 229 if derivative:
220 oldlines = f.readlines() 230 shutil.copyfile(builddir + '/conf/auto.conf', baseoutpath + '/conf/auto.conf')
221 (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var) 231 else:
222 with open(baseoutpath + '/conf/auto.conf', 'w') as f: 232 with open(builddir + '/conf/auto.conf', 'r') as f:
223 f.write('# WARNING: this configuration has been automatically generated and in\n') 233 oldlines = f.readlines()
224 f.write('# most cases should not be edited. If you need more flexibility than\n') 234 (updated, newlines) = bb.utils.edit_metadata(oldlines, varlist, handle_var)
225 f.write('# this configuration provides, it is strongly suggested that you set\n') 235 with open(baseoutpath + '/conf/auto.conf', 'w') as f:
226 f.write('# up a proper instance of the full build system and use that instead.\n\n') 236 f.write('# WARNING: this configuration has been automatically generated and in\n')
227 for line in newlines: 237 f.write('# most cases should not be edited. If you need more flexibility than\n')
228 if line.strip() and not line.startswith('#'): 238 f.write('# this configuration provides, it is strongly suggested that you set\n')
229 f.write(line) 239 f.write('# up a proper instance of the full build system and use that instead.\n\n')
240 for line in newlines:
241 if line.strip() and not line.startswith('#'):
242 f.write(line)
230 243
231 # Filter the locked signatures file to just the sstate tasks we are interested in 244 # Filter the locked signatures file to just the sstate tasks we are interested in
232 excluded_targets = d.getVar('SDK_TARGETS', True) 245 excluded_targets = d.getVar('SDK_TARGETS', True)
@@ -253,7 +266,24 @@ python copy_buildsystem () {
253 lockedsigs_pruned, 266 lockedsigs_pruned,
254 lockedsigs_copy) 267 lockedsigs_copy)
255 268
256 if d.getVar('SDK_EXT_TYPE', True) != 'minimal': 269 if d.getVar('SDK_EXT_TYPE', True) == 'minimal':
270 if derivative:
271 # Assume the user is not going to set up an additional sstate
272 # mirror, thus we need to copy the additional artifacts (from
273 # workspace recipes) into the derivative SDK
274 lockedsigs_orig = d.getVar('TOPDIR', True) + '/conf/locked-sigs.inc'
275 if os.path.exists(lockedsigs_orig):
276 lockedsigs_extra = d.getVar('WORKDIR', True) + '/locked-sigs-extra.inc'
277 oe.copy_buildsystem.merge_lockedsigs(None,
278 lockedsigs_orig,
279 lockedsigs_pruned,
280 None,
281 lockedsigs_extra)
282 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra,
283 d.getVar('SSTATE_DIR', True),
284 sstate_out, d,
285 fixedlsbstring)
286 else:
257 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned, 287 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
258 d.getVar('SSTATE_DIR', True), 288 d.getVar('SSTATE_DIR', True),
259 sstate_out, d, 289 sstate_out, d,