]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
populate_sdk_ext.bbclass: don't rename layers when failed
authorRobert Yang <liezhi.yang@windriver.com>
Sun, 15 Oct 2017 19:30:43 +0000 (03:30 +0800)
committerRobert Yang <liezhi.yang@windriver.com>
Wed, 22 Nov 2017 03:02:15 +0000 (11:02 +0800)
The previous code:
os.rename(sdkbasepath, temp_sdkbasepath)
try:
    foo
finally:
    os.rename(temp_sdkbasepath, sdkbasepath)

always renamed the path, it made the debug harder when error happened.
drop the "try: finally" makes the debug easier.

Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
meta/classes/populate_sdk_ext.bbclass

index 36209954a33c0e3d8a06034984c386c10147ade5..3826e08c6f2d96c7a63ada18c79de90e34e92e25 100644 (file)
@@ -162,18 +162,16 @@ def create_filtered_tasklist(d, sdkbasepath, tasklistfile, conf_initpath):
         except FileNotFoundError:
             pass
         os.rename(sdkbasepath, temp_sdkbasepath)
+        cmdprefix = '. %s .; ' % conf_initpath
+        logfile = d.getVar('WORKDIR') + '/tasklist_bb_log.txt'
         try:
-            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)
-        finally:
-            os.rename(temp_sdkbasepath, sdkbasepath)
+            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)