2015-02-10 13:19:34 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; version 2 of the License.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Library General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2016-09-21 12:49:13 +00:00
|
|
|
# along with this program; if not, see <https://gnu.org/licenses/>.
|
2015-02-10 13:19:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
Get a package list based on comps.xml.
|
|
|
|
|
|
|
|
Input format:
|
|
|
|
see comps.dtd
|
|
|
|
|
|
|
|
Output:
|
|
|
|
set([(rpm_name, rpm_arch or None)])
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
2015-03-12 21:12:38 +00:00
|
|
|
from pungi.wrappers.comps import CompsWrapper
|
|
|
|
import pungi.phases.gather.source
|
2015-02-10 13:19:34 +00:00
|
|
|
|
|
|
|
|
2015-03-12 21:12:38 +00:00
|
|
|
class GatherSourceComps(pungi.phases.gather.source.GatherSourceBase):
|
2015-02-10 13:19:34 +00:00
|
|
|
enabled = True
|
|
|
|
|
|
|
|
def __call__(self, arch, variant):
|
|
|
|
groups = set()
|
2017-11-15 15:20:18 +00:00
|
|
|
if not self.compose.conf.get('comps_file'):
|
|
|
|
return set(), set()
|
|
|
|
|
2015-02-10 13:19:34 +00:00
|
|
|
comps = CompsWrapper(self.compose.paths.work.comps(arch=arch))
|
|
|
|
|
2017-02-27 11:48:06 +00:00
|
|
|
if variant is not None and (variant.groups or variant.type != 'variant'):
|
|
|
|
# Get packages for a particular variant. We want to skip the
|
|
|
|
# filtering if the variant is top-level and has no groups (to use
|
|
|
|
# all of them).
|
|
|
|
# For optional we always want to filter (and parent groups will be
|
|
|
|
# added later), for addons and layered products it makes no sense
|
|
|
|
# for the groups to be empty in the first place.
|
2015-02-10 13:19:34 +00:00
|
|
|
comps.filter_groups(variant.groups)
|
|
|
|
|
|
|
|
for i in comps.get_comps_groups():
|
2017-04-12 08:43:24 +00:00
|
|
|
groups.add(i)
|
2015-02-10 13:19:34 +00:00
|
|
|
return set(), groups
|