diff options
Diffstat (limited to 'scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py')
-rw-r--r-- | scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py index 850aa5aaf1..4cc3a39856 100644 --- a/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py +++ b/scripts/lib/wic/plugins/source/rootfs_pcbios_ext.py | |||
@@ -21,9 +21,8 @@ | |||
21 | import logging | 21 | import logging |
22 | import os | 22 | import os |
23 | import re | 23 | import re |
24 | import sys | ||
25 | 24 | ||
26 | from wic.errors import ImageError | 25 | from wic.errors import ImageError, WicError |
27 | from wic.utils import runner | 26 | from wic.utils import runner |
28 | from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd | 27 | from wic.utils.misc import get_bitbake_var, exec_cmd, exec_native_cmd |
29 | from wic.pluginbase import SourcePlugin | 28 | from wic.pluginbase import SourcePlugin |
@@ -99,10 +98,9 @@ class RootfsPlugin(SourcePlugin): | |||
99 | 98 | ||
100 | image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) | 99 | image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) |
101 | if not os.path.isdir(image_rootfs_dir): | 100 | if not os.path.isdir(image_rootfs_dir): |
102 | logger.error("No valid artifact IMAGE_ROOTFS from image named %s " | 101 | raise WicError("No valid artifact IMAGE_ROOTFS from image named %s " |
103 | "has been found at %s, exiting.\n", | 102 | "has been found at %s, exiting." % |
104 | rootfs_dir, image_rootfs_dir) | 103 | (rootfs_dir, image_rootfs_dir)) |
105 | sys.exit(1) | ||
106 | 104 | ||
107 | return image_rootfs_dir | 105 | return image_rootfs_dir |
108 | 106 | ||
@@ -160,14 +158,12 @@ class RootfsPlugin(SourcePlugin): | |||
160 | logger.info("building syslinux-native...") | 158 | logger.info("building syslinux-native...") |
161 | exec_cmd("bitbake syslinux-native") | 159 | exec_cmd("bitbake syslinux-native") |
162 | if not is_exe(native_syslinux_nomtools): | 160 | if not is_exe(native_syslinux_nomtools): |
163 | logger.error("Couldn't find syslinux-nomtools (%s), exiting\n", | 161 | raise WicError("Couldn't find syslinux-nomtools (%s), exiting" % |
164 | native_syslinux_nomtools) | 162 | native_syslinux_nomtools) |
165 | sys.exit(1) | ||
166 | 163 | ||
167 | if part.rootfs is None: | 164 | if part.rootfs is None: |
168 | if 'ROOTFS_DIR' not in krootfs_dir: | 165 | if 'ROOTFS_DIR' not in krootfs_dir: |
169 | logger.error("Couldn't find --rootfs-dir, exiting") | 166 | raise WicError("Couldn't find --rootfs-dir, exiting") |
170 | sys.exit(1) | ||
171 | rootfs_dir = krootfs_dir['ROOTFS_DIR'] | 167 | rootfs_dir = krootfs_dir['ROOTFS_DIR'] |
172 | else: | 168 | else: |
173 | if part.rootfs in krootfs_dir: | 169 | if part.rootfs in krootfs_dir: |
@@ -175,9 +171,8 @@ class RootfsPlugin(SourcePlugin): | |||
175 | elif part.rootfs: | 171 | elif part.rootfs: |
176 | rootfs_dir = part.rootfs | 172 | rootfs_dir = part.rootfs |
177 | else: | 173 | else: |
178 | logger.error("Couldn't find --rootfs-dir=%s connection or " | 174 | raise WicError("Couldn't find --rootfs-dir=%s connection or " |
179 | "it is not a valid path, exiting", part.rootfs) | 175 | "it is not a valid path, exiting" % part.rootfs) |
180 | sys.exit(1) | ||
181 | 176 | ||
182 | real_rootfs_dir = cls._get_rootfs_dir(rootfs_dir) | 177 | real_rootfs_dir = cls._get_rootfs_dir(rootfs_dir) |
183 | 178 | ||
@@ -203,15 +198,12 @@ class RootfsPlugin(SourcePlugin): | |||
203 | elif image_creator.ptable_format == 'gpt': | 198 | elif image_creator.ptable_format == 'gpt': |
204 | mbrfile += "gptmbr.bin" | 199 | mbrfile += "gptmbr.bin" |
205 | else: | 200 | else: |
206 | logger.error("Unsupported partition table: %s", | 201 | raise WicError("Unsupported partition table: %s" % |
207 | image_creator.ptable_format) | 202 | image_creator.ptable_format) |
208 | sys.exit(1) | ||
209 | 203 | ||
210 | if not os.path.exists(mbrfile): | 204 | if not os.path.exists(mbrfile): |
211 | logger.error("Couldn't find %s. Has syslinux-native been baked?", | 205 | raise WicError("Couldn't find %s. Has syslinux-native been baked?", |
212 | mbrfile) | 206 | mbrfile) |
213 | sys.exit(1) | ||
214 | |||
215 | full_path = disk.path | 207 | full_path = disk.path |
216 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", | 208 | logger.debug("Installing MBR on disk %s as %s with size %s bytes", |
217 | disk_name, full_path, disk.min_size) | 209 | disk_name, full_path, disk.min_size) |