[gnome-continuous-yocto/gnomeostree-3.28-rocko: 394/8267] bitbake: Provide LAYERDIR_RE for layer.conf
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-continuous-yocto/gnomeostree-3.28-rocko: 394/8267] bitbake: Provide LAYERDIR_RE for layer.conf
- Date: Sat, 16 Dec 2017 20:21:55 +0000 (UTC)
commit 32ee30a46d5e27ffcb0f18d85a0768bd22adca94
Author: Christopher Larson <chris_larson mentor com>
Date: Sat Apr 30 12:52:49 2016 -0700
bitbake: Provide LAYERDIR_RE for layer.conf
This variable is a regex-escaped version of LAYERDIR, for safer use in
BBFILE_PATTERN, so as to avoid issues with regex special characters in the
layer path.
[YOCTO #8402]
(Bitbake rev: 72900522778b6ff08b135bf8bb97dff3f1a20bd9)
Signed-off-by: Christopher Larson <chris_larson mentor com>
Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>
.../bitbake-user-manual-hello.xml | 2 +-
.../bitbake-user-manual-ref-variables.xml | 11 +++++++++++
bitbake/lib/bb/cookerdata.py | 9 +++++++--
3 files changed, 19 insertions(+), 3 deletions(-)
---
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml
b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml
index f6d82b4..8b7edbf 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml
@@ -399,7 +399,7 @@ ERROR: Unable to parse base: ParseError in configuration INHERITs: Could not inh
<link linkend='var-BBFILES'>BBFILES</link> += "${LAYERDIR}/*.bb"
<link linkend='var-BBFILE_COLLECTIONS'>BBFILE_COLLECTIONS</link> += "mylayer"
- <link linkend='var-BBFILE_PATTERN'>BBFILE_PATTERN_mylayer</link> := "^${LAYERDIR}/"
+ <link linkend='var-BBFILE_PATTERN'>BBFILE_PATTERN_mylayer</link> := "^${LAYERDIR_RE}/"
</literallayout>
For information on these variables, click the links
to go to the definitions in the glossary.</para>
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
index ae7e4ce..4d06ff9 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml
@@ -1636,6 +1636,17 @@
</glossdef>
</glossentry>
+ <glossentry id='var-LAYERDIR_RE'><glossterm>LAYERDIR_RE</glossterm>
+ <glossdef>
+ <para>When used inside the <filename>layer.conf</filename> configuration
+ file, this variable provides the path of the current layer,
+ escaped for use in a regular expression
+ (<link linkend='var-BBFILE_PATTERN'><filename>BBFILE_PATTERN</filename></link>).
+ This variable is not available outside of <filename>layer.conf</filename>
+ and references are expanded immediately when parsing of the file completes.</para>
+ </glossdef>
+ </glossentry>
+
<glossentry id='var-LAYERVERSION'><glossterm>LAYERVERSION</glossterm>
<glossdef>
<para>Optionally specifies the version of a layer as a single number.
diff --git a/bitbake/lib/bb/cookerdata.py b/bitbake/lib/bb/cookerdata.py
index fba95af..1615db5 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -22,9 +22,11 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import os, sys
-from functools import wraps
import logging
+import os
+import re
+import sys
+from functools import wraps
import bb
from bb import data
import bb.parse
@@ -296,9 +298,12 @@ class CookerDataBuilder(object):
if layer.endswith('/'):
layer = layer.rstrip('/')
data.setVar('LAYERDIR', layer)
+ data.setVar('LAYERDIR_RE', re.escape(layer))
data = parse_config_file(os.path.join(layer, "conf", "layer.conf"), data)
data.expandVarref('LAYERDIR')
+ data.expandVarref('LAYERDIR_RE')
+ data.delVar('LAYERDIR_RE')
data.delVar('LAYERDIR')
if not data.getVar("BBPATH", True):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]