diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-02-14 23:07:35 +0200 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-04 23:18:17 +0000 |
| commit | 8da175607c0d3434428a3bf4ee1549919b698709 (patch) | |
| tree | 1122f66b976598d3d3aa77cacc67659ccdda0c7c /scripts/lib/wic/plugins/source/bootimg-efi.py | |
| parent | f5ae79da406190bf27194d7cecf15926bbb6ef20 (diff) | |
| download | poky-8da175607c0d3434428a3bf4ee1549919b698709.tar.gz | |
wic: raise WicError in wic plugins
Replaced sys.exit with raising WicError in wic plugins.
(From OE-Core rev: 92e8c81c941597eb2b4b61d5c28833e4826888f8)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-efi.py')
| -rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 32 |
1 files changed, 12 insertions, 20 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index e4c845129e..1f018fabf4 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py | |||
| @@ -27,8 +27,8 @@ | |||
| 27 | import logging | 27 | import logging |
| 28 | import os | 28 | import os |
| 29 | import shutil | 29 | import shutil |
| 30 | import sys | ||
| 31 | 30 | ||
| 31 | from wic.errors import WicError | ||
| 32 | from wic.engine import get_custom_config | 32 | from wic.engine import get_custom_config |
| 33 | from wic.pluginbase import SourcePlugin | 33 | from wic.pluginbase import SourcePlugin |
| 34 | from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, | 34 | from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, |
| @@ -59,9 +59,8 @@ class BootimgEFIPlugin(SourcePlugin): | |||
| 59 | logger.debug("Using custom configuration file " | 59 | logger.debug("Using custom configuration file " |
| 60 | "%s for grub.cfg", configfile) | 60 | "%s for grub.cfg", configfile) |
| 61 | else: | 61 | else: |
| 62 | logger.error("configfile is specified but failed to " | 62 | raise WicError("configfile is specified but failed to " |
| 63 | "get it from %s.", configfile) | 63 | "get it from %s." % configfile) |
| 64 | sys.exit(1) | ||
| 65 | 64 | ||
| 66 | if not custom_cfg: | 65 | if not custom_cfg: |
| 67 | # Create grub configuration using parameters from wks file | 66 | # Create grub configuration using parameters from wks file |
| @@ -108,8 +107,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
| 108 | # obviously we need to have a common common deploy var | 107 | # obviously we need to have a common common deploy var |
| 109 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") | 108 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") |
| 110 | if not bootimg_dir: | 109 | if not bootimg_dir: |
| 111 | logger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") | 110 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") |
| 112 | sys.exit(1) | ||
| 113 | 111 | ||
| 114 | cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir) | 112 | cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir) |
| 115 | exec_cmd(cp_cmd, True) | 113 | exec_cmd(cp_cmd, True) |
| @@ -132,9 +130,8 @@ class BootimgEFIPlugin(SourcePlugin): | |||
| 132 | logger.debug("Using custom configuration file " | 130 | logger.debug("Using custom configuration file " |
| 133 | "%s for systemd-boots's boot.conf", configfile) | 131 | "%s for systemd-boots's boot.conf", configfile) |
| 134 | else: | 132 | else: |
| 135 | logger.error("configfile is specified but failed to " | 133 | raise WicError("configfile is specified but failed to " |
| 136 | "get it from %s.", configfile) | 134 | "get it from %s.", configfile) |
| 137 | sys.exit(1) | ||
| 138 | 135 | ||
| 139 | if not custom_cfg: | 136 | if not custom_cfg: |
| 140 | # Create systemd-boot configuration using parameters from wks file | 137 | # Create systemd-boot configuration using parameters from wks file |
| @@ -174,11 +171,9 @@ class BootimgEFIPlugin(SourcePlugin): | |||
| 174 | elif source_params['loader'] == 'systemd-boot': | 171 | elif source_params['loader'] == 'systemd-boot': |
| 175 | cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) | 172 | cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params) |
| 176 | else: | 173 | else: |
| 177 | logger.error("unrecognized bootimg-efi loader: %s", source_params['loader']) | 174 | raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader']) |
| 178 | sys.exit(1) | ||
| 179 | except KeyError: | 175 | except KeyError: |
| 180 | logger.error("bootimg-efi requires a loader, none specified") | 176 | raise WicError("bootimg-efi requires a loader, none specified") |
| 181 | sys.exit(1) | ||
| 182 | 177 | ||
| 183 | 178 | ||
| 184 | @classmethod | 179 | @classmethod |
| @@ -193,8 +188,7 @@ class BootimgEFIPlugin(SourcePlugin): | |||
| 193 | if not bootimg_dir: | 188 | if not bootimg_dir: |
| 194 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") | 189 | bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE") |
| 195 | if not bootimg_dir: | 190 | if not bootimg_dir: |
| 196 | logger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n") | 191 | raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting") |
| 197 | sys.exit(1) | ||
| 198 | # just so the result notes display it | 192 | # just so the result notes display it |
| 199 | creator.bootimg_dir = bootimg_dir | 193 | creator.bootimg_dir = bootimg_dir |
| 200 | 194 | ||
| @@ -221,12 +215,10 @@ class BootimgEFIPlugin(SourcePlugin): | |||
| 221 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[8:]) | 215 | cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[8:]) |
| 222 | exec_cmd(cp_cmd, True) | 216 | exec_cmd(cp_cmd, True) |
| 223 | else: | 217 | else: |
| 224 | logger.error("unrecognized bootimg-efi loader: %s", | 218 | raise WicError("unrecognized bootimg-efi loader: %s" % |
| 225 | source_params['loader']) | 219 | source_params['loader']) |
| 226 | sys.exit(1) | ||
| 227 | except KeyError: | 220 | except KeyError: |
| 228 | logger.error("bootimg-efi requires a loader, none specified") | 221 | raise WicError("bootimg-efi requires a loader, none specified") |
| 229 | sys.exit(1) | ||
| 230 | 222 | ||
| 231 | startup = os.path.join(bootimg_dir, "startup.nsh") | 223 | startup = os.path.join(bootimg_dir, "startup.nsh") |
| 232 | if os.path.exists(startup): | 224 | if os.path.exists(startup): |
