Limit the variants with config option 'tree_variants'

'tree_variants' in configuration should be able to limit the tree
variants, just like the config option 'tree_arches' which is used to
limited the arches.

For example, if there is configuration (refer to doc/configuration.rst)
go with:

        tree_variants = ["Server"]

then only "Server" variants will be composed, and any other variants in
variants.xml will be ignored.

Signed-off-by: Qixiang Wan <qwan@redhat.com>

Rebased on master

Signed-off-by: Dennis Gilmore <dennis@ausil.us>
This commit is contained in:
Dennis Gilmore 2016-03-03 13:00:52 -06:00
parent 9aed3364a6
commit f202d24961
2 changed files with 11 additions and 0 deletions

View File

@ -113,6 +113,12 @@ Example
base_product_short = "Fedora"
base_product_version = "23"
**tree_arches**
([*str*]) -- list of architectures which should be included; if undefined, all architectures from variants.xml will be included
**tree_variants**
([*str*]) -- list of variants which should be included; if undefined, all variants from variants.xml will be included
General Settings
================
@ -144,6 +150,8 @@ Options
Please note that ``*`` as a wildcard matches all architectures but ``src``.
tree_arches = ["x86_64"]
tree_variants = ["Server"]
Example
-------

View File

@ -215,7 +215,10 @@ class Compose(kobo.log.LoggingBase):
def get_variants(self, types=None, arch=None, recursive=False):
result = []
types = types or ["variant", "optional", "addon", "layered-product"]
tree_variants = self.conf.get("tree_variants", None)
for i in self.variants.values():
if tree_variants and i.name not in tree_variants:
continue
if i.type in types:
if arch and arch not in i.arches:
continue