diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-09 23:33:15 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-10-14 22:32:50 +0100 |
commit | ed18e29bcf0d97addd41ae90e92a12ea10566f20 (patch) | |
tree | d9f848b396cf159e46d1d2bec516c5ef0d677ebb | |
parent | 2ef219407d512a934c58e0c3ea50901d9fadf598 (diff) | |
download | poky-ed18e29bcf0d97addd41ae90e92a12ea10566f20.tar.gz |
base: Use repr() for printing exceptions
Exceptions print more clearly using repr() instead of str(), fix
in fetch and unpack tasks.
Drop part of the test which no longer makes sense after this change.
(From OE-Core rev: c94816259cc1c09746353ad26ca0c811e0c962c2)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes/base.bbclass | 4 | ||||
-rw-r--r-- | meta/lib/oeqa/selftest/cases/bbtests.py | 3 |
2 files changed, 2 insertions, 5 deletions
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass index c0dddcf174..59fd46e5d4 100644 --- a/meta/classes/base.bbclass +++ b/meta/classes/base.bbclass | |||
@@ -160,7 +160,7 @@ python base_do_fetch() { | |||
160 | fetcher = bb.fetch2.Fetch(src_uri, d) | 160 | fetcher = bb.fetch2.Fetch(src_uri, d) |
161 | fetcher.download() | 161 | fetcher.download() |
162 | except bb.fetch2.BBFetchException as e: | 162 | except bb.fetch2.BBFetchException as e: |
163 | bb.fatal(str(e)) | 163 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) |
164 | } | 164 | } |
165 | 165 | ||
166 | addtask unpack after do_fetch | 166 | addtask unpack after do_fetch |
@@ -177,7 +177,7 @@ python base_do_unpack() { | |||
177 | fetcher = bb.fetch2.Fetch(src_uri, d) | 177 | fetcher = bb.fetch2.Fetch(src_uri, d) |
178 | fetcher.unpack(d.getVar('WORKDIR')) | 178 | fetcher.unpack(d.getVar('WORKDIR')) |
179 | except bb.fetch2.BBFetchException as e: | 179 | except bb.fetch2.BBFetchException as e: |
180 | bb.fatal(str(e)) | 180 | bb.fatal("Bitbake Fetcher Error: " + repr(e)) |
181 | } | 181 | } |
182 | 182 | ||
183 | def get_layers_branch_rev(d): | 183 | def get_layers_branch_rev(d): |
diff --git a/meta/lib/oeqa/selftest/cases/bbtests.py b/meta/lib/oeqa/selftest/cases/bbtests.py index 6562364074..6779e62103 100644 --- a/meta/lib/oeqa/selftest/cases/bbtests.py +++ b/meta/lib/oeqa/selftest/cases/bbtests.py | |||
@@ -151,9 +151,6 @@ INHERIT:remove = \"report-error\" | |||
151 | self.delete_recipeinc('man-db') | 151 | self.delete_recipeinc('man-db') |
152 | self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output) | 152 | self.assertEqual(result.status, 1, msg="Command succeded when it should have failed. bitbake output: %s" % result.output) |
153 | self.assertIn('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:', result.output) | 153 | self.assertIn('Fetcher failure: Unable to find file file://invalid anywhere. The paths that were searched were:', result.output) |
154 | line = self.getline(result, 'Fetcher failure for URL: \'file://invalid\'. Unable to fetch URL from any source.') | ||
155 | self.assertTrue(line and line.startswith("ERROR:"), msg = "\"invalid\" file \ | ||
156 | doesn't exist, yet fetcher didn't report any error. bitbake output: %s" % result.output) | ||
157 | 154 | ||
158 | def test_rename_downloaded_file(self): | 155 | def test_rename_downloaded_file(self): |
159 | # TODO unique dldir instead of using cleanall | 156 | # TODO unique dldir instead of using cleanall |