mirror of
git://git.yoctoproject.org/poky.git
synced 2025-07-19 21:09:03 +02:00
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>
This commit is contained in:
parent
53ba34d143
commit
be73d2bf15
|
@ -1,5 +1,12 @@
|
||||||
# This class should provide easy access to the different aspects of the
|
# This class should provide easy access to the different aspects of the
|
||||||
# buildsystem such as layers, bitbake location, etc.
|
# buildsystem such as layers, bitbake location, etc.
|
||||||
|
#
|
||||||
|
# SDK_LAYERS_EXCLUDE: Layers which will be excluded from SDK layers.
|
||||||
|
# SDK_LAYERS_EXCLUDE_PATTERN: The simiar to SDK_LAYERS_EXCLUDE, this supports
|
||||||
|
# python regular expression, use space as separator,
|
||||||
|
# e.g.: ".*-downloads closed-.*"
|
||||||
|
#
|
||||||
|
|
||||||
import stat
|
import stat
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
@ -23,8 +30,10 @@ class BuildSystem(object):
|
||||||
self.context = context
|
self.context = context
|
||||||
self.layerdirs = [os.path.abspath(pth) for pth in d.getVar('BBLAYERS').split()]
|
self.layerdirs = [os.path.abspath(pth) for pth in d.getVar('BBLAYERS').split()]
|
||||||
self.layers_exclude = (d.getVar('SDK_LAYERS_EXCLUDE') or "").split()
|
self.layers_exclude = (d.getVar('SDK_LAYERS_EXCLUDE') or "").split()
|
||||||
|
self.layers_exclude_pattern = d.getVar('SDK_LAYERS_EXCLUDE_PATTERN')
|
||||||
|
|
||||||
def copy_bitbake_and_layers(self, destdir, workspace_name=None):
|
def copy_bitbake_and_layers(self, destdir, workspace_name=None):
|
||||||
|
import re
|
||||||
# Copy in all metadata layers + bitbake (as repositories)
|
# Copy in all metadata layers + bitbake (as repositories)
|
||||||
copied_corebase = None
|
copied_corebase = None
|
||||||
layers_copied = []
|
layers_copied = []
|
||||||
|
@ -41,8 +50,17 @@ class BuildSystem(object):
|
||||||
# Exclude layers
|
# Exclude layers
|
||||||
for layer_exclude in self.layers_exclude:
|
for layer_exclude in self.layers_exclude:
|
||||||
if layer_exclude in layers:
|
if layer_exclude in layers:
|
||||||
|
bb.note('Excluded %s from sdk layers since it is in SDK_LAYERS_EXCLUDE' % layer_exclude)
|
||||||
layers.remove(layer_exclude)
|
layers.remove(layer_exclude)
|
||||||
|
|
||||||
|
if self.layers_exclude_pattern:
|
||||||
|
layers_cp = layers[:]
|
||||||
|
for pattern in self.layers_exclude_pattern.split():
|
||||||
|
for layer in layers_cp:
|
||||||
|
if re.match(pattern, layer):
|
||||||
|
bb.note('Excluded %s from sdk layers since matched SDK_LAYERS_EXCLUDE_PATTERN' % layer)
|
||||||
|
layers.remove(layer)
|
||||||
|
|
||||||
workspace_newname = workspace_name
|
workspace_newname = workspace_name
|
||||||
if workspace_newname:
|
if workspace_newname:
|
||||||
layernames = [os.path.basename(layer) for layer in layers]
|
layernames = [os.path.basename(layer) for layer in layers]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user