[oe-commits] [openembedded-core] 03/09: classes/lib: Remove bb.build.FuncFailed

git at git.openembedded.org git at git.openembedded.org
Wed Jul 31 22:04:00 UTC 2019


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 29fa1021d0841168f950dd83d9ed27cd2fa9fadb
Author: Richard Purdie <richard.purdie at linuxfoundation.org>
AuthorDate: Wed Jul 31 15:59:59 2019 +0100

    classes/lib: Remove bb.build.FuncFailed
    
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 meta/classes/go.bbclass         | 18 +++++++-----------
 meta/classes/image.bbclass      |  7 ++-----
 meta/lib/oe/gpg_sign.py         |  5 ++---
 meta/lib/oe/useradd.py          |  2 +-
 meta/lib/oe/utils.py            |  2 +-
 meta/lib/oeqa/targetcontrol.py  |  4 ++--
 meta/lib/oeqa/utils/commands.py |  4 ++--
 7 files changed, 17 insertions(+), 25 deletions(-)

diff --git a/meta/classes/go.bbclass b/meta/classes/go.bbclass
index f303a15..e40e556 100644
--- a/meta/classes/go.bbclass
+++ b/meta/classes/go.bbclass
@@ -71,17 +71,13 @@ python go_do_unpack() {
     if len(src_uri) == 0:
         return
 
-    try:
-        fetcher = bb.fetch2.Fetch(src_uri, d)
-        for url in fetcher.urls:
-            if fetcher.ud[url].type == 'git':
-                if fetcher.ud[url].parm.get('destsuffix') is None:
-                    s_dirname = os.path.basename(d.getVar('S'))
-                    fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src',
-                                                                      d.getVar('GO_IMPORT')) + '/'
-        fetcher.unpack(d.getVar('WORKDIR'))
-    except bb.fetch2.BBFetchException as e:
-        raise bb.build.FuncFailed(e)
+    fetcher = bb.fetch2.Fetch(src_uri, d)
+    for url in fetcher.urls:
+        if fetcher.ud[url].type == 'git':
+            if fetcher.ud[url].parm.get('destsuffix') is None:
+                s_dirname = os.path.basename(d.getVar('S'))
+                fetcher.ud[url].parm['destsuffix'] = os.path.join(s_dirname, 'src', d.getVar('GO_IMPORT')) + '/'
+    fetcher.unpack(d.getVar('WORKDIR'))
 }
 
 go_list_packages() {
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 682858d..7fa4ff2 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -305,11 +305,8 @@ fakeroot python do_image_qa () {
             bb.build.exec_func(cmd, d)
         except oe.utils.ImageQAFailed as e:
             qamsg = qamsg + '\tImage QA function %s failed: %s\n' % (e.name, e.description)
-        except bb.build.FuncFailed as e:
-            qamsg = qamsg + '\tImage QA function %s failed' % e.name
-            if e.logfile:
-                qamsg = qamsg + ' (log file is located at %s)' % e.logfile
-            qamsg = qamsg + '\n'
+        except Exception as e:
+            qamsg = qamsg + '\tImage QA function %s failed\n' % cmd
 
     if qamsg:
         imgname = d.getVar('IMAGE_NAME')
diff --git a/meta/lib/oe/gpg_sign.py b/meta/lib/oe/gpg_sign.py
index 2fd8c3b..d762480 100644
--- a/meta/lib/oe/gpg_sign.py
+++ b/meta/lib/oe/gpg_sign.py
@@ -89,8 +89,7 @@ class LocalSigner(object):
             (_, stderr) = job.communicate(passphrase.encode("utf-8"))
 
             if job.returncode:
-                raise bb.build.FuncFailed("GPG exited with code %d: %s" %
-                                          (job.returncode, stderr.decode("utf-8")))
+                bb.fatal("GPG exited with code %d: %s" % (job.returncode, stderr.decode("utf-8")))
 
         except IOError as e:
             bb.error("IO error (%s): %s" % (e.errno, e.strerror))
@@ -108,7 +107,7 @@ class LocalSigner(object):
             ver_str = subprocess.check_output(cmd).split()[2].decode("utf-8")
             return tuple([int(i) for i in ver_str.split("-")[0].split('.')])
         except subprocess.CalledProcessError as e:
-            raise bb.build.FuncFailed("Could not get gpg version: %s" % e)
+            bb.fatal("Could not get gpg version: %s" % e)
 
 
     def verify(self, sig_file):
diff --git a/meta/lib/oe/useradd.py b/meta/lib/oe/useradd.py
index bedfe0e..8fc7756 100644
--- a/meta/lib/oe/useradd.py
+++ b/meta/lib/oe/useradd.py
@@ -14,7 +14,7 @@ class myArgumentParser(argparse.ArgumentParser):
         error(message)
 
     def error(self, message):
-        raise bb.build.FuncFailed(message)
+        bb.fatal(message)
 
 def split_commands(params):
     params = re.split('''[ \t]*;[ \t]*(?=(?:[^'"]|'[^']*'|"[^"]*")*$)''', params.strip())
diff --git a/meta/lib/oe/utils.py b/meta/lib/oe/utils.py
index d686ce1..652b2be 100644
--- a/meta/lib/oe/utils.py
+++ b/meta/lib/oe/utils.py
@@ -486,7 +486,7 @@ def write_ld_so_conf(d):
         f.write(d.getVar("base_libdir") + '\n')
         f.write(d.getVar("libdir") + '\n')
 
-class ImageQAFailed(bb.build.FuncFailed):
+class ImageQAFailed(Exception):
     def __init__(self, description, name=None, logfile=None):
         self.description = description
         self.name = name
diff --git a/meta/lib/oeqa/targetcontrol.py b/meta/lib/oeqa/targetcontrol.py
index 15e617c..1445e3e 100644
--- a/meta/lib/oeqa/targetcontrol.py
+++ b/meta/lib/oeqa/targetcontrol.py
@@ -175,7 +175,7 @@ class QemuTarget(BaseTarget):
             if os.path.exists(self.qemulog):
                 with open(self.qemulog, 'r') as f:
                     bb.error("Qemu log output from %s:\n%s" % (self.qemulog, f.read()))
-            raise bb.build.FuncFailed("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
+            raise RuntimeError("%s - FAILED to start qemu - check the task log and the boot log" % self.pn)
 
     def check(self):
         return self.runner.is_alive()
@@ -192,7 +192,7 @@ class QemuTarget(BaseTarget):
             self.server_ip = self.runner.server_ip
             self.connection = SSHControl(ip=self.ip, logfile=self.sshlog)
         else:
-            raise bb.build.FuncFailed("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
+            raise RuntimError("%s - FAILED to re-start qemu - check the task log and the boot log" % self.pn)
 
     def run_serial(self, command, timeout=60):
         return self.runner.run_serial(command, timeout=timeout)
diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py
index 59ebfbe..7140bc7 100644
--- a/meta/lib/oeqa/utils/commands.py
+++ b/meta/lib/oeqa/utils/commands.py
@@ -337,8 +337,8 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None,
         qemu.deploy()
         try:
             qemu.start(params=qemuparams, ssh=ssh, runqemuparams=runqemuparams, launch_cmd=launch_cmd, discard_writes=discard_writes)
-        except bb.build.FuncFailed:
-            msg = 'Failed to start QEMU - see the logs in %s' % logdir
+        except EXception as e:
+            msg = str(e) + '\nFailed to start QEMU - see the logs in %s' % logdir
             if os.path.exists(qemu.qemurunnerlog):
                 with open(qemu.qemurunnerlog, 'r') as f:
                     msg = msg + "Qemurunner log output from %s:\n%s" % (qemu.qemurunnerlog, f.read())

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list