summaryrefslogtreecommitdiffstats
path: root/meta/lib/bblayers/create.py
diff options
context:
space:
mode:
authorJoshua Watt <jpewhacker@gmail.com>2018-06-28 12:53:41 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2018-06-29 11:07:45 +0100
commit44b1fe43b0e97b1d01b95cd6ce40fbad78e65ab3 (patch)
treece88e4936b1de13dd3376c9c79970b18b546dfb3 /meta/lib/bblayers/create.py
parent1dec2101f9603d5340139f24d36c2e9f396eb311 (diff)
downloadpoky-44b1fe43b0e97b1d01b95cd6ce40fbad78e65ab3.tar.gz
bitbake-bblayers/create: Fix layer name generation
The path to where the layer was being created was taken verbatim as the name of the layer when generating the layer.conf and README files from templates. This causes problems in the layer.conf file because it would result in strangely named variables like BBFILE_PATTERN_../my-layer = "..." Instead of blindly taking the path, use the name of the last component of the path as the layer name. Additionally, rework the template files to use python format strings with named parameters so that the same argument doesn't have to be repeated multiple times. [YOCTO #12808] (From OE-Core rev: 01071c5d524a878d9de4814196cba2f15739796e) Signed-off-by: Joshua Watt <JPEWhacker@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/bblayers/create.py')
-rw-r--r--meta/lib/bblayers/create.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/meta/lib/bblayers/create.py b/meta/lib/bblayers/create.py
index e06949c92b..2ebf151ad1 100644
--- a/meta/lib/bblayers/create.py
+++ b/meta/lib/bblayers/create.py
@@ -30,8 +30,10 @@ class CreatePlugin(LayerPlugin):
30 conf = os.path.join(layerdir, 'conf') 30 conf = os.path.join(layerdir, 'conf')
31 bb.utils.mkdirhier(conf) 31 bb.utils.mkdirhier(conf)
32 32
33 layername = os.path.basename(os.path.normpath(args.layerdir))
34
33 # Create the README from templates/README 35 # Create the README from templates/README
34 readme_template = read_template('README') % (args.layerdir, args.layerdir, args.layerdir, args.layerdir, args.layerdir, args.layerdir) 36 readme_template = read_template('README').format(layername=layername)
35 readme = os.path.join(layerdir, 'README') 37 readme = os.path.join(layerdir, 'README')
36 with open(readme, 'w') as fd: 38 with open(readme, 'w') as fd:
37 fd.write(readme_template) 39 fd.write(readme_template)
@@ -47,7 +49,8 @@ class CreatePlugin(LayerPlugin):
47 compat = self.tinfoil.config_data.getVar('LAYERSERIES_COMPAT_core') or "" 49 compat = self.tinfoil.config_data.getVar('LAYERSERIES_COMPAT_core') or ""
48 50
49 # Create the layer.conf from templates/layer.conf 51 # Create the layer.conf from templates/layer.conf
50 layerconf_template = read_template('layer.conf') % (args.layerdir, args.layerdir, args.layerdir, args.priority, args.layerdir, args.layerdir, compat) 52 layerconf_template = read_template('layer.conf').format(
53 layername=layername, priority=args.priority, compat=compat)
51 layerconf = os.path.join(conf, 'layer.conf') 54 layerconf = os.path.join(conf, 'layer.conf')
52 with open(layerconf, 'w') as fd: 55 with open(layerconf, 'w') as fd:
53 fd.write(layerconf_template) 56 fd.write(layerconf_template)