aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2017-11-09 15:17:22 +0800
committerRobert Yang <liezhi.yang@windriver.com>2018-01-08 18:08:33 +0800
commit959517311c67ccc2931f55cb7d8384f57e15b636 (patch)
treef426d30527e2bd9e1f217585523393c3e37df8d3
parent75e0af04a45e2bb2ab5a728c85a7c91b5907faf3 (diff)
downloadopenembedded-core-contrib-rbt/mutilib.tar.gz
populate_sdk_ext.bbclass: remove the try...finallyrbt/mutilib
The "sdkbasepath + '/conf/local.conf.bak" doesn't exist when "oe.copy_buildsystem.check_sstate_task_list()" fails, then os.replace() would raise FileNotFoundError, which overcomes the real error. Keep the error status makes debug easier, so remove the try..finally. Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
-rw-r--r--meta/classes/populate_sdk_ext.bbclass70
1 files changed, 34 insertions, 36 deletions
diff --git a/meta/classes/populate_sdk_ext.bbclass b/meta/classes/populate_sdk_ext.bbclass
index 78cdfab0ae..c7a66d3515 100644
--- a/meta/classes/populate_sdk_ext.bbclass
+++ b/meta/classes/populate_sdk_ext.bbclass
@@ -142,43 +142,41 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
# Create a temporary build directory that we can pass to the env setup script
shutil.copyfile(sdkbasepath + '/conf/local.conf', sdkbasepath + '/conf/local.conf.bak')
+ with open(sdkbasepath + '/conf/local.conf', 'a') as f:
+ # Force the use of sstate from the build system
+ f.write('\nSSTATE_DIR_forcevariable = "%s"\n' % d.getVar('SSTATE_DIR'))
+ f.write('SSTATE_MIRRORS_forcevariable = "file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n')
+ # Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it
+ f.write('TMPDIR_forcevariable = "${TOPDIR}/tmp"\n')
+ f.write('TCLIBCAPPEND_forcevariable = ""\n')
+ # Drop uninative if the build isn't using it (or else NATIVELSBSTRING will
+ # be different and we won't be able to find our native sstate)
+ if not bb.data.inherits_class('uninative', d):
+ f.write('INHERIT_remove = "uninative"\n')
+
+ # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
+ # will not allow in its COREBASE path, so we need to rename the directory temporarily
+ temp_sdkbasepath = d.getVar('SDK_OUTPUT') + '/tmp-renamed-sdk'
+ # Delete any existing temp dir
try:
- with open(sdkbasepath + '/conf/local.conf', 'a') as f:
- # Force the use of sstate from the build system
- f.write('\nSSTATE_DIR_forcevariable = "%s"\n' % d.getVar('SSTATE_DIR'))
- f.write('SSTATE_MIRRORS_forcevariable = "file://universal/(.*) file://universal-4.9/\\1 file://universal-4.9/(.*) file://universal-4.8/\\1"\n')
- # Ensure TMPDIR is the default so that clean_esdk_builddir() can delete it
- f.write('TMPDIR_forcevariable = "${TOPDIR}/tmp"\n')
- f.write('TCLIBCAPPEND_forcevariable = ""\n')
- # Drop uninative if the build isn't using it (or else NATIVELSBSTRING will
- # be different and we won't be able to find our native sstate)
- if not bb.data.inherits_class('uninative', d):
- f.write('INHERIT_remove = "uninative"\n')
-
- # Unfortunately the default SDKPATH (or even a custom value) may contain characters that bitbake
- # will not allow in its COREBASE path, so we need to rename the directory temporarily
- temp_sdkbasepath = d.getVar('SDK_OUTPUT') + '/tmp-renamed-sdk'
- # Delete any existing temp dir
- try:
- shutil.rmtree(temp_sdkbasepath)
- except FileNotFoundError:
- pass
- os.rename(sdkbasepath, temp_sdkbasepath)
- cmdprefix = '. %s .; ' % conf_initpath
- logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt'
- try:
- oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile)
- except bb.process.ExecutionError as e:
- msg = 'Failed to generate filtered task list for extensible SDK:\n%s' % e.stdout.rstrip()
- if 'attempted to execute unexpectedly and should have been setscened' in e.stdout:
- 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'
- bb.fatal(msg)
- os.rename(temp_sdkbasepath, sdkbasepath)
- # Clean out residue of running bitbake, which check_sstate_task_list()
- # will effectively do
- clean_esdk_builddir(d, sdkbasepath)
- finally:
- os.replace(sdkbasepath + '/conf/local.conf.bak', sdkbasepath + '/conf/local.conf')
+ shutil.rmtree(temp_sdkbasepath)
+ except FileNotFoundError:
+ pass
+ os.rename(sdkbasepath, temp_sdkbasepath)
+ cmdprefix = '. %s .; ' % conf_initpath
+ logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt'
+ try:
+ oe.copy_buildsystem.check_sstate_task_list(d, get_sdk_install_targets(d), tasklistfile, cmdprefix=cmdprefix, cwd=temp_sdkbasepath, logfile=logfile)
+ except bb.process.ExecutionError as e:
+ msg = 'Failed to generate filtered task list for extensible SDK:\n%s' % e.stdout.rstrip()
+ if 'attempted to execute unexpectedly and should have been setscened' in e.stdout:
+ 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'
+ bb.fatal(msg)
+ os.rename(temp_sdkbasepath, sdkbasepath)
+ # Clean out residue of running bitbake, which check_sstate_task_list()
+ # will effectively do
+ clean_esdk_builddir(d, sdkbasepath)
+ os.replace(sdkbasepath + '/conf/local.conf.bak', sdkbasepath + '/conf/local.conf')
python copy_buildsystem () {
import re