From 19a868e9ad12fb27a7f713685d12f3d310fd6961 Mon Sep 17 00:00:00 2001 From: Ed Bartosh Date: Tue, 14 Feb 2017 20:13:46 +0200 Subject: wic: use wic logger in wic source plugins Replaced msger with wic logger in wic source plugins. Signed-off-by: Ed Bartosh --- scripts/lib/wic/plugins/source/rootfs.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'scripts/lib/wic/plugins/source/rootfs.py') diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index c57a4341d1..21b653925c 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py @@ -25,15 +25,18 @@ # Joao Henrique Ferreira de Freitas # +import logging import os import shutil +import sys from oe.path import copyhardlinktree -from wic import msger from wic.pluginbase import SourcePlugin from wic.utils.misc import get_bitbake_var, exec_cmd +logger = logging.getLogger('wic') + class RootfsPlugin(SourcePlugin): """ Populate partition content from a rootfs directory. @@ -48,10 +51,10 @@ class RootfsPlugin(SourcePlugin): image_rootfs_dir = get_bitbake_var("IMAGE_ROOTFS", rootfs_dir) if not os.path.isdir(image_rootfs_dir): - msg = "No valid artifact IMAGE_ROOTFS from image named" - msg += " %s has been found at %s, exiting.\n" % \ - (rootfs_dir, image_rootfs_dir) - msger.error(msg) + logger.error("No valid artifact IMAGE_ROOTFS from image named %s " + "has been found at %s, exiting.\n", + rootfs_dir, image_rootfs_dir) + sys.exit(1) return image_rootfs_dir @@ -66,8 +69,9 @@ class RootfsPlugin(SourcePlugin): """ if part.rootfs_dir is None: if not 'ROOTFS_DIR' in krootfs_dir: - msg = "Couldn't find --rootfs-dir, exiting" - msger.error(msg) + logger.error("Couldn't find --rootfs-dir, exiting") + sys.exit(1) + rootfs_dir = krootfs_dir['ROOTFS_DIR'] else: if part.rootfs_dir in krootfs_dir: @@ -75,9 +79,9 @@ class RootfsPlugin(SourcePlugin): elif part.rootfs_dir: rootfs_dir = part.rootfs_dir else: - msg = "Couldn't find --rootfs-dir=%s connection" - msg += " or it is not a valid path, exiting" - msger.error(msg % part.rootfs_dir) + logger.error("Couldn't find --rootfs-dir=%s connection or " + "it is not a valid path, exiting", part.rootfs_dir) + sys.exit(1) real_rootfs_dir = cls.__get_rootfs_dir(rootfs_dir) -- cgit 1.2.3-korg