summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-01-19 18:51:08 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-20 17:07:13 +0000
commit50a3dc5b2de4f04efa7cf392b6703c2bcaf118ff (patch)
treef34a020923c551e07d8e14b72f9d3e4afdfff2cc
parent15ea18041419fe239b64b388e429020153bb28ed (diff)
downloadpoky-50a3dc5b2de4f04efa7cf392b6703c2bcaf118ff.tar.gz
wic: implement search of includes
Used custom argument type to implement search of include .wks files in canned wks paths. Include files can be specified either by full path or by name. [YOCTO #8848] (From OE-Core rev: 3695962ba4b685f304f1039978cec60d1b1712e3) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/wic/ksparser.py16
1 files changed, 14 insertions, 2 deletions
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index c73a456766..3722799b51 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -25,11 +25,12 @@
25# Ed Bartosh <ed.bartosh> (at] linux.intel.com> 25# Ed Bartosh <ed.bartosh> (at] linux.intel.com>
26 26
27 27
28 28import os
29import shlex 29import shlex
30from argparse import ArgumentParser, ArgumentError, ArgumentTypeError 30from argparse import ArgumentParser, ArgumentError, ArgumentTypeError
31 31
32from wic.partition import Partition 32from wic.partition import Partition
33from wic.utils.misc import find_canned
33 34
34class KickStartError(Exception): 35class KickStartError(Exception):
35 pass 36 pass
@@ -78,6 +79,17 @@ def overheadtype(arg):
78 79
79 return result 80 return result
80 81
82def cannedpathtype(arg):
83 """
84 Custom type for ArgumentParser
85 Tries to find file in the list of canned wks paths
86 """
87 scripts_path = os.path.abspath(os.path.dirname(__file__) + '../../..')
88 result = find_canned(scripts_path, arg)
89 if not result:
90 raise ArgumentTypeError("file not found: %s" % arg)
91 return result
92
81class KickStart(object): 93class KickStart(object):
82 def __init__(self, confpath): 94 def __init__(self, confpath):
83 95
@@ -117,7 +129,7 @@ class KickStart(object):
117 bootloader.add_argument('--source') 129 bootloader.add_argument('--source')
118 130
119 include = subparsers.add_parser('include') 131 include = subparsers.add_parser('include')
120 include.add_argument('path') 132 include.add_argument('path', type=cannedpathtype)
121 133
122 self._parse(parser, confpath) 134 self._parse(parser, confpath)
123 135