From c80c85ea3da1705926067f53a576e05522d134b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Ravier?= Date: Thu, 19 May 2022 16:59:03 +0200 Subject: [PATCH] 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. --- comps-sync.py | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/comps-sync.py b/comps-sync.py index 4b9bfdb..0b3df3f 100755 --- a/comps-sync.py +++ b/comps-sync.py @@ -161,14 +161,23 @@ else: if (n_manifest_new > 0 or n_comps_new > 0) and args.save: 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 -for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', - 'lxqt-desktop', 'deepin-desktop', 'mate-desktop']: +for desktop, groups in desktops_comps_groups.items(): print() print("Syncing packages for {}:".format(desktop)) - manifest_path = '{}-pkgs.yaml'.format(desktop) - with open(manifest_path) as f: + manifest_path = '{}-desktop-pkgs.yaml'.format(desktop) + with open(manifest_path, encoding='UTF-8') as f: manifest = yaml.safe_load(f) manifest_packages = {} manifest_packages['all'] = set(manifest['packages']) @@ -182,15 +191,16 @@ for desktop in [ 'gnome-desktop', 'kde-desktop', 'xfce-desktop', comps_group_pkgs = {} for arch in ARCHES: filtered = comps.arch_filter([arch]) - for pkg in filtered.groups_match(id=desktop)[0].packages: - pkgname = pkg.name - exclude_list = comps_desktop_exclude_list.get(desktop, set()) - if pkgname in exclude_list or is_exclude_listed(pkgname): - continue - if pkgname in comps_group_pkgs: - comps_group_pkgs[pkgname].add(arch) - else: - comps_group_pkgs[pkgname] = set([arch]) + for group in groups: + for pkg in filtered.groups_match(id=group)[0].packages: + pkgname = pkg.name + exclude_list = comps_desktop_exclude_list.get(group, set()) + if pkgname in exclude_list or is_exclude_listed(pkgname): + continue + if pkgname in comps_group_pkgs: + comps_group_pkgs[pkgname].add(arch) + else: + comps_group_pkgs[pkgname] = set([arch]) comps_unknown = set() for arch in manifest_packages: