]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
populate_sdk_ext.bbclass: remove the try...finally rbt/mutilib
authorRobert Yang <liezhi.yang@windriver.com>
Thu, 9 Nov 2017 07:17:22 +0000 (15:17 +0800)
committerRobert Yang <liezhi.yang@windriver.com>
Mon, 8 Jan 2018 10:08:33 +0000 (18:08 +0800)
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>
meta/classes/populate_sdk_ext.bbclass

index 78cdfab0ae75c1552ebf2a657659824d04097d55..c7a66d3515ae511354decb827c49490b1bc88da4 100644 (file)
@@ -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