diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-02-14 20:13:46 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-03-04 10:42:29 +0000 |
commit | 19a868e9ad12fb27a7f713685d12f3d310fd6961 (patch) | |
tree | 388f7140b74c5d63c41e2c4595fbb9cd445b90fd /scripts/lib/wic/plugins/source/bootimg-pcbios.py | |
parent | adeacb4e600b8438bd9db7e83a5cb4a118d186f3 (diff) | |
download | openembedded-core-19a868e9ad12fb27a7f713685d12f3d310fd6961.tar.gz openembedded-core-19a868e9ad12fb27a7f713685d12f3d310fd6961.tar.bz2 openembedded-core-19a868e9ad12fb27a7f713685d12f3d310fd6961.zip |
wic: use wic logger in wic source plugins
Replaced msger with wic logger in wic source plugins.
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Diffstat (limited to 'scripts/lib/wic/plugins/source/bootimg-pcbios.py')
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-pcbios.py | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index e5f6a328ed..590d3d6784 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -24,9 +24,10 @@ # Tom Zanussi <tom.zanussi (at] linux.intel.com> # +import logging import os +import sys -from wic import msger from wic.engine import get_custom_config from wic.utils import runner from wic.utils.errors import ImageError @@ -34,6 +35,8 @@ from wic.pluginbase import SourcePlugin from wic.utils.misc import (exec_cmd, exec_native_cmd, get_bitbake_var, BOOTDD_EXTRA_SPACE) +logger = logging.getLogger('wic') + class BootimgPcbiosPlugin(SourcePlugin): """ Create MBR boot partition and install syslinux on it. @@ -54,16 +57,18 @@ class BootimgPcbiosPlugin(SourcePlugin): elif creator.ptable_format == 'gpt': mbrfile += "gptmbr.bin" else: - msger.error("Unsupported partition table: %s" % creator.ptable_format) + logger.error("Unsupported partition table: %s", creator.ptable_format) + sys.exit(1) if not os.path.exists(mbrfile): - msger.error("Couldn't find %s. If using the -e option, do you " - "have the right MACHINE set in local.conf? If not, " - "is the bootimg_dir path correct?" % mbrfile) + logger.error("Couldn't find %s. If using the -e option, do you " + "have the right MACHINE set in local.conf? If not, " + "is the bootimg_dir path correct?", mbrfile) + sys.exit(1) full_path = creator._full_path(workdir, disk_name, "direct") - msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ - % (disk_name, full_path, disk.min_size)) + logger.debug("Installing MBR on disk %s as %s with size %s bytes", + disk_name, full_path, disk.min_size) rcode = runner.show(['dd', 'if=%s' % mbrfile, 'of=%s' % full_path, 'conv=notrunc']) @@ -90,11 +95,11 @@ class BootimgPcbiosPlugin(SourcePlugin): if custom_cfg: # Use a custom configuration for grub syslinux_conf = custom_cfg - msger.debug("Using custom configuration file " - "%s for syslinux.cfg" % bootloader.configfile) + logger.debug("Using custom configuration file %s " + "for syslinux.cfg", bootloader.configfile) else: - msger.error("configfile is specified but failed to " - "get it from %s." % bootloader.configfile) + logger.error("configfile is specified but failed to " + "get it from %s.", bootloader.configfile) if not custom_cfg: # Create syslinux configuration using parameters from wks file @@ -122,8 +127,8 @@ class BootimgPcbiosPlugin(SourcePlugin): syslinux_conf += "APPEND label=boot root=%s %s\n" % \ (creator.rootdev, bootloader.append) - msger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg" \ - % cr_workdir) + logger.debug("Writing syslinux config %s/hdd/boot/syslinux.cfg", + cr_workdir) cfg = open("%s/hdd/boot/syslinux.cfg" % cr_workdir, "w") cfg.write(syslinux_conf) cfg.close() @@ -147,9 +152,11 @@ class BootimgPcbiosPlugin(SourcePlugin): if not _has_syslinux(bootimg_dir): bootimg_dir = get_bitbake_var("STAGING_DATADIR", "wic-tools") if not bootimg_dir: - msger.error("Couldn't find STAGING_DATADIR, exiting\n") + logger.error("Couldn't find STAGING_DATADIR, exiting\n") + sys.exit(1) if not _has_syslinux(bootimg_dir): - msger.error("Please build syslinux first\n") + logger.error("Please build syslinux first\n") + sys.exit(1) # just so the result notes display it creator.bootimg_dir = bootimg_dir @@ -176,8 +183,8 @@ class BootimgPcbiosPlugin(SourcePlugin): blocks += extra_blocks - msger.debug("Added %d extra blocks to %s to get to %d total blocks" % \ - (extra_blocks, part.mountpoint, blocks)) + logger.debug("Added %d extra blocks to %s to get to %d total blocks", + extra_blocks, part.mountpoint, blocks) # dosfs image, created by mkdosfs bootimg = "%s/boot.img" % cr_workdir |