diff options
| author | Ulf Magnusson <ulfalizer@gmail.com> | 2016-10-01 04:46:52 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-10-04 16:29:04 +0100 |
| commit | c7d522c71747ebb3382db9bc609125faaa79c844 (patch) | |
| tree | 96f5341c72b133dc047998d5b53d3c2cb4e5fd93 /meta/classes/package_deb.bbclass | |
| parent | 9efdd605c9f81e4e11f34182394697078b705858 (diff) | |
| download | poky-c7d522c71747ebb3382db9bc609125faaa79c844.tar.gz | |
package_deb.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: 5a074e8a26d27ea9c4f31e2b75b2b14f6e0641d3)
Signed-off-by: Ulf Magnusson <ulfalizer@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/package_deb.bbclass')
| -rw-r--r-- | meta/classes/package_deb.bbclass | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/meta/classes/package_deb.bbclass b/meta/classes/package_deb.bbclass index 4e5dc12850..fb6034cab1 100644 --- a/meta/classes/package_deb.bbclass +++ b/meta/classes/package_deb.bbclass | |||
| @@ -126,7 +126,7 @@ python do_package_deb () { | |||
| 126 | ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8') | 126 | ctrlfile = codecs.open(os.path.join(controldir, 'control'), 'w', 'utf-8') |
| 127 | except OSError: | 127 | except OSError: |
| 128 | bb.utils.unlockfile(lf) | 128 | bb.utils.unlockfile(lf) |
| 129 | raise bb.build.FuncFailed("unable to open control file for writing.") | 129 | bb.fatal("unable to open control file for writing") |
| 130 | 130 | ||
| 131 | fields = [] | 131 | fields = [] |
| 132 | pe = d.getVar('PKGE', True) | 132 | pe = d.getVar('PKGE', True) |
| @@ -197,7 +197,7 @@ python do_package_deb () { | |||
| 197 | (type, value, traceback) = sys.exc_info() | 197 | (type, value, traceback) = sys.exc_info() |
| 198 | bb.utils.unlockfile(lf) | 198 | bb.utils.unlockfile(lf) |
| 199 | ctrlfile.close() | 199 | ctrlfile.close() |
| 200 | raise bb.build.FuncFailed("Missing field for deb generation: %s" % value) | 200 | bb.fatal("Missing field for deb generation: %s" % value) |
| 201 | 201 | ||
| 202 | # more fields | 202 | # more fields |
| 203 | 203 | ||
| @@ -277,7 +277,7 @@ python do_package_deb () { | |||
| 277 | scriptfile = open(os.path.join(controldir, script), 'w') | 277 | scriptfile = open(os.path.join(controldir, script), 'w') |
| 278 | except OSError: | 278 | except OSError: |
| 279 | bb.utils.unlockfile(lf) | 279 | bb.utils.unlockfile(lf) |
| 280 | raise bb.build.FuncFailed("unable to open %s script file for writing." % script) | 280 | bb.fatal("unable to open %s script file for writing" % script) |
| 281 | 281 | ||
| 282 | if scriptvar.startswith("#!"): | 282 | if scriptvar.startswith("#!"): |
| 283 | pos = scriptvar.find("\n") + 1 | 283 | pos = scriptvar.find("\n") + 1 |
| @@ -301,7 +301,7 @@ python do_package_deb () { | |||
| 301 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') | 301 | conffiles = open(os.path.join(controldir, 'conffiles'), 'w') |
| 302 | except OSError: | 302 | except OSError: |
| 303 | bb.utils.unlockfile(lf) | 303 | bb.utils.unlockfile(lf) |
| 304 | raise bb.build.FuncFailed("unable to open conffiles for writing.") | 304 | bb.fatal("unable to open conffiles for writing") |
| 305 | for f in conffiles_str.split(): | 305 | for f in conffiles_str.split(): |
| 306 | if os.path.exists(oe.path.join(root, f)): | 306 | if os.path.exists(oe.path.join(root, f)): |
| 307 | conffiles.write('%s\n' % f) | 307 | conffiles.write('%s\n' % f) |
| @@ -311,7 +311,7 @@ python do_package_deb () { | |||
| 311 | ret = subprocess.call("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH", True), root, pkgoutdir), shell=True) | 311 | ret = subprocess.call("PATH=\"%s\" dpkg-deb -b %s %s" % (localdata.getVar("PATH", True), root, pkgoutdir), shell=True) |
| 312 | if ret != 0: | 312 | if ret != 0: |
| 313 | bb.utils.unlockfile(lf) | 313 | bb.utils.unlockfile(lf) |
| 314 | raise bb.build.FuncFailed("dpkg-deb execution failed") | 314 | bb.fatal("dpkg-deb execution failed") |
| 315 | 315 | ||
| 316 | cleanupcontrol(root) | 316 | cleanupcontrol(root) |
| 317 | bb.utils.unlockfile(lf) | 317 | bb.utils.unlockfile(lf) |
