Allow filtering comps for different variants
We already filter for arches, so this just extends the filter to work with variants as well. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
d7021c5688
commit
a217eea24e
@ -34,14 +34,16 @@ def main():
|
|||||||
parser.add_argument("--no-reindent", default=False, action="store_true",
|
parser.add_argument("--no-reindent", default=False, action="store_true",
|
||||||
help="don't re-indent the output")
|
help="don't re-indent the output")
|
||||||
parser.add_argument("comps_file", metavar='COMPS_FILE')
|
parser.add_argument("comps_file", metavar='COMPS_FILE')
|
||||||
|
parser.add_argument('--variant',
|
||||||
|
help='filter groups and packages according to variant name')
|
||||||
|
|
||||||
opts = parser.parse_args()
|
opts = parser.parse_args()
|
||||||
|
|
||||||
with open(opts.comps_file, "rb") as file_obj:
|
with open(opts.comps_file, "rb") as file_obj:
|
||||||
f = CompsFilter(file_obj, reindent=not opts.no_reindent)
|
f = CompsFilter(file_obj, reindent=not opts.no_reindent)
|
||||||
f.filter_packages(opts.arch, opts.arch_only_packages)
|
f.filter_packages(opts.arch, opts.variant, opts.arch_only_packages)
|
||||||
f.filter_groups(opts.arch, opts.arch_only_groups)
|
f.filter_groups(opts.arch, opts.variant, opts.arch_only_groups)
|
||||||
f.filter_environments(opts.arch, opts.arch_only_environments)
|
f.filter_environments(opts.arch, opts.variant, opts.arch_only_environments)
|
||||||
|
|
||||||
if not opts.no_cleanup:
|
if not opts.no_cleanup:
|
||||||
f.cleanup(opts.keep_empty_group)
|
f.cleanup(opts.keep_empty_group)
|
||||||
|
@ -118,6 +118,7 @@ def write_variant_comps(compose, arch, variant):
|
|||||||
compose.log_debug(msg)
|
compose.log_debug(msg)
|
||||||
run(["comps_filter", "--arch=%s" % arch, "--keep-empty-group=conflicts",
|
run(["comps_filter", "--arch=%s" % arch, "--keep-empty-group=conflicts",
|
||||||
"--keep-empty-group=conflicts-%s" % variant.uid.lower(),
|
"--keep-empty-group=conflicts-%s" % variant.uid.lower(),
|
||||||
|
"--variant=%s" % variant.uid,
|
||||||
"--output=%s" % comps_file, compose.paths.work.comps(arch="global")])
|
"--output=%s" % comps_file, compose.paths.work.comps(arch="global")])
|
||||||
|
|
||||||
comps = CompsWrapper(comps_file)
|
comps = CompsWrapper(comps_file)
|
||||||
|
@ -79,29 +79,36 @@ class CompsFilter(object):
|
|||||||
# remove the attribute
|
# remove the attribute
|
||||||
del elem.attrib[attr_name]
|
del elem.attrib[attr_name]
|
||||||
|
|
||||||
def filter_packages(self, arch, only_arch=False):
|
def filter_packages(self, arch, variant, only_arch=False):
|
||||||
"""
|
"""
|
||||||
Filter packages according to arch.
|
Filter packages according to arch.
|
||||||
If only_arch is set, then only packages for the specified arch are preserved.
|
If only_arch is set, then only packages for the specified arch are preserved.
|
||||||
Multiple arches separated by comma can be specified in the XML.
|
Multiple arches separated by comma can be specified in the XML.
|
||||||
"""
|
"""
|
||||||
self._filter_elements_by_attr("/comps/group/packagelist/packagereq", 'arch', arch, only_arch)
|
self._filter_elements_by_attr("/comps/group/packagelist/packagereq", 'arch', arch, only_arch)
|
||||||
|
if variant:
|
||||||
|
self._filter_elements_by_attr("/comps/group/packagelist/packagereq",
|
||||||
|
'variant', variant, only_arch)
|
||||||
|
|
||||||
def filter_groups(self, arch, only_arch=False):
|
def filter_groups(self, arch, variant, only_arch=False):
|
||||||
"""
|
"""
|
||||||
Filter groups according to arch.
|
Filter groups according to arch.
|
||||||
If only_arch is set, then only groups for the specified arch are preserved.
|
If only_arch is set, then only groups for the specified arch are preserved.
|
||||||
Multiple arches separated by comma can be specified in the XML.
|
Multiple arches separated by comma can be specified in the XML.
|
||||||
"""
|
"""
|
||||||
self._filter_elements_by_attr("/comps/group", 'arch', arch, only_arch)
|
self._filter_elements_by_attr("/comps/group", 'arch', arch, only_arch)
|
||||||
|
if variant:
|
||||||
|
self._filter_elements_by_attr("/comps/group", 'variant', variant, only_arch)
|
||||||
|
|
||||||
def filter_environments(self, arch, only_arch=False):
|
def filter_environments(self, arch, variant, only_arch=False):
|
||||||
"""
|
"""
|
||||||
Filter environments according to arch.
|
Filter environments according to arch.
|
||||||
If only_arch is set, then only environments for the specified arch are preserved.
|
If only_arch is set, then only environments for the specified arch are preserved.
|
||||||
Multiple arches separated by comma can be specified in the XML.
|
Multiple arches separated by comma can be specified in the XML.
|
||||||
"""
|
"""
|
||||||
self._filter_elements_by_attr("/comps/environment", 'arch', arch, only_arch)
|
self._filter_elements_by_attr("/comps/environment", 'arch', arch, only_arch)
|
||||||
|
if variant:
|
||||||
|
self._filter_elements_by_attr("/comps/environment", 'variant', variant, only_arch)
|
||||||
|
|
||||||
def filter_category_groups(self):
|
def filter_category_groups(self):
|
||||||
"""
|
"""
|
||||||
|
@ -33,8 +33,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
|
|
||||||
|
4
tests/fixtures/comps-cleanup-filter.xml
vendored
4
tests/fixtures/comps-cleanup-filter.xml
vendored
@ -20,8 +20,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
|
8
tests/fixtures/comps-cleanup-keep.xml
vendored
8
tests/fixtures/comps-cleanup-keep.xml
vendored
@ -13,7 +13,7 @@
|
|||||||
<packagereq>Dummy-firefox</packagereq>
|
<packagereq>Dummy-firefox</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -28,8 +28,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -45,7 +45,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
8
tests/fixtures/comps-cleanup.xml
vendored
8
tests/fixtures/comps-cleanup.xml
vendored
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
60
tests/fixtures/comps-filtered-environments-variant.xml
vendored
Normal file
60
tests/fixtures/comps-filtered-environments-variant.xml
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
|
||||||
|
<comps>
|
||||||
|
<group>
|
||||||
|
<id>core</id>
|
||||||
|
<name>Core</name>
|
||||||
|
<name xml:lang="af">Kern</name>
|
||||||
|
<description>Smallest possible installation</description>
|
||||||
|
<description xml:lang="af">Kleinste moontlike installasie</description>
|
||||||
|
<default>true</default>
|
||||||
|
<uservisible>false</uservisible>
|
||||||
|
<packagelist>
|
||||||
|
<packagereq arch="ppc64le">Dummy-firefox</packagereq>
|
||||||
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
|
</packagelist>
|
||||||
|
</group>
|
||||||
|
<group arch="ppc64le" variant="Client">
|
||||||
|
<id>standard</id>
|
||||||
|
<name>Standard</name>
|
||||||
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
|
<default>false</default>
|
||||||
|
<uservisible>true</uservisible>
|
||||||
|
<packagelist>
|
||||||
|
<packagereq arch="x86_64">dummy-lvm2</packagereq>
|
||||||
|
</packagelist>
|
||||||
|
</group>
|
||||||
|
<group arch="x86_64">
|
||||||
|
<id>text-internet</id>
|
||||||
|
<name>Text-based Internet</name>
|
||||||
|
<description>This group includes text-based email, Web, and chat clients. These applications do not require the X Window System.</description>
|
||||||
|
<default>false</default>
|
||||||
|
<uservisible>true</uservisible>
|
||||||
|
<packagelist>
|
||||||
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
|
</packagelist>
|
||||||
|
</group>
|
||||||
|
<langpacks>
|
||||||
|
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
||||||
|
</langpacks>
|
||||||
|
<category>
|
||||||
|
<id>apps</id>
|
||||||
|
<name>Applications</name>
|
||||||
|
<name xml:lang="af">Toepassings</name>
|
||||||
|
<description>Applications to perform a variety of tasks</description>
|
||||||
|
<description xml:lang="ar">ﺖﻄﺒﻴﻗﺎﺗ ﺖﻗﻮﻣ ﺐﻤﻫﺎﻣ ﻢﻧﻮﻋﺓ</description>
|
||||||
|
<display_order>20</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>firefox</groupid>
|
||||||
|
</grouplist>
|
||||||
|
</category>
|
||||||
|
<category>
|
||||||
|
<id>empty-cat</id>
|
||||||
|
<name>A dummy category</name>
|
||||||
|
<description>This should be filtered out</description>
|
||||||
|
<display_order>20</display_order>
|
||||||
|
<grouplist>
|
||||||
|
</grouplist>
|
||||||
|
</category>
|
||||||
|
</comps>
|
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -31,11 +31,11 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
61
tests/fixtures/comps-filtered-groups-variant.xml
vendored
Normal file
61
tests/fixtures/comps-filtered-groups-variant.xml
vendored
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
|
||||||
|
<comps>
|
||||||
|
<group>
|
||||||
|
<id>core</id>
|
||||||
|
<name>Core</name>
|
||||||
|
<name xml:lang="af">Kern</name>
|
||||||
|
<description>Smallest possible installation</description>
|
||||||
|
<description xml:lang="af">Kleinste moontlike installasie</description>
|
||||||
|
<default>true</default>
|
||||||
|
<uservisible>false</uservisible>
|
||||||
|
<packagelist>
|
||||||
|
<packagereq arch="ppc64le">Dummy-firefox</packagereq>
|
||||||
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
|
</packagelist>
|
||||||
|
</group>
|
||||||
|
<environment arch="x86_64">
|
||||||
|
<id>minimal</id>
|
||||||
|
<name>Minimal install</name>
|
||||||
|
<name xml:lang="bg">Минимална инсталация</name>
|
||||||
|
<description>Basic functionality.</description>
|
||||||
|
<description xml:lang="bg">Основна функционалност.</description>
|
||||||
|
<display_order>99</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>core</groupid>
|
||||||
|
</grouplist>
|
||||||
|
<optionlist>
|
||||||
|
</optionlist>
|
||||||
|
</environment>
|
||||||
|
<environment variant="Server">
|
||||||
|
<id>desktop</id>
|
||||||
|
<name>Desktop</name>
|
||||||
|
<description>Desktop.</description>
|
||||||
|
<display_order>10</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>standard</groupid>
|
||||||
|
</grouplist>
|
||||||
|
</environment>
|
||||||
|
<langpacks>
|
||||||
|
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
||||||
|
</langpacks>
|
||||||
|
<category>
|
||||||
|
<id>apps</id>
|
||||||
|
<name>Applications</name>
|
||||||
|
<name xml:lang="af">Toepassings</name>
|
||||||
|
<description>Applications to perform a variety of tasks</description>
|
||||||
|
<description xml:lang="ar">ﺖﻄﺒﻴﻗﺎﺗ ﺖﻗﻮﻣ ﺐﻤﻫﺎﻣ ﻢﻧﻮﻋﺓ</description>
|
||||||
|
<display_order>20</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>firefox</groupid>
|
||||||
|
</grouplist>
|
||||||
|
</category>
|
||||||
|
<category>
|
||||||
|
<id>empty-cat</id>
|
||||||
|
<name>A dummy category</name>
|
||||||
|
<description>This should be filtered out</description>
|
||||||
|
<display_order>20</display_order>
|
||||||
|
<grouplist>
|
||||||
|
</grouplist>
|
||||||
|
</category>
|
||||||
|
</comps>
|
4
tests/fixtures/comps-filtered-groups.xml
vendored
4
tests/fixtures/comps-filtered-groups.xml
vendored
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group>
|
<group variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -37,7 +37,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
78
tests/fixtures/comps-filtered-packages-variant.xml
vendored
Normal file
78
tests/fixtures/comps-filtered-packages-variant.xml
vendored
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
|
<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
|
||||||
|
<comps>
|
||||||
|
<group>
|
||||||
|
<id>core</id>
|
||||||
|
<name>Core</name>
|
||||||
|
<name xml:lang="af">Kern</name>
|
||||||
|
<description>Smallest possible installation</description>
|
||||||
|
<description xml:lang="af">Kleinste moontlike installasie</description>
|
||||||
|
<default>true</default>
|
||||||
|
<uservisible>false</uservisible>
|
||||||
|
<packagelist>
|
||||||
|
<packagereq>Dummy-firefox</packagereq>
|
||||||
|
</packagelist>
|
||||||
|
</group>
|
||||||
|
<group arch="ppc64le" variant="Client">
|
||||||
|
<id>standard</id>
|
||||||
|
<name>Standard</name>
|
||||||
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
|
<default>false</default>
|
||||||
|
<uservisible>true</uservisible>
|
||||||
|
<packagelist/>
|
||||||
|
</group>
|
||||||
|
<group arch="x86_64">
|
||||||
|
<id>text-internet</id>
|
||||||
|
<name>Text-based Internet</name>
|
||||||
|
<description>This group includes text-based email, Web, and chat clients. These applications do not require the X Window System.</description>
|
||||||
|
<default>false</default>
|
||||||
|
<uservisible>true</uservisible>
|
||||||
|
<packagelist>
|
||||||
|
<packagereq type="optional">dummy-elinks</packagereq>
|
||||||
|
</packagelist>
|
||||||
|
</group>
|
||||||
|
<environment arch="x86_64">
|
||||||
|
<id>minimal</id>
|
||||||
|
<name>Minimal install</name>
|
||||||
|
<name xml:lang="bg">Минимална инсталация</name>
|
||||||
|
<description>Basic functionality.</description>
|
||||||
|
<description xml:lang="bg">Основна функционалност.</description>
|
||||||
|
<display_order>99</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>core</groupid>
|
||||||
|
</grouplist>
|
||||||
|
<optionlist>
|
||||||
|
</optionlist>
|
||||||
|
</environment>
|
||||||
|
<environment variant="Server">
|
||||||
|
<id>desktop</id>
|
||||||
|
<name>Desktop</name>
|
||||||
|
<description>Desktop.</description>
|
||||||
|
<display_order>10</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>standard</groupid>
|
||||||
|
</grouplist>
|
||||||
|
</environment>
|
||||||
|
<langpacks>
|
||||||
|
<match install="LabPlot-doc-%s" name="LabPlot-doc"/>
|
||||||
|
</langpacks>
|
||||||
|
<category>
|
||||||
|
<id>apps</id>
|
||||||
|
<name>Applications</name>
|
||||||
|
<name xml:lang="af">Toepassings</name>
|
||||||
|
<description>Applications to perform a variety of tasks</description>
|
||||||
|
<description xml:lang="ar">ﺖﻄﺒﻴﻗﺎﺗ ﺖﻗﻮﻣ ﺐﻤﻫﺎﻣ ﻢﻧﻮﻋﺓ</description>
|
||||||
|
<display_order>20</display_order>
|
||||||
|
<grouplist>
|
||||||
|
<groupid>firefox</groupid>
|
||||||
|
</grouplist>
|
||||||
|
</category>
|
||||||
|
<category>
|
||||||
|
<id>empty-cat</id>
|
||||||
|
<name>A dummy category</name>
|
||||||
|
<description>This should be filtered out</description>
|
||||||
|
<display_order>20</display_order>
|
||||||
|
<grouplist>
|
||||||
|
</grouplist>
|
||||||
|
</category>
|
||||||
|
</comps>
|
8
tests/fixtures/comps-filtered-packages.xml
vendored
8
tests/fixtures/comps-filtered-packages.xml
vendored
@ -13,7 +13,7 @@
|
|||||||
<packagereq>Dummy-firefox</packagereq>
|
<packagereq>Dummy-firefox</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -28,8 +28,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -45,7 +45,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
8
tests/fixtures/comps-removed-categories.xml
vendored
8
tests/fixtures/comps-removed-categories.xml
vendored
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<langpacks>
|
<langpacks>
|
||||||
|
8
tests/fixtures/comps-removed-langpacks.xml
vendored
8
tests/fixtures/comps-removed-langpacks.xml
vendored
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -29,8 +29,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -44,7 +44,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
8
tests/fixtures/comps.xml.in
vendored
8
tests/fixtures/comps.xml.in
vendored
@ -14,7 +14,7 @@
|
|||||||
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
<packagereq arch="x86_64">dummy-icedtea-web</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<group arch="ppc64le">
|
<group arch="ppc64le" variant="Client">
|
||||||
<id>standard</id>
|
<id>standard</id>
|
||||||
<name>Standard</name>
|
<name>Standard</name>
|
||||||
<description>Common set of utilities that extend the minimal installation.</description>
|
<description>Common set of utilities that extend the minimal installation.</description>
|
||||||
@ -31,8 +31,8 @@
|
|||||||
<default>false</default>
|
<default>false</default>
|
||||||
<uservisible>true</uservisible>
|
<uservisible>true</uservisible>
|
||||||
<packagelist>
|
<packagelist>
|
||||||
<packagereq type="optional">dummy-elinks</packagereq>
|
<packagereq type="optional" variant="Server">dummy-elinks</packagereq>
|
||||||
<packagereq type="optional">dummy-tftp</packagereq>
|
<packagereq type="optional" variant="Client">dummy-tftp</packagereq>
|
||||||
</packagelist>
|
</packagelist>
|
||||||
</group>
|
</group>
|
||||||
<environment arch="x86_64">
|
<environment arch="x86_64">
|
||||||
@ -48,7 +48,7 @@
|
|||||||
<optionlist>
|
<optionlist>
|
||||||
</optionlist>
|
</optionlist>
|
||||||
</environment>
|
</environment>
|
||||||
<environment>
|
<environment variant="Server">
|
||||||
<id>desktop</id>
|
<id>desktop</id>
|
||||||
<name>Desktop</name>
|
<name>Desktop</name>
|
||||||
<description>Desktop.</description>
|
<description>Desktop.</description>
|
||||||
|
@ -114,20 +114,33 @@ class CompsFilterTest(unittest.TestCase):
|
|||||||
actual = f.read().strip()
|
actual = f.read().strip()
|
||||||
with open(filepath, 'r') as f:
|
with open(filepath, 'r') as f:
|
||||||
expected = f.read().strip()
|
expected = f.read().strip()
|
||||||
|
self.maxDiff = None
|
||||||
self.assertEqual(expected, actual)
|
self.assertEqual(expected, actual)
|
||||||
|
|
||||||
def test_filter_packages(self):
|
def test_filter_packages(self):
|
||||||
self.filter.filter_packages('ppc64le')
|
self.filter.filter_packages('ppc64le', None)
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-packages.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-packages.xml'))
|
||||||
|
|
||||||
|
def test_filter_packages_with_variant(self):
|
||||||
|
self.filter.filter_packages('ppc64le', 'Server')
|
||||||
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-packages-variant.xml'))
|
||||||
|
|
||||||
def test_filter_groups(self):
|
def test_filter_groups(self):
|
||||||
self.filter.filter_groups('ppc64le')
|
self.filter.filter_groups('ppc64le', None)
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-groups.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-groups.xml'))
|
||||||
|
|
||||||
|
def test_filter_groups_with_variant(self):
|
||||||
|
self.filter.filter_groups('ppc64le', 'Server')
|
||||||
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-groups-variant.xml'))
|
||||||
|
|
||||||
def test_filter_environments(self):
|
def test_filter_environments(self):
|
||||||
self.filter.filter_environments('ppc64le')
|
self.filter.filter_environments('ppc64le', None)
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-environments.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-environments.xml'))
|
||||||
|
|
||||||
|
def test_filter_environments_variant(self):
|
||||||
|
self.filter.filter_environments('ppc64le', 'Client')
|
||||||
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-filtered-environments-variant.xml'))
|
||||||
|
|
||||||
def test_remove_categories(self):
|
def test_remove_categories(self):
|
||||||
self.filter.remove_categories()
|
self.filter.remove_categories()
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-removed-categories.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-removed-categories.xml'))
|
||||||
@ -149,18 +162,18 @@ class CompsFilterTest(unittest.TestCase):
|
|||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup.xml'))
|
||||||
|
|
||||||
def test_cleanup_after_filter(self):
|
def test_cleanup_after_filter(self):
|
||||||
self.filter.filter_packages('ppc64le')
|
self.filter.filter_packages('ppc64le', None)
|
||||||
self.filter.cleanup()
|
self.filter.cleanup()
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup-filter.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup-filter.xml'))
|
||||||
|
|
||||||
def test_cleanup_after_filter_keep_group(self):
|
def test_cleanup_after_filter_keep_group(self):
|
||||||
self.filter.filter_packages('ppc64le')
|
self.filter.filter_packages('ppc64le', None)
|
||||||
self.filter.cleanup(['standard'])
|
self.filter.cleanup(['standard'])
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup-keep.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup-keep.xml'))
|
||||||
|
|
||||||
def test_cleanup_all(self):
|
def test_cleanup_all(self):
|
||||||
self.filter.filter_packages('ppc64le')
|
self.filter.filter_packages('ppc64le', None)
|
||||||
self.filter.filter_groups('ppc64le')
|
self.filter.filter_groups('ppc64le', None)
|
||||||
self.filter.filter_environments('ppc64le')
|
self.filter.filter_environments('ppc64le', None)
|
||||||
self.filter.cleanup()
|
self.filter.cleanup()
|
||||||
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup-all.xml'))
|
self.assertOutput(os.path.join(FIXTURE_DIR, 'comps-cleanup-all.xml'))
|
||||||
|
@ -206,6 +206,7 @@ class TestWriteVariantComps(PungiTestCase):
|
|||||||
self.assertEqual(run.mock_calls,
|
self.assertEqual(run.mock_calls,
|
||||||
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
||||||
'--keep-empty-group=conflicts-server',
|
'--keep-empty-group=conflicts-server',
|
||||||
|
'--variant=Server',
|
||||||
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
||||||
self.topdir + '/work/global/comps/comps-global.xml'])])
|
self.topdir + '/work/global/comps/comps-global.xml'])])
|
||||||
self.assertEqual(CompsWrapper.call_args_list,
|
self.assertEqual(CompsWrapper.call_args_list,
|
||||||
@ -230,6 +231,7 @@ class TestWriteVariantComps(PungiTestCase):
|
|||||||
self.assertEqual(run.mock_calls,
|
self.assertEqual(run.mock_calls,
|
||||||
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
||||||
'--keep-empty-group=conflicts-server',
|
'--keep-empty-group=conflicts-server',
|
||||||
|
'--variant=Server',
|
||||||
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
||||||
self.topdir + '/work/global/comps/comps-global.xml'])])
|
self.topdir + '/work/global/comps/comps-global.xml'])])
|
||||||
self.assertEqual(CompsWrapper.call_args_list,
|
self.assertEqual(CompsWrapper.call_args_list,
|
||||||
@ -255,6 +257,7 @@ class TestWriteVariantComps(PungiTestCase):
|
|||||||
self.assertEqual(run.mock_calls,
|
self.assertEqual(run.mock_calls,
|
||||||
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
||||||
'--keep-empty-group=conflicts-server',
|
'--keep-empty-group=conflicts-server',
|
||||||
|
'--variant=Server',
|
||||||
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
||||||
self.topdir + '/work/global/comps/comps-global.xml'])])
|
self.topdir + '/work/global/comps/comps-global.xml'])])
|
||||||
self.assertEqual(CompsWrapper.call_args_list,
|
self.assertEqual(CompsWrapper.call_args_list,
|
||||||
@ -278,6 +281,7 @@ class TestWriteVariantComps(PungiTestCase):
|
|||||||
self.assertEqual(run.mock_calls,
|
self.assertEqual(run.mock_calls,
|
||||||
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
[mock.call(['comps_filter', '--arch=x86_64', '--keep-empty-group=conflicts',
|
||||||
'--keep-empty-group=conflicts-server',
|
'--keep-empty-group=conflicts-server',
|
||||||
|
'--variant=Server',
|
||||||
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
'--output=%s/work/x86_64/comps/comps-Server.x86_64.xml' % self.topdir,
|
||||||
self.topdir + '/work/global/comps/comps-global.xml'])])
|
self.topdir + '/work/global/comps/comps-global.xml'])])
|
||||||
self.assertEqual(CompsWrapper.call_args_list,
|
self.assertEqual(CompsWrapper.call_args_list,
|
||||||
|
Loading…
Reference in New Issue
Block a user