[yocto] [layerindex-web][PATCH 1/1] import_layer.py: add -t option for layer_type

Paul Eggleton paul.eggleton at linux.intel.com
Tue Jul 24 01:33:32 PDT 2018


Hi Robert,

On Monday, 23 July 2018 12:30:01 PM CEST Robert Yang wrote:
> Now the logic is:
> Use options.layer_type if specified, guess if not, default to 'M'.
> 
> Note choices=['A', 'B', 'S', 'D', 'M', ''], the '' is for default='', we can't
> use default='M' here, otherwise we don't know whether the 'M' is specified by
> user or not, we don't guess if it is specified by user, otherwise, guess.
> 
> Signed-off-by: Robert Yang <liezhi.yang at windriver.com>
> ---
>  layerindex/tools/import_layer.py | 18 +++++++++++++-----
>  1 file changed, 13 insertions(+), 5 deletions(-)
> 
> diff --git a/layerindex/tools/import_layer.py b/layerindex/tools/import_layer.py
> index 2413cff..0d501f6 100755
> --- a/layerindex/tools/import_layer.py
> +++ b/layerindex/tools/import_layer.py
> @@ -189,6 +189,10 @@ def main():
>      parser.add_option("-s", "--subdir",
>              help = "Specify subdirectory",
>              action="store", dest="subdir")
> +    parser.add_option("-t", "--type",
> +            help = "Specify layer type. A: Base, B: Machine(BSP), S: Software, D: Distribution, M: Miscellaneous",
> +            choices=['A', 'B', 'S', 'D', 'M', ''],
> +            action="store", dest="layer_type", default='')

If it's practical to do, could you make this part of the code use 
LayerItem.LAYER_TYPE_CHOICES from models.py so that this will work
if that is extended in future? Of course that will mean initialising Django
earlier, I'm not sure if that will have any side-effects that we wouldn't want.
If you could give that a try though that would be great.

Thanks,
Paul

-- 

Paul Eggleton
Intel Open Source Technology Centre




More information about the yocto mailing list