瀏覽代碼

yocto-layer: add optional layer priority param

If the user specifies a layer priority following the layer name, layer
creation will proceed without further queries using the specified
layer priority and the remaining values defaulted.

(From meta-yocto rev: 84a0bd8940f82fb938972d7b026367d40c9472e7)

Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Tom Zanussi 12 年之前
父節點
當前提交
1ca4b36445
共有 2 個文件被更改,包括 19 次插入4 次删除
  1. 12 2
      scripts/lib/bsp/help.py
  2. 7 2
      scripts/yocto-layer

+ 12 - 2
scripts/lib/bsp/help.py

@@ -622,7 +622,8 @@ yocto_layer_create_usage = """
 
 
  Create a new generic Yocto layer
  Create a new generic Yocto layer
 
 
- usage: yocto-layer create <layer-name> [-o <DIRNAME> | --outdir <DIRNAME>]
+ usage: yocto-layer create <layer-name> [layer_priority]
+            [-o <DIRNAME> | --outdir <DIRNAME>]
             [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
             [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
 
 
  This command creates a generic Yocto layer based on the specified
  This command creates a generic Yocto layer based on the specified
@@ -631,6 +632,10 @@ yocto_layer_create_usage = """
  'meta-layer-name'.  The -o option can be used to place the layer in a
  'meta-layer-name'.  The -o option can be used to place the layer in a
  directory with a different name and location.
  directory with a different name and location.
 
 
+ If layer_priority is specified, a simple layer will be created using
+ the given layer priority, and the user will not be prompted for
+ further input.
+
  NOTE: Once created, you should add your new layer to your
  NOTE: Once created, you should add your new layer to your
  bblayers.conf file in order for it to be subsequently seen and
  bblayers.conf file in order for it to be subsequently seen and
  modified by the yocto-kernel tool.  Instructions for doing this can
  modified by the yocto-kernel tool.  Instructions for doing this can
@@ -646,7 +651,8 @@ NAME
     yocto-layer create - Create a new generic Yocto layer
     yocto-layer create - Create a new generic Yocto layer
 
 
 SYNOPSIS
 SYNOPSIS
-    yocto-layer create <layer-name> [-o <DIRNAME> | --outdir <DIRNAME>]
+    yocto-layer create <layer-name> [layer_priority]
+        [-o <DIRNAME> | --outdir <DIRNAME>]
         [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
         [-i <JSON PROPERTY FILE> | --infile <JSON PROPERTY_FILE>]
 
 
 DESCRIPTION
 DESCRIPTION
@@ -656,6 +662,10 @@ DESCRIPTION
     'meta-layer-name'.  The -o option can be used to place the layer
     'meta-layer-name'.  The -o option can be used to place the layer
     in a directory with a different name and location.
     in a directory with a different name and location.
 
 
+    If layer_priority is specified, a simple layer will be created
+    using the given layer priority, and the user will not be prompted
+    for further input.
+
     The layer-specific properties that define the values that will be
     The layer-specific properties that define the values that will be
     used to generate the layer can be specified on the command-line
     used to generate the layer can be specified on the command-line
     using the -i option and supplying a JSON object consisting of the
     using the -i option and supplying a JSON object consisting of the

+ 7 - 2
scripts/yocto-layer

@@ -60,19 +60,24 @@ def yocto_layer_create_subcommand(args, usage_str):
                       default = False, help = "dump the generated code to layergen.out")
                       default = False, help = "dump the generated code to layergen.out")
     (options, args) = parser.parse_args(args)
     (options, args) = parser.parse_args(args)
 
 
-    if len(args) != 1:
+    if len(args) < 1 or len(args) > 2:
         logging.error("Wrong number of arguments, exiting\n")
         logging.error("Wrong number of arguments, exiting\n")
         parser.print_help()
         parser.print_help()
         sys.exit(1)
         sys.exit(1)
 
 
     layer_name = args[0]
     layer_name = args[0]
+    properties = ""
+
+    if len(args) == 2:
+        layer_priority = args[1]
+        properties = '{"layer_priority":"' + layer_priority + '"}'
 
 
     if options.outdir:
     if options.outdir:
         layer_output_dir = options.outdir
         layer_output_dir = options.outdir
     else:
     else:
         layer_output_dir = "meta-" + layer_name
         layer_output_dir = "meta-" + layer_name
 
 
-    yocto_layer_create(layer_name, scripts_path, layer_output_dir, options.codedump, options.properties_file)
+    yocto_layer_create(layer_name, scripts_path, layer_output_dir, options.codedump, options.properties_file, properties)
 
 
 
 
 def yocto_layer_list_subcommand(args, usage_str):
 def yocto_layer_list_subcommand(args, usage_str):