summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scripts/lib/image/engine.py5
-rw-r--r--scripts/lib/wic/conf.py26
-rw-r--r--scripts/lib/wic/imager/direct.py4
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/micboot.py2
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py20
-rw-r--r--scripts/lib/wic/msger.py23
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py4
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py5
-rw-r--r--scripts/lib/wic/utils/runner.py2
-rwxr-xr-xscripts/wic26
10 files changed, 68 insertions, 49 deletions
diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index 92dcc5a4f9..0dc7920967 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -236,7 +236,10 @@ def wic_list(args, scripts_path, properties_file):
236 wks_file = args[0] 236 wks_file = args[0]
237 fullpath = find_canned_image(scripts_path, wks_file) 237 fullpath = find_canned_image(scripts_path, wks_file)
238 if not fullpath: 238 if not fullpath:
239 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 239 print "No image named %s found, exiting. "\
240 "(Use 'wic list images' to list available images, or "\
241 "specify a fully-qualified OE kickstart (.wks) "\
242 "filename)\n" % wks_file
240 sys.exit(1) 243 sys.exit(1)
241 list_canned_image_help(scripts_path, fullpath) 244 list_canned_image_help(scripts_path, fullpath)
242 return True 245 return True
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():
30 return scripts_path + "/lib/image/config/wic.conf" 30 return scripts_path + "/lib/image/config/wic.conf"
31 31
32class ConfigMgr(object): 32class ConfigMgr(object):
33 DEFAULTS = {'common': { 33 DEFAULTS = {
34 "distro_name": "Default Distribution", 34 'common': {
35 "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also? 35 "distro_name": "Default Distribution",
36 }, 36 "plugin_dir": "/usr/lib/wic/plugins"}, # TODO use prefix also?
37 'create': { 37 'create': {
38 "tmpdir": '/var/tmp/wic', 38 "tmpdir": '/var/tmp/wic',
39 "outdir": './wic-output', 39 "outdir": './wic-output',
40 40 "release": None,
41 "release": None, 41 "logfile": None,
42 "logfile": None, 42 "name_prefix": None,
43 "name_prefix": None, 43 "name_suffix": None}
44 "name_suffix": None, 44 }
45 },
46 }
47 45
48 # make the manager class as singleton 46 # make the manager class as singleton
49 _instance = None 47 _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):
179 179
180 if parts[i].mountpoint and not parts[i].fstype: 180 if parts[i].mountpoint and not parts[i].fstype:
181 raise CreatorError("Failed to create disks, no --fstype " 181 raise CreatorError("Failed to create disks, no --fstype "
182 "specified for partition with mountpoint " 182 "specified for partition with mountpoint "
183 "'%s' in the ks file") 183 "'%s' in the ks file")
184 184
185 self._disk_names.append(disk_name) 185 self._disk_names.append(disk_name)
186 186
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):
27 forceLBA=False, location="", md5pass="", password="", 27 forceLBA=False, location="", md5pass="", password="",
28 upgrade=False, menus=""): 28 upgrade=False, menus=""):
29 F8_Bootloader.__init__(self, writePriority, appendLine, driveorder, 29 F8_Bootloader.__init__(self, writePriority, appendLine, driveorder,
30 forceLBA, location, md5pass, password, upgrade) 30 forceLBA, location, md5pass, password, upgrade)
31 31
32 self.menus = "" 32 self.menus = ""
33 self.ptable = "msdos" 33 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):
157 157
158 if not self.source: 158 if not self.source:
159 if not self.size: 159 if not self.size:
160 msger.error("The %s partition has a size of zero. Please specify a non-zero --size for that partition." % self.mountpoint) 160 msger.error("The %s partition has a size of zero. Please "
161 "specify a non-zero --size for that partition." % \
162 self.mountpoint)
161 if self.fstype and self.fstype == "swap": 163 if self.fstype and self.fstype == "swap":
162 self.prepare_swap_partition(cr_workdir, oe_builddir, 164 self.prepare_swap_partition(cr_workdir, oe_builddir,
163 native_sysroot) 165 native_sysroot)
@@ -178,9 +180,14 @@ class Wic_PartData(Mic_PartData):
178 plugins = pluginmgr.get_source_plugins() 180 plugins = pluginmgr.get_source_plugins()
179 181
180 if self.source not in plugins: 182 if self.source not in plugins:
181 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)) 183 msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
182 184 "See 'wic list source-plugins' for a list of available"
183 self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods) 185 " --sources.\n\tSee 'wic help source-plugins' for "
186 "details on adding a new source plugin." % \
187 (self.source, self.mountpoint))
188
189 self._source_methods = pluginmgr.get_source_plugin_methods(\
190 self.source, partition_methods)
184 self._source_methods["do_configure_partition"](self, self.sourceparams_dict, 191 self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
185 cr, cr_workdir, 192 cr, cr_workdir,
186 oe_builddir, 193 oe_builddir,
@@ -466,9 +473,10 @@ class Wic_Partition(Mic_Partition):
466 removedAttrs = Mic_Partition.removedAttrs 473 removedAttrs = Mic_Partition.removedAttrs
467 474
468 def _getParser(self): 475 def _getParser(self):
469 def overhead_cb (option, opt_str, value, parser): 476 def overhead_cb(option, opt_str, value, parser):
470 if value < 1: 477 if value < 1:
471 raise OptionValueError("Option %s: invalid value: %r" % (option, value)) 478 raise OptionValueError("Option %s: invalid value: %r" % \
479 (option, value))
472 setattr(parser.values, option.dest, value) 480 setattr(parser.values, option.dest, value)
473 481
474 op = Mic_Partition._getParser(self) 482 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 @@
16# with this program; if not, write to the Free Software Foundation, Inc., 59 16# with this program; if not, write to the Free Software Foundation, Inc., 59
17# Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19import os,sys 19import os
20import sys
20import re 21import re
21import time 22import time
22 23
@@ -37,8 +38,8 @@ __ALL__ = ['set_mode',
37# COLORs in ANSI 38# COLORs in ANSI
38INFO_COLOR = 32 # green 39INFO_COLOR = 32 # green
39WARN_COLOR = 33 # yellow 40WARN_COLOR = 33 # yellow
40ERR_COLOR = 31 # red 41ERR_COLOR = 31 # red
41ASK_COLOR = 34 # blue 42ASK_COLOR = 34 # blue
42NO_COLOR = 0 43NO_COLOR = 0
43 44
44PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S) 45PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S)
@@ -47,12 +48,12 @@ INTERACTIVE = True
47 48
48LOG_LEVEL = 1 49LOG_LEVEL = 1
49LOG_LEVELS = { 50LOG_LEVELS = {
50 'quiet': 0, 51 'quiet': 0,
51 'normal': 1, 52 'normal': 1,
52 'verbose': 2, 53 'verbose': 2,
53 'debug': 3, 54 'debug': 3,
54 'never': 4, 55 'never': 4,
55 } 56}
56 57
57LOG_FILE_FP = None 58LOG_FILE_FP = None
58LOG_CONTENT = '' 59LOG_CONTENT = ''
@@ -75,7 +76,7 @@ def _general_print(head, color, msg=None, stream=None, level='normal'):
75 76
76 errormsg = '' 77 errormsg = ''
77 if CATCHERR_BUFFILE_FD > 0: 78 if CATCHERR_BUFFILE_FD > 0:
78 size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END) 79 size = os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_END)
79 os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET) 80 os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET)
80 errormsg = os.read(CATCHERR_BUFFILE_FD, size) 81 errormsg = os.read(CATCHERR_BUFFILE_FD, size)
81 os.ftruncate(CATCHERR_BUFFILE_FD, 0) 82 os.ftruncate(CATCHERR_BUFFILE_FD, 0)
@@ -158,7 +159,7 @@ def _split_msg(head, msg):
158 return head, msg 159 return head, msg
159 160
160def get_loglevel(): 161def get_loglevel():
161 return (k for k,v in LOG_LEVELS.items() if v==LOG_LEVEL).next() 162 return (k for k, v in LOG_LEVELS.items() if v == LOG_LEVEL).next()
162 163
163def set_loglevel(level): 164def set_loglevel(level):
164 global LOG_LEVEL 165 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):
56 msger.error("Unsupported partition table: %s" % cr.ptable_format) 56 msger.error("Unsupported partition table: %s" % cr.ptable_format)
57 57
58 if not os.path.exists(mbrfile): 58 if not os.path.exists(mbrfile):
59 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) 59 msger.error("Couldn't find %s. If using the -e option, do you "
60 "have the right MACHINE set in local.conf? If not, "
61 "is the bootimg_dir path correct?" % mbrfile)
60 62
61 full_path = cr._full_path(workdir, disk_name, "direct") 63 full_path = cr._full_path(workdir, disk_name, "direct")
62 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ 64 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):
302 msger.debug("partition %d: set UUID to %s" % \ 302 msger.debug("partition %d: set UUID to %s" % \
303 (p['num'], p['uuid'])) 303 (p['num'], p['uuid']))
304 exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \ 304 exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \
305 (p['num'], p['uuid'], 305 (p['num'], p['uuid'], d['disk'].device),
306 d['disk'].device), 306 self.native_sysroot)
307 self.native_sysroot)
308 307
309 if p['boot']: 308 if p['boot']:
310 flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot" 309 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):
89 else: 89 else:
90 cmd = cmdln_or_args 90 cmd = cmdln_or_args
91 91
92 msg = 'running command: "%s"' % cmd 92 msg = 'running command: "%s"' % cmd
93 if out: out = out.strip() 93 if out: out = out.strip()
94 if out: 94 if out:
95 msg += ', with output::' 95 msg += ', with output::'
diff --git a/scripts/wic b/scripts/wic
index ac272c62f7..9435ce085a 100755
--- a/scripts/wic
+++ b/scripts/wic
@@ -90,18 +90,24 @@ def wic_create_subcommand(args, usage_str):
90 parser = optparse.OptionParser(usage=usage_str) 90 parser = optparse.OptionParser(usage=usage_str)
91 91
92 parser.add_option("-o", "--outdir", dest="outdir", 92 parser.add_option("-o", "--outdir", dest="outdir",
93 action="store", help="name of directory to create image in") 93 help="name of directory to create image in")
94 parser.add_option("-e", "--image-name", dest="image_name", 94 parser.add_option("-e", "--image-name", dest="image_name",
95 action="store", help="name of the image to use the artifacts from e.g. core-image-sato") 95 help="name of the image to use the artifacts from "
96 parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir", 96 "e.g. core-image-sato")
97 action="callback", callback=callback_rootfs_dir, type="string", 97 parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir", type="string",
98 help="path to the /rootfs dir to use as the .wks rootfs source") 98 action="callback", callback=callback_rootfs_dir,
99 help="path to the /rootfs dir to use as the "
100 ".wks rootfs source")
99 parser.add_option("-b", "--bootimg-dir", dest="bootimg_dir", 101 parser.add_option("-b", "--bootimg-dir", dest="bootimg_dir",
100 action="store", help="path to the dir containing the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the .wks bootimg source") 102 help="path to the dir containing the boot artifacts "
103 "(e.g. /EFI or /syslinux dirs) to use as the "
104 ".wks bootimg source")
101 parser.add_option("-k", "--kernel-dir", dest="kernel_dir", 105 parser.add_option("-k", "--kernel-dir", dest="kernel_dir",
102 action="store", help="path to the dir containing the kernel to use in the .wks bootimg") 106 help="path to the dir containing the kernel to use "
107 "in the .wks bootimg")
103 parser.add_option("-n", "--native-sysroot", dest="native_sysroot", 108 parser.add_option("-n", "--native-sysroot", dest="native_sysroot",
104 action="store", help="path to the native sysroot containing the tools to use to build the image") 109 help="path to the native sysroot containing the tools "
110 "to use to build the image")
105 parser.add_option("-p", "--skip-build-check", dest="build_check", 111 parser.add_option("-p", "--skip-build-check", dest="build_check",
106 action="store_false", default=True, help="skip the build check") 112 action="store_false", default=True, help="skip the build check")
107 parser.add_option("-f", "--build-rootfs", action="store_true", help="build rootfs") 113 parser.add_option("-f", "--build-rootfs", action="store_true", help="build rootfs")
@@ -173,7 +179,9 @@ def wic_create_subcommand(args, usage_str):
173 if not wks_file.endswith(".wks"): 179 if not wks_file.endswith(".wks"):
174 wks_file = engine.find_canned_image(scripts_path, wks_file) 180 wks_file = engine.find_canned_image(scripts_path, wks_file)
175 if not wks_file: 181 if not wks_file:
176 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] 182 print "No image named %s found, exiting. (Use 'wic list images' "\
183 "to list available images, or specify a fully-qualified OE "\
184 "kickstart (.wks) filename)\n" % args[0]
177 sys.exit(1) 185 sys.exit(1)
178 186
179 image_output_dir = "" 187 image_output_dir = ""