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.bbclass78
1 files changed, 72 insertions, 6 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 211a02286e..ce8c8ff3c4 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -85,6 +85,60 @@ SDK_EXT_HOST_MANIFEST = "${SDK_DEPLOY}/${TOOLCHAINEXT_OUTPUTNAME}.host.manifest"
85 85
86SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME', True) or d.getVar('DISTRO', True)} Extensible SDK" 86SDK_TITLE_task-populate-sdk-ext = "${@d.getVar('DISTRO_NAME', True) or d.getVar('DISTRO', True)} Extensible SDK"
87 87
88def clean_esdk_builddir(sdkbasepath):
89 """Clean up traces of the fake build for create_filtered_tasklist()"""
90 import shutil
91 cleanpaths = 'tmp cache conf/sanity_info conf/templateconf.cfg downloads'.split()
92 for pth in cleanpaths:
93 fullpth = os.path.join(sdkbasepath, pth)
94 if os.path.isdir(fullpth):
95 shutil.rmtree(fullpth)
96 elif os.path.isfile(fullpth):
97 os.remove(fullpth)
98
99def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
100 """
101 Create a filtered list of tasks. Also double-checks that the build system
102 within the SDK basically works and required sstate artifacts are available.
103 """
104 import tempfile
105 import shutil
106 import oe.copy_buildsystem
107
108 # Create a temporary build directory that we can pass to the env setup script
109 shutil.copyfile(sdkbasepath + '/conf/local.conf', sdkbasepath + '/conf/local.conf.bak')
110 try:
111 with open(sdkbasepath + '/conf/local.conf', 'a') as f:
112 f.write('\nSSTATE_DIR_forcevariable = "%s"\n' % d.getVar('SSTATE_DIR', True))
113 f.write('SSTATE_MIRRORS_forcevariable = ""\n')
114
115 # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
116 # will not allow in its COREBASE path, so we need to rename the directory temporarily
117 temp_sdkbasepath = d.getVar('SDK_OUTPUT', True) + '/tmp-renamed-sdk'
118 # Delete any existing temp dir
119 try:
120 shutil.rmtree(temp_sdkbasepath)
121 except FileNotFoundError:
122 pass
123 os.rename(sdkbasepath, temp_sdkbasepath)
124 try:
125 cmdprefix = '. %s .; ' % conf_initpath
126 logfile = d.getVar('WORKDIR', True) + '/tasklist_bb_log.txt'
127 try:
128 oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile)
129 except bb.process.ExecutionError as e:
130 msg = 'Failed to generate filtered task list for extensible SDK:\n%s' % e.stdout.rstrip()
131 if 'attempted to execute unexpectedly and should have been setscened' in e.stdout:
132 msg += '\n----------\n\nNOTE: "attempted to execute unexpectedly and should have been setscened" errors indicate this may be caused by missing sstate artifacts that were likely produced in earlier builds, but have been subsequently deleted for some reason.\n'
133 bb.fatal(msg)
134 finally:
135 os.rename(temp_sdkbasepath, sdkbasepath)
136 # Clean out residue of running bitbake, which check_sstate_task_list()
137 # will effectively do
138 clean_esdk_builddir(sdkbasepath)
139 finally:
140 os.replace(sdkbasepath + '/conf/local.conf.bak', sdkbasepath + '/conf/local.conf')
141
88python copy_buildsystem () { 142python copy_buildsystem () {
89 import re 143 import re
90 import shutil 144 import shutil
@@ -301,6 +355,15 @@ python copy_buildsystem () {
301 # uninative.bbclass sets NATIVELSBSTRING to 'universal' 355 # uninative.bbclass sets NATIVELSBSTRING to 'universal'
302 fixedlsbstring = 'universal' 356 fixedlsbstring = 'universal'
303 357
358 sdk_include_toolchain = (d.getVar('SDK_INCLUDE_TOOLCHAIN', True) == '1')
359 sdk_ext_type = d.getVar('SDK_EXT_TYPE', True)
360 if sdk_ext_type != 'minimal' or sdk_include_toolchain or derivative:
361 # Create the filtered task list used to generate the sstate cache shipped with the SDK
362 tasklistfn = d.getVar('WORKDIR', True) + '/tasklist.txt'
363 create_filtered_tasklist(d, baseoutpath, tasklistfn, conf_initpath)
364 else:
365 tasklistfn = None
366
304 # Add packagedata if enabled 367 # Add packagedata if enabled
305 if d.getVar('SDK_INCLUDE_PKGDATA', True) == '1': 368 if d.getVar('SDK_INCLUDE_PKGDATA', True) == '1':
306 lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base.inc' 369 lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base.inc'
@@ -312,20 +375,21 @@ python copy_buildsystem () {
312 lockedsigs_pruned, 375 lockedsigs_pruned,
313 lockedsigs_copy) 376 lockedsigs_copy)
314 377
315 if d.getVar('SDK_INCLUDE_TOOLCHAIN', True) == '1': 378 if sdk_include_toolchain:
316 lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base2.inc' 379 lockedsigs_base = d.getVar('WORKDIR', True) + '/locked-sigs-base2.inc'
317 lockedsigs_toolchain = d.getVar('STAGING_DIR_HOST', True) + '/locked-sigs/locked-sigs-extsdk-toolchain.inc' 380 lockedsigs_toolchain = d.getVar('STAGING_DIR_HOST', True) + '/locked-sigs/locked-sigs-extsdk-toolchain.inc'
318 shutil.move(lockedsigs_pruned, lockedsigs_base) 381 shutil.move(lockedsigs_pruned, lockedsigs_base)
319 oe.copy_buildsystem.merge_lockedsigs(['do_populate_sysroot'], 382 oe.copy_buildsystem.merge_lockedsigs([],
320 lockedsigs_base, 383 lockedsigs_base,
321 lockedsigs_toolchain, 384 lockedsigs_toolchain,
322 lockedsigs_pruned) 385 lockedsigs_pruned)
323 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain, 386 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_toolchain,
324 d.getVar('SSTATE_DIR', True), 387 d.getVar('SSTATE_DIR', True),
325 sstate_out, d, 388 sstate_out, d,
326 fixedlsbstring) 389 fixedlsbstring,
390 filterfile=tasklistfn)
327 391
328 if d.getVar('SDK_EXT_TYPE', True) == 'minimal': 392 if sdk_ext_type == 'minimal':
329 if derivative: 393 if derivative:
330 # Assume the user is not going to set up an additional sstate 394 # Assume the user is not going to set up an additional sstate
331 # mirror, thus we need to copy the additional artifacts (from 395 # mirror, thus we need to copy the additional artifacts (from
@@ -341,12 +405,14 @@ python copy_buildsystem () {
341 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra, 405 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_extra,
342 d.getVar('SSTATE_DIR', True), 406 d.getVar('SSTATE_DIR', True),
343 sstate_out, d, 407 sstate_out, d,
344 fixedlsbstring) 408 fixedlsbstring,
409 filterfile=tasklistfn)
345 else: 410 else:
346 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned, 411 oe.copy_buildsystem.create_locked_sstate_cache(lockedsigs_pruned,
347 d.getVar('SSTATE_DIR', True), 412 d.getVar('SSTATE_DIR', True),
348 sstate_out, d, 413 sstate_out, d,
349 fixedlsbstring) 414 fixedlsbstring,
415 filterfile=tasklistfn)
350 416
351 # We don't need sstate do_package files 417 # We don't need sstate do_package files
352 for root, dirs, files in os.walk(sstate_out): 418 for root, dirs, files in os.walk(sstate_out):