Skip to contentSkip to conversation

bitbake-blayers/create: add version for example recipe

PATCH Superseded Anuj Mittal 3 participants 5 messages Jun 11, 2018

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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

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

Fixes [YOCTO #12767]

---
 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 2/2 bitbake-blayers/create: add LAYERSERIES_COMPAT

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

Fixes [YOCTO #12767]

---
 meta/lib/bblayers/create.py            | 2 +-
 meta/lib/bblayers/templates/layer.conf | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
meta/lib/bblayers/create.py +1 -1
index c1923166fd..d9699b21f9 100644
@@ -44,7 +44,7 @@ class CreatePlugin(LayerPlugin):
         shutil.copy(license_src, license_dst)
 
         # 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)
         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..61b3ad8db3 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 = "${LAYERSERIES_COMPAT_core}"
Signature · 1 line
2.17.1
#2 lore raw

Re: [PATCH 2/2] bitbake-blayers/create: add LAYERSERIES_COMPAT

Quoted 34 lines · Anuj Mittal

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

Fixes [YOCTO #12767]

---
 meta/lib/bblayers/create.py            | 2 +-
 meta/lib/bblayers/templates/layer.conf | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
meta/lib/bblayers/create.py +1 -1
index c1923166fd..d9699b21f9 100644
@@ -44,7 +44,7 @@ class CreatePlugin(LayerPlugin):
         shutil.copy(license_src, license_dst)
 
         # 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)

layerconf = os.path.join(conf, 'layer.conf') with open(layerconf, 'w') as fd:
fd.write(layerconf_template)

meta/lib/bblayers/templates/layer.conf +0 -0
index 3c0300226c..61b3ad8db3 100644

meta/lib/bblayers/templates/layer.conf BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ · line 13

Quoted 6 lines
meta/lib/bblayers/templates/layer.conf +3 -0
@@ -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 = "${LAYERSERIES_COMPAT_core}"

I feel very strongly that we do not want to just copy and paste this "follow core" value around. The template needs to contain an expanded value so that when core changes, people need to update their layer to say what they're compatible with.

Cheers,

Richard

#3 lore raw

PATCH v2 1/1 bitbake-blayers/create: add LAYERSERIES_COMPAT

In reply to Anuj Mittal

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

Fixes [YOCTO #12767]

---
 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
#4 lore raw

Re: [PATCH v2] bitbake-blayers/create: add LAYERSERIES_COMPAT

Quoted 7 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Anuj Mittal
Sent: den 11 juni 2018 10:29
To: [email protected]
Subject: [OE-core] [PATCH v2] bitbake-blayers/create: add LAYERSERIES_COMPAT

                                ^^^^^^^^^^^^^^^

I assume you mean "bitbake-layers"... This goes for the other patch in the series as well.

//Peter