diff options
author | Robert Yang <liezhi.yang@windriver.com> | 2016-11-16 19:30:13 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2018-07-09 22:48:38 +0100 |
commit | be73d2bf15eb6b9afca324e0dd4b1a24c00a1f8e (patch) | |
tree | 6310bd96617996e9990588d0460c7857a46f088d /meta/lib/oe/copy_buildsystem.py | |
parent | 53ba34d1438981d3c8f47cbaaa91aeca51df4bcf (diff) | |
download | poky-be73d2bf15eb6b9afca324e0dd4b1a24c00a1f8e.tar.gz |
oe/copy_buildsystem.py: add SDK_LAYERS_EXCLUDE_PATTERN
It is helpful when exclude a lot of layers. It uses python re, and
supports multiple patterns (separated by space).
(From OE-Core rev: b5170882feb0f3bc2dddc213b6d115dfa87b7cc1)
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/copy_buildsystem.py')
-rw-r--r-- | meta/lib/oe/copy_buildsystem.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/meta/lib/oe/copy_buildsystem.py b/meta/lib/oe/copy_buildsystem.py index 4abec4666f..7cb784cf8c 100644 --- a/meta/lib/oe/copy_buildsystem.py +++ b/meta/lib/oe/copy_buildsystem.py | |||
@@ -1,5 +1,12 @@ | |||
1 | # This class should provide easy access to the different aspects of the | 1 | # This class should provide easy access to the different aspects of the |
2 | # buildsystem such as layers, bitbake location, etc. | 2 | # buildsystem such as layers, bitbake location, etc. |
3 | # | ||
4 | # SDK_LAYERS_EXCLUDE: Layers which will be excluded from SDK layers. | ||
5 | # SDK_LAYERS_EXCLUDE_PATTERN: The simiar to SDK_LAYERS_EXCLUDE, this supports | ||
6 | # python regular expression, use space as separator, | ||
7 | # e.g.: ".*-downloads closed-.*" | ||
8 | # | ||
9 | |||
3 | import stat | 10 | import stat |
4 | import shutil | 11 | import shutil |
5 | 12 | ||
@@ -23,8 +30,10 @@ class BuildSystem(object): | |||
23 | self.context = context | 30 | self.context = context |
24 | self.layerdirs = [os.path.abspath(pth) for pth in d.getVar('BBLAYERS').split()] | 31 | self.layerdirs = [os.path.abspath(pth) for pth in d.getVar('BBLAYERS').split()] |
25 | self.layers_exclude = (d.getVar('SDK_LAYERS_EXCLUDE') or "").split() | 32 | self.layers_exclude = (d.getVar('SDK_LAYERS_EXCLUDE') or "").split() |
33 | self.layers_exclude_pattern = d.getVar('SDK_LAYERS_EXCLUDE_PATTERN') | ||
26 | 34 | ||
27 | def copy_bitbake_and_layers(self, destdir, workspace_name=None): | 35 | def copy_bitbake_and_layers(self, destdir, workspace_name=None): |
36 | import re | ||
28 | # Copy in all metadata layers + bitbake (as repositories) | 37 | # Copy in all metadata layers + bitbake (as repositories) |
29 | copied_corebase = None | 38 | copied_corebase = None |
30 | layers_copied = [] | 39 | layers_copied = [] |
@@ -41,8 +50,17 @@ class BuildSystem(object): | |||
41 | # Exclude layers | 50 | # Exclude layers |
42 | for layer_exclude in self.layers_exclude: | 51 | for layer_exclude in self.layers_exclude: |
43 | if layer_exclude in layers: | 52 | if layer_exclude in layers: |
53 | bb.note('Excluded %s from sdk layers since it is in SDK_LAYERS_EXCLUDE' % layer_exclude) | ||
44 | layers.remove(layer_exclude) | 54 | layers.remove(layer_exclude) |
45 | 55 | ||
56 | if self.layers_exclude_pattern: | ||
57 | layers_cp = layers[:] | ||
58 | for pattern in self.layers_exclude_pattern.split(): | ||
59 | for layer in layers_cp: | ||
60 | if re.match(pattern, layer): | ||
61 | bb.note('Excluded %s from sdk layers since matched SDK_LAYERS_EXCLUDE_PATTERN' % layer) | ||
62 | layers.remove(layer) | ||
63 | |||
46 | workspace_newname = workspace_name | 64 | workspace_newname = workspace_name |
47 | if workspace_newname: | 65 | if workspace_newname: |
48 | layernames = [os.path.basename(layer) for layer in layers] | 66 | layernames = [os.path.basename(layer) for layer in layers] |