summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-04-30 12:52:49 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-19 09:05:21 +0100
commit32ee30a46d5e27ffcb0f18d85a0768bd22adca94 (patch)
tree711b1253359d62d29586ae8b362eac4e7ef7f859 /bitbake
parent90bc9b4f3342c41e4f9c20a6f0f8e69b8ed4bce3 (diff)
downloadpoky-32ee30a46d5e27ffcb0f18d85a0768bd22adca94.tar.gz
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>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.xml2
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-ref-variables.xml11
-rw-r--r--bitbake/lib/bb/cookerdata.py9
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 f6d82b4f3f..8b7edbff54 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
399 <link linkend='var-BBFILES'>BBFILES</link> += "${LAYERDIR}/*.bb" 399 <link linkend='var-BBFILES'>BBFILES</link> += "${LAYERDIR}/*.bb"
400 400
401 <link linkend='var-BBFILE_COLLECTIONS'>BBFILE_COLLECTIONS</link> += "mylayer" 401 <link linkend='var-BBFILE_COLLECTIONS'>BBFILE_COLLECTIONS</link> += "mylayer"
402 <link linkend='var-BBFILE_PATTERN'>BBFILE_PATTERN_mylayer</link> := "^${LAYERDIR}/" 402 <link linkend='var-BBFILE_PATTERN'>BBFILE_PATTERN_mylayer</link> := "^${LAYERDIR_RE}/"
403 </literallayout> 403 </literallayout>
404 For information on these variables, click the links 404 For information on these variables, click the links
405 to go to the definitions in the glossary.</para> 405 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 ae7e4cee8c..4d06ff950c 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 @@
1636 </glossdef> 1636 </glossdef>
1637 </glossentry> 1637 </glossentry>
1638 1638
1639 <glossentry id='var-LAYERDIR_RE'><glossterm>LAYERDIR_RE</glossterm>
1640 <glossdef>
1641 <para>When used inside the <filename>layer.conf</filename> configuration
1642 file, this variable provides the path of the current layer,
1643 escaped for use in a regular expression
1644 (<link linkend='var-BBFILE_PATTERN'><filename>BBFILE_PATTERN</filename></link>).
1645 This variable is not available outside of <filename>layer.conf</filename>
1646 and references are expanded immediately when parsing of the file completes.</para>
1647 </glossdef>
1648 </glossentry>
1649
1639 <glossentry id='var-LAYERVERSION'><glossterm>LAYERVERSION</glossterm> 1650 <glossentry id='var-LAYERVERSION'><glossterm>LAYERVERSION</glossterm>
1640 <glossdef> 1651 <glossdef>
1641 <para>Optionally specifies the version of a layer as a single number. 1652 <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 fba95afa54..1615db5b17 100644
--- a/bitbake/lib/bb/cookerdata.py
+++ b/bitbake/lib/bb/cookerdata.py
@@ -22,9 +22,11 @@
22# with this program; if not, write to the Free Software Foundation, Inc., 22# with this program; if not, write to the Free Software Foundation, Inc.,
23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 23# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 24
25import os, sys
26from functools import wraps
27import logging 25import logging
26import os
27import re
28import sys
29from functools import wraps
28import bb 30import bb
29from bb import data 31from bb import data
30import bb.parse 32import bb.parse
@@ -296,9 +298,12 @@ class CookerDataBuilder(object):
296 if layer.endswith('/'): 298 if layer.endswith('/'):
297 layer = layer.rstrip('/') 299 layer = layer.rstrip('/')
298 data.setVar('LAYERDIR', layer) 300 data.setVar('LAYERDIR', layer)
301 data.setVar('LAYERDIR_RE', re.escape(layer))
299 data = parse_config_file(os.path.join(layer, "conf", "layer.conf"), data) 302 data = parse_config_file(os.path.join(layer, "conf", "layer.conf"), data)
300 data.expandVarref('LAYERDIR') 303 data.expandVarref('LAYERDIR')
304 data.expandVarref('LAYERDIR_RE')
301 305
306 data.delVar('LAYERDIR_RE')
302 data.delVar('LAYERDIR') 307 data.delVar('LAYERDIR')
303 308
304 if not data.getVar("BBPATH", True): 309 if not data.getVar("BBPATH", True):