Skip to contentSkip to conversation

bitbake-layers/create: add version for example recipe

PATCH New Anuj Mittal 1 participant 2 messages Jun 12, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 bitbake-layers/create: add version for example recipe

Add version field in recipe name for example recipe created by bitbake-layers.

Fixes [YOCTO #12767]

---
v2:
Fix typo

 meta/lib/bblayers/create.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
meta/lib/bblayers/create.py +2 -1
index 6a41fe0504..c1923166fd 100644
@@ -53,7 +53,7 @@ class CreatePlugin(LayerPlugin):
         example_template = read_template('example.bb')
         example = os.path.join(layerdir, 'recipes-' + args.examplerecipe, args.examplerecipe)
         bb.utils.mkdirhier(example)
-        with open(os.path.join(example, args.examplerecipe + '.bb'), 'w') as fd:
+        with open(os.path.join(example, args.examplerecipe + '_%s.bb') % args.version, 'w') as fd:
             fd.write(example_template)
 
         logger.plain('Add your new layer with \'bitbake-layers add-layer %s\'' % args.layerdir)
@@ -63,4 +63,5 @@ class CreatePlugin(LayerPlugin):
         parser_create_layer.add_argument('layerdir', help='Layer directory to create')
         parser_create_layer.add_argument('--priority', '-p', default=6, help='Layer directory to create')
         parser_create_layer.add_argument('--example-recipe-name', '-e', dest='examplerecipe', default='example', help='Filename of the example recipe')
+        parser_create_layer.add_argument('--example-recipe-version', '-v', dest='version', default='0.1', help='Version number for the example recipe')
 
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 2/2 bitbake-layers/create: add LAYERSERIES_COMPAT

Derive the value for template layer.conf from core layer and add dependendency on it too.

Fixes [YOCTO #12767]

---
v3:
Fix typo

 meta/lib/bblayers/create.py            | 5 ++++-
 meta/lib/bblayers/templates/layer.conf | 3 +++
 2 files changed, 7 insertions(+), 1 deletion(-)
meta/lib/bblayers/create.py +4 -1
index c1923166fd..e06949c92b 100644
@@ -43,8 +43,11 @@ class CreatePlugin(LayerPlugin):
         license_dst = os.path.join(layerdir, copying)
         shutil.copy(license_src, license_dst)
 
+        # Get the compat value for core layer.
+        compat = self.tinfoil.config_data.getVar('LAYERSERIES_COMPAT_core') or ""
+
         # Create the layer.conf from templates/layer.conf
-        layerconf_template = read_template('layer.conf') % (args.layerdir, args.layerdir, args.layerdir, args.priority)
+        layerconf_template = read_template('layer.conf') % (args.layerdir, args.layerdir, args.layerdir, args.priority, args.layerdir, args.layerdir, compat)
         layerconf = os.path.join(conf, 'layer.conf')
         with open(layerconf, 'w') as fd:
             fd.write(layerconf_template)
meta/lib/bblayers/templates/layer.conf +3 -0
index 3c0300226c..49f95cafc8 100644
@@ -8,3 +8,6 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
 BBFILE_COLLECTIONS += "%s"
 BBFILE_PATTERN_%s = "^${LAYERDIR}/"
 BBFILE_PRIORITY_%s = "%s"
+
+LAYERDEPENDS_%s = "core"
+LAYERSERIES_COMPAT_%s = "%s"
Signature · 1 line
2.17.1