mirror of
https://git.yoctoproject.org/poky
synced 2026-07-16 03:47:03 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
f5ae79da40
commit
8da175607c
@@ -27,8 +27,8 @@
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
from wic.errors import WicError
|
||||
from wic.engine import get_custom_config
|
||||
from wic.pluginbase import SourcePlugin
|
||||
from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var,
|
||||
@@ -59,9 +59,8 @@ class BootimgEFIPlugin(SourcePlugin):
|
||||
logger.debug("Using custom configuration file "
|
||||
"%s for grub.cfg", configfile)
|
||||
else:
|
||||
logger.error("configfile is specified but failed to "
|
||||
"get it from %s.", configfile)
|
||||
sys.exit(1)
|
||||
raise WicError("configfile is specified but failed to "
|
||||
"get it from %s." % configfile)
|
||||
|
||||
if not custom_cfg:
|
||||
# Create grub configuration using parameters from wks file
|
||||
@@ -108,8 +107,7 @@ class BootimgEFIPlugin(SourcePlugin):
|
||||
# obviously we need to have a common common deploy var
|
||||
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||
if not bootimg_dir:
|
||||
logger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
|
||||
sys.exit(1)
|
||||
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||
|
||||
cp_cmd = "cp %s/%s %s" % (bootimg_dir, initrd, hdddir)
|
||||
exec_cmd(cp_cmd, True)
|
||||
@@ -132,9 +130,8 @@ class BootimgEFIPlugin(SourcePlugin):
|
||||
logger.debug("Using custom configuration file "
|
||||
"%s for systemd-boots's boot.conf", configfile)
|
||||
else:
|
||||
logger.error("configfile is specified but failed to "
|
||||
"get it from %s.", configfile)
|
||||
sys.exit(1)
|
||||
raise WicError("configfile is specified but failed to "
|
||||
"get it from %s.", configfile)
|
||||
|
||||
if not custom_cfg:
|
||||
# Create systemd-boot configuration using parameters from wks file
|
||||
@@ -174,11 +171,9 @@ class BootimgEFIPlugin(SourcePlugin):
|
||||
elif source_params['loader'] == 'systemd-boot':
|
||||
cls.do_configure_systemdboot(hdddir, creator, cr_workdir, source_params)
|
||||
else:
|
||||
logger.error("unrecognized bootimg-efi loader: %s", source_params['loader'])
|
||||
sys.exit(1)
|
||||
raise WicError("unrecognized bootimg-efi loader: %s" % source_params['loader'])
|
||||
except KeyError:
|
||||
logger.error("bootimg-efi requires a loader, none specified")
|
||||
sys.exit(1)
|
||||
raise WicError("bootimg-efi requires a loader, none specified")
|
||||
|
||||
|
||||
@classmethod
|
||||
@@ -193,8 +188,7 @@ class BootimgEFIPlugin(SourcePlugin):
|
||||
if not bootimg_dir:
|
||||
bootimg_dir = get_bitbake_var("DEPLOY_DIR_IMAGE")
|
||||
if not bootimg_dir:
|
||||
logger.error("Couldn't find DEPLOY_DIR_IMAGE, exiting\n")
|
||||
sys.exit(1)
|
||||
raise WicError("Couldn't find DEPLOY_DIR_IMAGE, exiting")
|
||||
# just so the result notes display it
|
||||
creator.bootimg_dir = bootimg_dir
|
||||
|
||||
@@ -221,12 +215,10 @@ class BootimgEFIPlugin(SourcePlugin):
|
||||
cp_cmd = "cp %s/%s %s/EFI/BOOT/%s" % (bootimg_dir, mod, hdddir, mod[8:])
|
||||
exec_cmd(cp_cmd, True)
|
||||
else:
|
||||
logger.error("unrecognized bootimg-efi loader: %s",
|
||||
source_params['loader'])
|
||||
sys.exit(1)
|
||||
raise WicError("unrecognized bootimg-efi loader: %s" %
|
||||
source_params['loader'])
|
||||
except KeyError:
|
||||
logger.error("bootimg-efi requires a loader, none specified")
|
||||
sys.exit(1)
|
||||
raise WicError("bootimg-efi requires a loader, none specified")
|
||||
|
||||
startup = os.path.join(bootimg_dir, "startup.nsh")
|
||||
if os.path.exists(startup):
|
||||
|
||||
Reference in New Issue
Block a user