diff options
-rw-r--r-- | scripts/lib/wic/engine.py | 55 | ||||
-rw-r--r-- | scripts/lib/wic/help.py | 93 | ||||
-rwxr-xr-x | scripts/wic | 13 |
3 files changed, 30 insertions, 131 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index d4a7be6c3a..ce942ea4c4 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -194,46 +194,29 @@ def wic_create(wks_file, rootfs_dir, bootimg_dir, kernel_dir, | |||
194 | print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file | 194 | print "\nThe image(s) were created using OE kickstart file:\n %s" % wks_file |
195 | 195 | ||
196 | 196 | ||
197 | def wic_list(args, scripts_path, properties_file): | 197 | def wic_list(args, scripts_path): |
198 | """ | 198 | """ |
199 | Print the complete list of properties defined by the image, or the | 199 | Print the list of images or source plugins. |
200 | possible values for a particular image property. | ||
201 | """ | 200 | """ |
202 | if len(args) < 1: | 201 | if len(args) < 1: |
203 | return False | 202 | return False |
204 | 203 | ||
205 | if len(args) == 1: | 204 | if args == ["images"]: |
206 | if args[0] == "images": | 205 | list_canned_images(scripts_path) |
207 | list_canned_images(scripts_path) | 206 | return True |
208 | return True | 207 | elif args == ["source-plugins"]: |
209 | elif args[0] == "source-plugins": | 208 | list_source_plugins() |
210 | list_source_plugins() | 209 | return True |
211 | return True | 210 | elif len(args) == 2 and args[1] == "help": |
212 | elif args[0] == "properties": | 211 | wks_file = args[0] |
213 | return True | 212 | fullpath = find_canned_image(scripts_path, wks_file) |
214 | else: | 213 | if not fullpath: |
215 | return False | 214 | print "No image named %s found, exiting. "\ |
216 | 215 | "(Use 'wic list images' to list available images, or "\ | |
217 | if len(args) == 2: | 216 | "specify a fully-qualified OE kickstart (.wks) "\ |
218 | if args[0] == "properties": | 217 | "filename)\n" % wks_file |
219 | wks_file = args[1] | 218 | sys.exit(1) |
220 | print "print properties contained in wks file: %s" % wks_file | 219 | list_canned_image_help(scripts_path, fullpath) |
221 | return True | 220 | return True |
222 | elif args[0] == "property": | ||
223 | print "print property values for property: %s" % args[1] | ||
224 | return True | ||
225 | elif args[1] == "help": | ||
226 | wks_file = args[0] | ||
227 | fullpath = find_canned_image(scripts_path, wks_file) | ||
228 | if not fullpath: | ||
229 | print "No image named %s found, exiting. "\ | ||
230 | "(Use 'wic list images' to list available images, or "\ | ||
231 | "specify a fully-qualified OE kickstart (.wks) "\ | ||
232 | "filename)\n" % wks_file | ||
233 | sys.exit(1) | ||
234 | list_canned_image_help(scripts_path, fullpath) | ||
235 | return True | ||
236 | else: | ||
237 | return False | ||
238 | 221 | ||
239 | return False | 222 | return False |
diff --git a/scripts/lib/wic/help.py b/scripts/lib/wic/help.py index cd2176d151..9a778b69da 100644 --- a/scripts/lib/wic/help.py +++ b/scripts/lib/wic/help.py | |||
@@ -108,7 +108,7 @@ wic_usage = """ | |||
108 | Current 'wic' commands are: | 108 | Current 'wic' commands are: |
109 | help Show help for command or one of the topics (see below) | 109 | help Show help for command or one of the topics (see below) |
110 | create Create a new OpenEmbedded image | 110 | create Create a new OpenEmbedded image |
111 | list List available values for options and image properties | 111 | list List available canned images and source plugins |
112 | 112 | ||
113 | Help topics: | 113 | Help topics: |
114 | overview wic overview - General overview of wic | 114 | overview wic overview - General overview of wic |
@@ -221,27 +221,19 @@ DESCRIPTION | |||
221 | 221 | ||
222 | The -c option is used to specify compressor utility to compress | 222 | The -c option is used to specify compressor utility to compress |
223 | an image. gzip, bzip2 and xz compressors are supported. | 223 | an image. gzip, bzip2 and xz compressors are supported. |
224 | |||
225 | The set of properties available for a given image type can be | ||
226 | listed using the 'wic list' command. | ||
227 | """ | 224 | """ |
228 | 225 | ||
229 | wic_list_usage = """ | 226 | wic_list_usage = """ |
230 | 227 | ||
231 | List available OpenEmbedded image properties and values | 228 | List available OpenEmbedded images and source plugins |
232 | 229 | ||
233 | usage: wic list images | 230 | usage: wic list images |
234 | wic list <image> help | 231 | wic list <image> help |
235 | wic list source-plugins | 232 | wic list source-plugins |
236 | wic list properties | ||
237 | wic list properties <wks file> | ||
238 | wic list property <property> | ||
239 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
240 | 233 | ||
241 | This command enumerates the set of available canned images as well as | 234 | This command enumerates the set of available canned images as well as |
242 | help for those images. It also can be used to enumerate the complete | 235 | help for those images. It also can be used to list of available source |
243 | set of possible values for a specified option or property needed by | 236 | plugins. |
244 | the image creation process. | ||
245 | 237 | ||
246 | The first form enumerates all the available 'canned' images. | 238 | The first form enumerates all the available 'canned' images. |
247 | 239 | ||
@@ -251,40 +243,23 @@ wic_list_usage = """ | |||
251 | The third form enumerates all the available --sources (source | 243 | The third form enumerates all the available --sources (source |
252 | plugins). | 244 | plugins). |
253 | 245 | ||
254 | The fourth form enumerates all the possible values that exist and can | ||
255 | be specified in an OE kickstart (wks) file. | ||
256 | |||
257 | The fifth form enumerates all the possible options that exist for the | ||
258 | set of properties specified in a given OE kickstart (ks) file. | ||
259 | |||
260 | The final form enumerates all the possible values that exist and can | ||
261 | be specified for any given OE kickstart (wks) property. | ||
262 | |||
263 | See 'wic help list' for more details. | 246 | See 'wic help list' for more details. |
264 | """ | 247 | """ |
265 | 248 | ||
266 | wic_list_help = """ | 249 | wic_list_help = """ |
267 | 250 | ||
268 | NAME | 251 | NAME |
269 | wic list - List available OpenEmbedded image properties and values | 252 | wic list - List available OpenEmbedded images and source plugins |
270 | 253 | ||
271 | SYNOPSIS | 254 | SYNOPSIS |
272 | wic list images | 255 | wic list images |
273 | wic list <image> help | 256 | wic list <image> help |
274 | wic list source-plugins | 257 | wic list source-plugins |
275 | wic list properties | ||
276 | wic list properties <wks file> | ||
277 | wic list property <property> | ||
278 | [-o <JSON PROPERTY FILE> | --outfile <JSON PROPERTY_FILE>] | ||
279 | 258 | ||
280 | DESCRIPTION | 259 | DESCRIPTION |
281 | This command enumerates the complete set of possible values for a | ||
282 | specified option or property needed by the image creation process. | ||
283 | |||
284 | This command enumerates the set of available canned images as well | 260 | This command enumerates the set of available canned images as well |
285 | as help for those images. It also can be used to enumerate the | 261 | as help for those images. It also can be used to list available |
286 | complete set of possible values for a specified option or property | 262 | source plugins. |
287 | needed by the image creation process. | ||
288 | 263 | ||
289 | The first form enumerates all the available 'canned' images. | 264 | The first form enumerates all the available 'canned' images. |
290 | These are actually just the set of .wks files that have been moved | 265 | These are actually just the set of .wks files that have been moved |
@@ -301,60 +276,6 @@ DESCRIPTION | |||
301 | sources listed by the 'list source-plugins' command. Users can | 276 | sources listed by the 'list source-plugins' command. Users can |
302 | also add their own source plugins - see 'wic help plugins' for | 277 | also add their own source plugins - see 'wic help plugins' for |
303 | details. | 278 | details. |
304 | |||
305 | The third form enumerates all the possible values that exist and | ||
306 | can be specified in a OE kickstart (wks) file. The output of this | ||
307 | can be used by the third form to print the description and | ||
308 | possible values of a specific property. | ||
309 | |||
310 | The fourth form enumerates all the possible options that exist for | ||
311 | the set of properties specified in a given OE kickstart (wks) | ||
312 | file. If the -o option is specified, the list of properties, in | ||
313 | addition to being displayed, will be written to the specified file | ||
314 | as a JSON object. In this case, the object will consist of the | ||
315 | set of name:value pairs corresponding to the (possibly nested) | ||
316 | dictionary of properties defined by the input statements used by | ||
317 | the image. Some example output for the 'list <wks file>' command: | ||
318 | |||
319 | $ wic list test.ks | ||
320 | "part" : { | ||
321 | "mountpoint" : "/" | ||
322 | "fstype" : "ext3" | ||
323 | } | ||
324 | "part" : { | ||
325 | "mountpoint" : "/home" | ||
326 | "fstype" : "ext3" | ||
327 | "offset" : "10000" | ||
328 | } | ||
329 | "bootloader" : { | ||
330 | "type" : "efi" | ||
331 | } | ||
332 | . | ||
333 | . | ||
334 | . | ||
335 | |||
336 | Each entry in the output consists of the name of the input element | ||
337 | e.g. "part", followed by the properties defined for that | ||
338 | element enclosed in braces. This information should provide | ||
339 | sufficient information to create a complete user interface with. | ||
340 | |||
341 | The final form enumerates all the possible values that exist and | ||
342 | can be specified for any given OE kickstart (wks) property. If | ||
343 | the -o option is specified, the list of values for the given | ||
344 | property, in addition to being displayed, will be written to the | ||
345 | specified file as a JSON object. In this case, the object will | ||
346 | consist of the set of name:value pairs corresponding to the array | ||
347 | of property values associated with the property. | ||
348 | |||
349 | $ wic list property part | ||
350 | ["mountpoint", "where the partition should be mounted"] | ||
351 | ["fstype", "filesytem type of the partition"] | ||
352 | ["ext3"] | ||
353 | ["ext4"] | ||
354 | ["btrfs"] | ||
355 | ["swap"] | ||
356 | ["offset", "offset of the partition within the image"] | ||
357 | |||
358 | """ | 279 | """ |
359 | 280 | ||
360 | wic_plugins_help = """ | 281 | wic_plugins_help = """ |
diff --git a/scripts/wic b/scripts/wic index c99c5042bd..eb252a26ef 100755 --- a/scripts/wic +++ b/scripts/wic | |||
@@ -249,18 +249,13 @@ def wic_create_subcommand(args, usage_str): | |||
249 | 249 | ||
250 | def wic_list_subcommand(args, usage_str): | 250 | def wic_list_subcommand(args, usage_str): |
251 | """ | 251 | """ |
252 | Command-line handling for listing available image properties and | 252 | Command-line handling for listing available images. |
253 | values. The real work is done by image.engine.wic_list() | 253 | The real work is done by image.engine.wic_list() |
254 | """ | 254 | """ |
255 | parser = optparse.OptionParser(usage=usage_str) | 255 | parser = optparse.OptionParser(usage=usage_str) |
256 | args = parser.parse_args(args)[1] | ||
256 | 257 | ||
257 | parser.add_option("-o", "--outfile", action="store", | 258 | if not engine.wic_list(args, scripts_path): |
258 | dest="properties_file", | ||
259 | help="dump the possible values for image properties to a JSON file") | ||
260 | |||
261 | (options, args) = parser.parse_args(args) | ||
262 | |||
263 | if not engine.wic_list(args, scripts_path, options.properties_file): | ||
264 | logging.error("Bad list arguments, exiting\n") | 259 | logging.error("Bad list arguments, exiting\n") |
265 | parser.print_help() | 260 | parser.print_help() |
266 | sys.exit(1) | 261 | sys.exit(1) |