diff options
author | Peter Kjellerstedt <peter.kjellerstedt@axis.com> | 2016-01-27 18:23:27 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-29 17:03:53 +0000 |
commit | a948f5252a93ee474aa8ece418b29c0e85c815ce (patch) | |
tree | 91e8862acca68b848cfc0aa47b9e79b319da3930 /bitbake/lib | |
parent | e82101a4ed98b83943ed5c4813f474db3213af81 (diff) | |
download | poky-a948f5252a93ee474aa8ece418b29c0e85c815ce.tar.gz |
bitbake: cooker: Allow BBMASK to contain multiple regular expressions
Before, BBMASK was only permitted to contain one regular expression.
This made it hard to add to the BBMASK in multiple places as one was
supposed to separate the different regular expressions with a "|"
rather than with whitespace as is customary in BitBake variables.
Now one can specify any number of regular expressions in BBMASK. This
makes it possible to, e.g., mask out recipes in another layer from the
layer.conf file.
This also properly ignores any regular expressions that do not compile
(before an invalid regular expression would cause a ParseError in the
first bbappend file found stating that it was not a BitBake file...)
(Bitbake rev: 2c778ad50aceaffb855baf5f4aa0fed98c880870)
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 9c58d95006..a02d143c34 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1759,11 +1759,24 @@ class CookerCollectFiles(object): | |||
1759 | bbmask = config.getVar('BBMASK', True) | 1759 | bbmask = config.getVar('BBMASK', True) |
1760 | 1760 | ||
1761 | if bbmask: | 1761 | if bbmask: |
1762 | # First validate the individual regular expressions and ignore any | ||
1763 | # that do not compile | ||
1764 | bbmasks = [] | ||
1765 | for mask in bbmask.split(): | ||
1766 | try: | ||
1767 | re.compile(mask) | ||
1768 | bbmasks.append(mask) | ||
1769 | except sre_constants.error: | ||
1770 | collectlog.critical("BBMASK contains an invalid regular expression, ignoring: %s" % mask) | ||
1771 | |||
1772 | # Then validate the combined regular expressions. This should never | ||
1773 | # fail, but better safe than sorry... | ||
1774 | bbmask = "|".join(bbmasks) | ||
1762 | try: | 1775 | try: |
1763 | bbmask_compiled = re.compile(bbmask) | 1776 | bbmask_compiled = re.compile(bbmask) |
1764 | except sre_constants.error: | 1777 | except sre_constants.error: |
1765 | collectlog.critical("BBMASK is not a valid regular expression, ignoring.") | 1778 | collectlog.critical("BBMASK is not a valid regular expression, ignoring: %s" % bbmask) |
1766 | return list(newfiles), 0 | 1779 | bbmask = None |
1767 | 1780 | ||
1768 | bbfiles = [] | 1781 | bbfiles = [] |
1769 | bbappend = [] | 1782 | bbappend = [] |