diff options
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r-- | scripts/lib/wic/conf.py | 26 | ||||
-rw-r--r-- | scripts/lib/wic/imager/direct.py | 4 | ||||
-rw-r--r-- | scripts/lib/wic/kickstart/custom_commands/micboot.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/kickstart/custom_commands/partition.py | 20 | ||||
-rw-r--r-- | scripts/lib/wic/msger.py | 23 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-pcbios.py | 4 | ||||
-rw-r--r-- | scripts/lib/wic/utils/partitionedfs.py | 5 | ||||
-rw-r--r-- | scripts/lib/wic/utils/runner.py | 2 |
8 files changed, 47 insertions, 39 deletions
diff --git a/scripts/lib/wic/conf.py b/scripts/lib/wic/conf.py index ff6e2ca0f0..cecf396819 100644 --- a/scripts/lib/wic/conf.py +++ b/scripts/lib/wic/conf.py @@ -30,20 +30,18 @@ def get_siteconf(): return scripts_path + "/lib/image/config/wic.conf" class ConfigMgr(object): - DEFAULTS = {'common': { - "distro_name": "Default Distribution", - "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also? - }, - 'create': { - "tmpdir": '/var/tmp/wic', - "outdir": './wic-output', - - "release": None, - "logfile": None, - "name_prefix": None, - "name_suffix": None, - }, - } + DEFAULTS = { + 'common': { + "distro_name": "Default Distribution", + "plugin_dir": "/usr/lib/wic/plugins"}, # TODO use prefix also? + 'create': { + "tmpdir": '/var/tmp/wic', + "outdir": './wic-output', + "release": None, + "logfile": None, + "name_prefix": None, + "name_suffix": None} + } # make the manager class as singleton _instance = None diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py index 561c396c28..e2f805832b 100644 --- a/scripts/lib/wic/imager/direct.py +++ b/scripts/lib/wic/imager/direct.py @@ -179,8 +179,8 @@ class DirectImageCreator(BaseImageCreator): if parts[i].mountpoint and not parts[i].fstype: raise CreatorError("Failed to create disks, no --fstype " - "specified for partition with mountpoint " - "'%s' in the ks file") + "specified for partition with mountpoint " + "'%s' in the ks file") self._disk_names.append(disk_name) diff --git a/scripts/lib/wic/kickstart/custom_commands/micboot.py b/scripts/lib/wic/kickstart/custom_commands/micboot.py index 358b0ea9cd..1fa282b2f6 100644 --- a/scripts/lib/wic/kickstart/custom_commands/micboot.py +++ b/scripts/lib/wic/kickstart/custom_commands/micboot.py @@ -27,7 +27,7 @@ class Mic_Bootloader(F8_Bootloader): forceLBA=False, location="", md5pass="", password="", upgrade=False, menus=""): F8_Bootloader.__init__(self, writePriority, appendLine, driveorder, - forceLBA, location, md5pass, password, upgrade) + forceLBA, location, md5pass, password, upgrade) self.menus = "" self.ptable = "msdos" diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py index fea4d6deb4..045b290ed3 100644 --- a/scripts/lib/wic/kickstart/custom_commands/partition.py +++ b/scripts/lib/wic/kickstart/custom_commands/partition.py @@ -157,7 +157,9 @@ class Wic_PartData(Mic_PartData): if not self.source: if not self.size: - msger.error("The %s partition has a size of zero. Please specify a non-zero --size for that partition." % self.mountpoint) + msger.error("The %s partition has a size of zero. Please " + "specify a non-zero --size for that partition." % \ + self.mountpoint) if self.fstype and self.fstype == "swap": self.prepare_swap_partition(cr_workdir, oe_builddir, native_sysroot) @@ -178,9 +180,14 @@ class Wic_PartData(Mic_PartData): plugins = pluginmgr.get_source_plugins() if self.source not in plugins: - msger.error("The '%s' --source specified for %s doesn't exist.\n\tSee 'wic list source-plugins' for a list of available --sources.\n\tSee 'wic help source-plugins' for details on adding a new source plugin." % (self.source, self.mountpoint)) - - self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods) + msger.error("The '%s' --source specified for %s doesn't exist.\n\t" + "See 'wic list source-plugins' for a list of available" + " --sources.\n\tSee 'wic help source-plugins' for " + "details on adding a new source plugin." % \ + (self.source, self.mountpoint)) + + self._source_methods = pluginmgr.get_source_plugin_methods(\ + self.source, partition_methods) self._source_methods["do_configure_partition"](self, self.sourceparams_dict, cr, cr_workdir, oe_builddir, @@ -466,9 +473,10 @@ class Wic_Partition(Mic_Partition): removedAttrs = Mic_Partition.removedAttrs def _getParser(self): - def overhead_cb (option, opt_str, value, parser): + def overhead_cb(option, opt_str, value, parser): if value < 1: - raise OptionValueError("Option %s: invalid value: %r" % (option, value)) + raise OptionValueError("Option %s: invalid value: %r" % \ + (option, value)) setattr(parser.values, option.dest, value) op = Mic_Partition._getParser(self) diff --git a/scripts/lib/wic/msger.py b/scripts/lib/wic/msger.py index 35b705b867..1b60980296 100644 --- a/scripts/lib/wic/msger.py +++ b/scripts/lib/wic/msger.py @@ -16,7 +16,8 @@ # with this program; if not, write to the Free Software Foundation, Inc., 59 # Temple Place - Suite 330, Boston, MA 02111-1307, USA. -import os,sys +import os +import sys import re import time @@ -37,8 +38,8 @@ __ALL__ = ['set_mode', # COLORs in ANSI INFO_COLOR = 32 # green WARN_COLOR = 33 # yellow -ERR_COLOR = 31 # red -ASK_COLOR = 34 # blue +ERR_COLOR = 31 # red +ASK_COLOR = 34 # blue NO_COLOR = 0 PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S) @@ -47,12 +48,12 @@ INTERACTIVE = True LOG_LEVEL = 1 LOG_LEVELS = { - 'quiet': 0, - 'normal': 1, - 'verbose': 2, - 'debug': 3, - 'never': 4, - } + 'quiet': 0, + 'normal': 1, + 'verbose': 2, + 'debug': 3, + 'never': 4, +} LOG_FILE_FP = None LOG_CONTENT = '' @@ -75,7 +76,7 @@ def _general_print(head, color, msg=None, stream=None, level='normal'): errormsg = '' if CATCHERR_BUFFILE_FD > 0: - size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END) + size = os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_END) os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET) errormsg = os.read(CATCHERR_BUFFILE_FD, size) os.ftruncate(CATCHERR_BUFFILE_FD, 0) @@ -158,7 +159,7 @@ def _split_msg(head, msg): return head, msg def get_loglevel(): - return (k for k,v in LOG_LEVELS.items() if v==LOG_LEVEL).next() + return (k for k, v in LOG_LEVELS.items() if v == LOG_LEVEL).next() def set_loglevel(level): global LOG_LEVEL diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py index 6ca68f6e7e..721c524970 100644 --- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py +++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py @@ -56,7 +56,9 @@ class BootimgPcbiosPlugin(SourcePlugin): msger.error("Unsupported partition table: %s" % cr.ptable_format) 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) + 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) full_path = cr._full_path(workdir, disk_name, "direct") msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py index ca4b1f06c0..2f884a3cb8 100644 --- a/scripts/lib/wic/utils/partitionedfs.py +++ b/scripts/lib/wic/utils/partitionedfs.py @@ -302,9 +302,8 @@ class Image(object): msger.debug("partition %d: set UUID to %s" % \ (p['num'], p['uuid'])) exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \ - (p['num'], p['uuid'], - d['disk'].device), - self.native_sysroot) + (p['num'], p['uuid'], d['disk'].device), + self.native_sysroot) if p['boot']: flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot" diff --git a/scripts/lib/wic/utils/runner.py b/scripts/lib/wic/utils/runner.py index 2ae9f417c5..8d48f68034 100644 --- a/scripts/lib/wic/utils/runner.py +++ b/scripts/lib/wic/utils/runner.py @@ -89,7 +89,7 @@ def show(cmdln_or_args): else: cmd = cmdln_or_args - msg = 'running command: "%s"' % cmd + msg = 'running command: "%s"' % cmd if out: out = out.strip() if out: msg += ', with output::' |