comps-sync.py: Support multiple comps groups for a desktop

Enable fetching packages from multiple comps groups for each desktop.
This is currently unused but this removes the constraints around having
all base packages for a given desktop in a single comps group.

This could also be used to get packages from other groups such as the
input-methods group for example.
This commit is contained in:
Timothée Ravier 2022-05-19 16:59:03 +02:00 committed by Aleksei Bavshin
parent d6de81bfc8
commit c80c85ea3d
No known key found for this signature in database
GPG key ID: 4F071603387A382A

View file

@ -161,14 +161,23 @@ else:
if (n_manifest_new > 0 or n_comps_new > 0) and args.save: if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
write_manifest(base_pkgs_path, manifest_packages) write_manifest(base_pkgs_path, manifest_packages)
# List of comps groups used for each desktop
desktops_comps_groups = {
"gnome": ["gnome-desktop"],
"kde": ["kde-desktop"],
"xfce": ["xfce-desktop"],
"lxqt": ["lxqt-desktop"],
"deepin": ["deepin-desktop"],
"mate": ["mate-desktop"]
}
# Generate treefiles for all desktops # Generate treefiles for all desktops
for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', for desktop, groups in desktops_comps_groups.items():
'lxqt-desktop', 'deepin-desktop', 'mate-desktop']:
print() print()
print("Syncing packages for {}:".format(desktop)) print("Syncing packages for {}:".format(desktop))
manifest_path = '{}-pkgs.yaml'.format(desktop) manifest_path = '{}-desktop-pkgs.yaml'.format(desktop)
with open(manifest_path) as f: with open(manifest_path, encoding='UTF-8') as f:
manifest = yaml.safe_load(f) manifest = yaml.safe_load(f)
manifest_packages = {} manifest_packages = {}
manifest_packages['all'] = set(manifest['packages']) manifest_packages['all'] = set(manifest['packages'])
@ -182,9 +191,10 @@ for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop',
comps_group_pkgs = {} comps_group_pkgs = {}
for arch in ARCHES: for arch in ARCHES:
filtered = comps.arch_filter([arch]) filtered = comps.arch_filter([arch])
for pkg in filtered.groups_match(id=desktop)[0].packages: for group in groups:
for pkg in filtered.groups_match(id=group)[0].packages:
pkgname = pkg.name pkgname = pkg.name
exclude_list = comps_desktop_exclude_list.get(desktop, set()) exclude_list = comps_desktop_exclude_list.get(group, set())
if pkgname in exclude_list or is_exclude_listed(pkgname): if pkgname in exclude_list or is_exclude_listed(pkgname):
continue continue
if pkgname in comps_group_pkgs: if pkgname in comps_group_pkgs: