mirror of
https://git.yoctoproject.org/poky
synced 2026-04-05 08:02:25 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
15ea180414
commit
50a3dc5b2d
@@ -25,11 +25,12 @@
|
||||
# Ed Bartosh <ed.bartosh> (at] linux.intel.com>
|
||||
|
||||
|
||||
|
||||
import os
|
||||
import shlex
|
||||
from argparse import ArgumentParser, ArgumentError, ArgumentTypeError
|
||||
|
||||
from wic.partition import Partition
|
||||
from wic.utils.misc import find_canned
|
||||
|
||||
class KickStartError(Exception):
|
||||
pass
|
||||
@@ -78,6 +79,17 @@ def overheadtype(arg):
|
||||
|
||||
return result
|
||||
|
||||
def cannedpathtype(arg):
|
||||
"""
|
||||
Custom type for ArgumentParser
|
||||
Tries to find file in the list of canned wks paths
|
||||
"""
|
||||
scripts_path = os.path.abspath(os.path.dirname(__file__) + '../../..')
|
||||
result = find_canned(scripts_path, arg)
|
||||
if not result:
|
||||
raise ArgumentTypeError("file not found: %s" % arg)
|
||||
return result
|
||||
|
||||
class KickStart(object):
|
||||
def __init__(self, confpath):
|
||||
|
||||
@@ -117,7 +129,7 @@ class KickStart(object):
|
||||
bootloader.add_argument('--source')
|
||||
|
||||
include = subparsers.add_parser('include')
|
||||
include.add_argument('path')
|
||||
include.add_argument('path', type=cannedpathtype)
|
||||
|
||||
self._parse(parser, confpath)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user