diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2016-10-01 04:46:51 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-10-04 16:29:04 +0100 |
| commit | 9efdd605c9f81e4e11f34182394697078b705858 (patch) | |
| tree | 6dcf7bd169ed3efa1e6a1b446116892d34d8c1a0 | |
| parent | 4359ef089566375ccc502f587cd3be670a2d67f0 (diff) | |
| download | poky-9efdd605c9f81e4e11f34182394697078b705858.tar.gz | |
package_ipk.bbclass: Use bb.fatal() instead of raising FuncFailed
This sets a good example and avoids unnecessarily contributing to
perceived complexity and cargo culting.
Motivating quote below:
< kergoth> the *original* intent was for the function/task to error via
whatever appropriate means, bb.fatal, whatever, and
funcfailed was what you'd catch if you were calling
exec_func/exec_task. that is, it's what those functions
raise, not what metadata functions should be raising
< kergoth> it didn't end up being used that way
< kergoth> but there's really never a reason to raise it yourself
FuncFailed.__init__ takes a 'name' argument rather than a 'msg'
argument, which also shows that the original purpose got lost.
(From OE-Core rev: 01e3ac73860a24710852383a15bb5d01db13de57)
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/classes/package_ipk.bbclass | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/classes/package_ipk.bbclass b/meta/classes/package_ipk.bbclass index 930e154bd7..eb00932336 100644 --- a/meta/classes/package_ipk.bbclass +++ b/meta/classes/package_ipk.bbclass | |||
| @@ -108,7 +108,7 @@ python do_package_ipk () { | |||
| 108 | ctrlfile = open(os.path.join(controldir, 'control'), 'w') | 108 | ctrlfile = open(os.path.join(controldir, 'control'), 'w') |
| 109 | except OSError: | 109 | except OSError: |
| 110 | bb.utils.unlockfile(lf) | 110 | bb.utils.unlockfile(lf) |
| 111 | raise bb.build.FuncFailed("unable to open control file for writing.") | 111 | bb.fatal("unable to open control file for writing") |
| 112 | 112 | ||
| 113 | fields = [] | 113 | fields = [] |
| 114 | pe = d.getVar('PKGE', True) | 114 | pe = d.getVar('PKGE', True) |
| @@ -162,7 +162,7 @@ python do_package_ipk () { | |||
| 162 | (type, value, traceback) = sys.exc_info() | 162 | (type, value, traceback) = sys.exc_info() |
| 163 | ctrlfile.close() | 163 | ctrlfile.close() |
| 164 | bb.utils.unlockfile(lf) | 164 | bb.utils.unlockfile(lf) |
| 165 | raise bb.build.FuncFailed("Missing field for ipk generation: %s" % value) | 165 | bb.fatal("Missing field for ipk generation: %s" % value) |
| 166 | # more fields | 166 | # more fields |
| 167 | 167 | ||
| 168 | custom_fields_chunk = get_package_additional_metadata("ipk", localdata) | 168 | custom_fields_chunk = get_package_additional_metadata("ipk", localdata) |
| @@ -226,7 +226,7 @@ python do_package_ipk () { | |||
| 226 | scriptfile = open(os.path.join(controldir, script), 'w') | 226 | scriptfile = open(os.path.join(controldir, script), 'w') |
| 227 | except OSError: | 227 | except OSError: |
| 228 | bb.utils.unlockfile(lf) | 228 | bb.utils.unlockfile(lf) |
| 229 | raise bb.build.FuncFailed("unable to open %s script file for writing." % script) | 229 | bb.fatal("unable to open %s script file for writing" % script) |
| 230 | scriptfile.write(scriptvar) | 230 | scriptfile.write(scriptvar) |
| 231 | scriptfile.close() | 231 | scriptfile.close() |
| 232 | os.chmod(os.path.join(controldir, script), 0o755) | 232 | os.chmod(os.path.join(controldir, script), 0o755) |
| @@ -237,7 +237,7 @@ python do_package_ipk () { | |||
| 237 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') | 237 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') |
| 238 | except OSError: | 238 | except OSError: |
| 239 | bb.utils.unlockfile(lf) | 239 | bb.utils.unlockfile(lf) |
| 240 | raise bb.build.FuncFailed("unable to open conffiles for writing.") | 240 | bb.fatal("unable to open conffiles for writing") |
| 241 | for f in conffiles_str.split(): | 241 | for f in conffiles_str.split(): |
| 242 | if os.path.exists(oe.path.join(root, f)): | 242 | if os.path.exists(oe.path.join(root, f)): |
| 243 | conffiles.write('%s\n' % f) | 243 | conffiles.write('%s\n' % f) |
| @@ -248,7 +248,7 @@ python do_package_ipk () { | |||
| 248 | d.getVar("OPKGBUILDCMD", True), pkg, pkgoutdir), shell=True) | 248 | d.getVar("OPKGBUILDCMD", True), pkg, pkgoutdir), shell=True) |
| 249 | if ret != 0: | 249 | if ret != 0: |
| 250 | bb.utils.unlockfile(lf) | 250 | bb.utils.unlockfile(lf) |
| 251 | raise bb.build.FuncFailed("opkg-build execution failed") | 251 | bb.fatal("opkg-build execution failed") |
| 252 | 252 | ||
| 253 | if d.getVar('IPK_SIGN_PACKAGES', True) == '1': | 253 | if d.getVar('IPK_SIGN_PACKAGES', True) == '1': |
| 254 | ipkver = "%s-%s" % (d.getVar('PKGV', True), d.getVar('PKGR', True)) | 254 | ipkver = "%s-%s" % (d.getVar('PKGV', True), d.getVar('PKGR', True)) |
