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
---
meta/classes/populate_sdk_ext.bbclass | 70 +--
1 file changed, 34 insertions(+), 36 deletions(-)
diff --git a/meta/classes/populate_sdk_ext.bbclass
b/meta/classes/populate_sdk_ext.bbclass
index 057c495..43823bf 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