wks_file = args[0]
fullpath = find_canned_image(scripts_path, wks_file)
if not fullpath:
- print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % wks_file
+ print "No image named %s found, exiting. "\
+ "(Use 'wic list images' to list available images, or "\
+ "specify a fully-qualified OE kickstart (.wks) "\
+ "filename)\n" % wks_file
sys.exit(1)
list_canned_image_help(scripts_path, fullpath)
return True
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
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)
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"
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)
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,
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)
# 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
# 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)
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 = ''
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)
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
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" \
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"
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::'
parser = optparse.OptionParser(usage=usage_str)
parser.add_option("-o", "--outdir", dest="outdir",
- action="store", help="name of directory to create image in")
+ help="name of directory to create image in")
parser.add_option("-e", "--image-name", dest="image_name",
- action="store", help="name of the image to use the artifacts from e.g. core-image-sato")
- parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir",
- action="callback", callback=callback_rootfs_dir, type="string",
- help="path to the /rootfs dir to use as the .wks rootfs source")
+ help="name of the image to use the artifacts from "
+ "e.g. core-image-sato")
+ parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir", type="string",
+ action="callback", callback=callback_rootfs_dir,
+ help="path to the /rootfs dir to use as the "
+ ".wks rootfs source")
parser.add_option("-b", "--bootimg-dir", dest="bootimg_dir",
- action="store", help="path to the dir containing the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the .wks bootimg source")
+ help="path to the dir containing the boot artifacts "
+ "(e.g. /EFI or /syslinux dirs) to use as the "
+ ".wks bootimg source")
parser.add_option("-k", "--kernel-dir", dest="kernel_dir",
- action="store", help="path to the dir containing the kernel to use in the .wks bootimg")
+ help="path to the dir containing the kernel to use "
+ "in the .wks bootimg")
parser.add_option("-n", "--native-sysroot", dest="native_sysroot",
- action="store", help="path to the native sysroot containing the tools to use to build the image")
+ help="path to the native sysroot containing the tools "
+ "to use to build the image")
parser.add_option("-p", "--skip-build-check", dest="build_check",
action="store_false", default=True, help="skip the build check")
parser.add_option("-f", "--build-rootfs", action="store_true", help="build rootfs")
if not wks_file.endswith(".wks"):
wks_file = engine.find_canned_image(scripts_path, wks_file)
if not wks_file:
- print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % args[0]
+ print "No image named %s found, exiting. (Use 'wic list images' "\
+ "to list available images, or specify a fully-qualified OE "\
+ "kickstart (.wks) filename)\n" % args[0]
sys.exit(1)
image_output_dir = ""