From afdf98e97ae21e582551fe0f0f7b46faca7a0a34 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 26 2023 14:43:56 +0000
Subject: [PATCH 1/14] comps-sync f40 2023-09-26


---

diff --git a/cinnamon-desktop-pkgs.yaml b/cinnamon-desktop-pkgs.yaml
index 0d42b3a..4c94c90 100644
--- a/cinnamon-desktop-pkgs.yaml
+++ b/cinnamon-desktop-pkgs.yaml
@@ -45,6 +45,7 @@ packages:
   - slick-greeter
   - slick-greeter-cinnamon
   - system-config-printer
+  - totem-video-thumbnailer
   - wireplumber
   - xawtv
   - xdg-user-dirs-gtk
diff --git a/kde-desktop-pkgs.yaml b/kde-desktop-pkgs.yaml
index 2bd7962..f1df9db 100644
--- a/kde-desktop-pkgs.yaml
+++ b/kde-desktop-pkgs.yaml
@@ -49,6 +49,7 @@ packages:
   - libappindicator-gtk3
   - mesa-dri-drivers
   - mesa-vulkan-drivers
+  - orca
   - pam-kwallet
   - phonon-qt5-backend-gstreamer
   - pinentry-qt

From e00b1c88fe3c9cb6e713ad9b93a911248df19437 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 08:41:44 +0000
Subject: [PATCH 2/14] comps-sync.py: Factor package manifest loading code


---

diff --git a/comps-sync.py b/comps-sync.py
index 4baf160..22541c2 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -51,6 +51,19 @@ def is_exclude_listed(pkgname):
             return True
     return False
 
+def load_packages_from_manifest(manifest_path):
+    '''Load the list of packages from an rpm-ostree manifest file.'''
+    with open(manifest_path, encoding='UTF-8') as f:
+        manifest = yaml.safe_load(f)
+    manifest_packages = {}
+    manifest_packages['all'] = set(manifest['packages'])
+    for arch in ARCHES:
+        if f'packages-{arch}' in manifest:
+            manifest_packages[arch] = set(manifest[f'packages-{arch}'])
+        else:
+            manifest_packages[arch] = set()
+    return manifest_packages
+
 parser = argparse.ArgumentParser()
 parser.add_argument("--save", help="Write changes", action='store_true')
 parser.add_argument("src", help="Source path")
@@ -59,16 +72,8 @@ args = parser.parse_args()
 
 print("Syncing packages common to all desktops:")
 
-base_pkgs_path = 'fedora-common-ostree-pkgs.yaml'
-with open(base_pkgs_path, encoding='UTF-8') as f:
-    manifest = yaml.safe_load(f)
-manifest_packages = {}
-manifest_packages['all'] = set(manifest['packages'])
-for arch in ARCHES:
-    if f'packages-{arch}' in manifest:
-        manifest_packages[arch] = set(manifest[f'packages-{arch}'])
-    else:
-        manifest_packages[arch] = set()
+manifest_path = 'fedora-common-ostree-pkgs.yaml'
+manifest_packages = load_packages_from_manifest(manifest_path)
 
 with open('comps-sync-exclude-list.yml', encoding='UTF-8') as f:
     doc = yaml.safe_load(f)
@@ -167,7 +172,7 @@ else:
         print('    {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
 
 if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
-    write_manifest(base_pkgs_path, manifest_packages)
+    write_manifest(manifest_path, manifest_packages)
 
 # List of comps groups used for each desktop
 desktops_comps_groups = {
@@ -188,15 +193,7 @@ for desktop, groups in desktops_comps_groups.items():
     print(f'Syncing packages for {desktop}:')
 
     manifest_path = f'{desktop}-desktop-pkgs.yaml'
-    with open(manifest_path, encoding='UTF-8') as f:
-        manifest = yaml.safe_load(f)
-    manifest_packages = {}
-    manifest_packages['all'] = set(manifest['packages'])
-    for arch in ARCHES:
-        if f'packages-{arch}' in manifest:
-            manifest_packages[arch] = set(manifest[f'packages-{arch}'])
-        else:
-            manifest_packages[arch] = set()
+    manifest_packages = load_packages_from_manifest(manifest_path)
 
     # Filter packages in the comps desktop group using the exclude_list
     comps_group_pkgs = {}

From dd8dd4c80406ef4017bee2e9c4d657cc1a7dd719 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 08:41:44 +0000
Subject: [PATCH 3/14] comps-sync.py: Pass regexp exclude list to is_exclude_listed


---

diff --git a/comps-sync.py b/comps-sync.py
index 22541c2..93c51cb 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -44,9 +44,9 @@ def write_manifest(fpath, pkgs, include=None):
                     f.write(f'  - {pkg}\n')
         print(f'Wrote {fpath}')
 
-def is_exclude_listed(pkgname):
+def is_exclude_listed(pkgname, exclude_list_regexp):
     '''Check if pkgname is in the exclude list.'''
-    for br in comps_exclude_list_all:
+    for br in exclude_list_regexp:
         if br.match(pkgname):
             return True
     return False
@@ -120,7 +120,7 @@ for gid in ws_environ.group_ids:
 
 ws_ostree_pkgs = set()
 for pkg in comps.groups_match(id=ws_ostree_name)[0].packages:
-    if not is_exclude_listed(pkg.name):
+    if not is_exclude_listed(pkg.name, comps_exclude_list_all):
         ws_ostree_pkgs.add(pkg.name)
 
 comps_unknown = set()
@@ -203,7 +203,7 @@ for desktop, groups in desktops_comps_groups.items():
             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):
+                if pkgname in exclude_list or is_exclude_listed(pkgname, comps_exclude_list_all):
                     continue
                 if pkgname in comps_group_pkgs:
                     comps_group_pkgs[pkgname].add(arch)

From 62b98b69038f4bcc1d3fb759d9c00298c1d9c937 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 08:53:32 +0000
Subject: [PATCH 4/14] comps-sync.py: Factor load_packages_from_comps_group


---

diff --git a/comps-sync.py b/comps-sync.py
index 93c51cb..c94ec95 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -64,6 +64,28 @@ def load_packages_from_manifest(manifest_path):
             manifest_packages[arch] = set()
     return manifest_packages
 
+def load_packages_from_comps_group(comps_group_packages, comps, groupname, exclude_list, exclude_list_regexp):
+    '''Load packages from a comps group, storing the group, type and arches.'''
+    for arch in ARCHES:
+        filtered = comps.arch_filter([arch])
+        group = filtered.groups_match(id=groupname)[0]
+        for pkg in group.packages:
+            pkgname = pkg.name
+            if pkg.type not in (libcomps.PACKAGE_TYPE_DEFAULT,
+                                libcomps.PACKAGE_TYPE_MANDATORY):
+                continue
+            if pkgname in exclude_list or is_exclude_listed(pkgname, exclude_list_regexp):
+                continue
+            pkgdata = comps_group_packages.get(pkgname)
+            if pkgdata is None:
+                comps_group_packages[pkgname] = pkgdata = (pkg.type, set([groupname]), set([arch]))
+            if (pkgdata[0] == libcomps.PACKAGE_TYPE_DEFAULT and
+                pkg.type == libcomps.PACKAGE_TYPE_MANDATORY):
+                comps_group_packages[pkgname] = pkgdata = (pkg.type, pkgdata[1], pkgdata[2])
+            pkgdata[1].add(groupname)
+            pkgdata[2].add(arch)
+    return comps_group_packages
+
 parser = argparse.ArgumentParser()
 parser.add_argument("--save", help="Write changes", action='store_true')
 parser.add_argument("src", help="Source path")
@@ -99,24 +121,7 @@ for gid in ws_environ.group_ids:
     if gid.name in comps_exclude_list_groups:
         continue
     exclude_list = comps_exclude_list.get(gid.name, set())
-    for arch in ARCHES:
-        filtered = comps.arch_filter([arch])
-        group = filtered.groups_match(id=gid.name)[0]
-        for pkg in group.packages:
-            pkgname = pkg.name
-            if pkg.type not in (libcomps.PACKAGE_TYPE_DEFAULT,
-                                libcomps.PACKAGE_TYPE_MANDATORY):
-                continue
-            if pkgname in exclude_list or is_exclude_listed(pkgname):
-                continue
-            pkgdata = ws_pkgs.get(pkgname)
-            if pkgdata is None:
-                ws_pkgs[pkgname] = pkgdata = (pkg.type, set([gid.name]), set([arch]))
-            if (pkgdata[0] == libcomps.PACKAGE_TYPE_DEFAULT and
-                pkg.type == libcomps.PACKAGE_TYPE_MANDATORY):
-                ws_pkgs[pkgname] = pkgdata = (pkg.type, pkgdata[1], pkgdata[2])
-            pkgdata[1].add(gid.name)
-            pkgdata[2].add(arch)
+    ws_pkgs = load_packages_from_comps_group(ws_pkgs, comps, gid.name, exclude_list, comps_exclude_list_all)
 
 ws_ostree_pkgs = set()
 for pkg in comps.groups_match(id=ws_ostree_name)[0].packages:

From cf4dcc72061908568fe6fa66f776512429c9c6b8 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 08:53:32 +0000
Subject: [PATCH 5/14] comps-sync.py: Unify group loading logic


---

diff --git a/comps-sync.py b/comps-sync.py
index c94ec95..1b14b08 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -123,10 +123,8 @@ for gid in ws_environ.group_ids:
     exclude_list = comps_exclude_list.get(gid.name, set())
     ws_pkgs = load_packages_from_comps_group(ws_pkgs, comps, gid.name, exclude_list, comps_exclude_list_all)
 
-ws_ostree_pkgs = set()
-for pkg in comps.groups_match(id=ws_ostree_name)[0].packages:
-    if not is_exclude_listed(pkg.name, comps_exclude_list_all):
-        ws_ostree_pkgs.add(pkg.name)
+exclude_list = comps_exclude_list.get(ws_ostree_name, set())
+ws_pkgs = load_packages_from_comps_group(ws_pkgs, comps, ws_ostree_name, exclude_list, comps_exclude_list_all)
 
 comps_unknown = set()
 for arch in manifest_packages:
@@ -137,8 +135,7 @@ for arch in manifest_packages:
         else:
             if pkg in ws_pkgs and arch in ws_pkgs[pkg][2]:
                 continue
-        if (pkg not in comps_include_list and
-            pkg not in ws_ostree_pkgs):
+        if (pkg not in comps_include_list):
             comps_unknown.add((pkg, arch))
 
 # Look for packages in the manifest but not in comps at all
diff --git a/fedora-common-ostree-pkgs.yaml b/fedora-common-ostree-pkgs.yaml
index 00a3128..34a6717 100644
--- a/fedora-common-ostree-pkgs.yaml
+++ b/fedora-common-ostree-pkgs.yaml
@@ -119,6 +119,7 @@ packages:
   - opensc
   - openssh-clients
   - openssh-server
+  - ostree-grub2
   - pam_afs_session
   - paps
   - passwd
@@ -147,6 +148,7 @@ packages:
   - realtek-firmware
   - rootfiles
   - rpm
+  - rpm-ostree
   - rsync
   - samba-client
   - selinux-policy-targeted
diff --git a/fedora-common-ostree.yaml b/fedora-common-ostree.yaml
index 5ddaae2..524e0b0 100644
--- a/fedora-common-ostree.yaml
+++ b/fedora-common-ostree.yaml
@@ -22,7 +22,6 @@ packages:
   # Explicitely add Git docs
   - git-core-doc
   - lvm2
-  - rpm-ostree
   # Required for compatibility with old bootloaders until we have bootupd
   # See https://github.com/fedora-silverblue/issue-tracker/issues/120
   - ostree-grub2

From 06fcdac6f3262bfd6b73e7db455f381d88313aff Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 6/14] comps-sync.py: Remove special case for kernel packages


---

diff --git a/comps-sync-exclude-list.yml b/comps-sync-exclude-list.yml
index 699b956..3e68bf7 100644
--- a/comps-sync-exclude-list.yml
+++ b/comps-sync-exclude-list.yml
@@ -1,12 +1,6 @@
 # This file has a list of packages to skip from comps that we don't want, plus
 # a few include listed things.
 
-# For some reason today these are just in livecd-tools...
-include_list:
-  - kernel
-  - kernel-modules
-  - kernel-modules-extra
-
 # Entirely skip all packages in libreoffice
 exclude_list_groups:
   - libreoffice
diff --git a/comps-sync.py b/comps-sync.py
index 1b14b08..7c236de 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -100,7 +100,6 @@ manifest_packages = load_packages_from_manifest(manifest_path)
 with open('comps-sync-exclude-list.yml', encoding='UTF-8') as f:
     doc = yaml.safe_load(f)
     comps_exclude_list = doc['exclude_list']
-    comps_include_list = doc['include_list']
     comps_exclude_list_groups = doc['exclude_list_groups']
     comps_desktop_exclude_list = doc['desktop_exclude_list']
     comps_exclude_list_all = [re.compile(x) for x in doc['exclude_list_all_regexp']]
@@ -135,8 +134,7 @@ for arch in manifest_packages:
         else:
             if pkg in ws_pkgs and arch in ws_pkgs[pkg][2]:
                 continue
-        if (pkg not in comps_include_list):
-            comps_unknown.add((pkg, arch))
+        comps_unknown.add((pkg, arch))
 
 # Look for packages in the manifest but not in comps at all
 n_manifest_new = len(comps_unknown)
diff --git a/fedora-common-ostree-pkgs.yaml b/fedora-common-ostree-pkgs.yaml
index 34a6717..9dde184 100644
--- a/fedora-common-ostree-pkgs.yaml
+++ b/fedora-common-ostree-pkgs.yaml
@@ -95,8 +95,6 @@ packages:
   - iwlwifi-dvm-firmware
   - iwlwifi-mvm-firmware
   - kbd
-  - kernel
-  - kernel-modules-extra
   - less
   - libertas-firmware
   - libglvnd-gles
diff --git a/fedora-common-ostree.yaml b/fedora-common-ostree.yaml
index 524e0b0..a94de60 100644
--- a/fedora-common-ostree.yaml
+++ b/fedora-common-ostree.yaml
@@ -17,6 +17,10 @@ include: fedora-common-ostree-pkgs.yaml
 #   aarch64: bootupd.yaml
 
 packages:
+  # Ensure that we have a kernel. Kernel packages are not in any comps group
+  - kernel
+  - kernel-modules
+  - kernel-modules-extra
   # Do not include "full" Git as it brings in Perl
   - git-core
   # Explicitely add Git docs

From 044096449cce823eacf415a1c6469d987f7330a6 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 7/14] comps-sync.py: Factor manifest/comps lists comparison


Also improve the format of the package diff.

---

diff --git a/comps-sync.py b/comps-sync.py
index 7c236de..a414278 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -86,14 +86,42 @@ def load_packages_from_comps_group(comps_group_packages, comps, groupname, exclu
             pkgdata[2].add(arch)
     return comps_group_packages
 
+def compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages):
+    '''Compare the list of packages in the comps and the manifests and return the difference.'''
+    # Look for packages in the manifest but not in the comps
+    comps_unknown = set()
+    for arch in manifest_packages:
+        for pkg in manifest_packages[arch]:
+            if arch == "all":
+                if pkg in comps_group_pkgs and set(comps_group_pkgs[pkg][2]) == set(ARCHES):
+                    continue
+            else:
+                if pkg in comps_group_pkgs and arch in comps_group_pkgs[pkg][2]:
+                    continue
+            comps_unknown.add((pkg, arch))
+
+    # Look for packages in comps but not in the manifest
+    pkgs_added = {}
+    for (pkg, pkgdata) in comps_group_pkgs.items():
+        if set(ARCHES) == set(pkgdata[2]):
+            if pkg not in manifest_packages['all']:
+                pkgs_added[pkg] = pkgdata
+        else:
+            for arch in pkgdata[2]:
+                if pkg not in manifest_packages[arch]:
+                    if pkg not in pkgs_added:
+                        pkgs_added[pkg] = (pkgdata[0], pkgdata[1], set([arch]))
+                    else:
+                        pkgs_added[pkg][2].add(arch)
+
+    return comps_unknown, pkgs_added
+
 parser = argparse.ArgumentParser()
 parser.add_argument("--save", help="Write changes", action='store_true')
 parser.add_argument("src", help="Source path")
 
 args = parser.parse_args()
 
-print("Syncing packages common to all desktops:")
-
 manifest_path = 'fedora-common-ostree-pkgs.yaml'
 manifest_packages = load_packages_from_manifest(manifest_path)
 
@@ -125,51 +153,25 @@ for gid in ws_environ.group_ids:
 exclude_list = comps_exclude_list.get(ws_ostree_name, set())
 ws_pkgs = load_packages_from_comps_group(ws_pkgs, comps, ws_ostree_name, exclude_list, comps_exclude_list_all)
 
-comps_unknown = set()
-for arch in manifest_packages:
-    for pkg in manifest_packages[arch]:
-        if arch == "all":
-            if pkg in ws_pkgs and set(ws_pkgs[pkg][2]) == set(ARCHES):
-                continue
-        else:
-            if pkg in ws_pkgs and arch in ws_pkgs[pkg][2]:
-                continue
-        comps_unknown.add((pkg, arch))
+(comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(ws_pkgs, manifest_packages)
 
-# Look for packages in the manifest but not in comps at all
 n_manifest_new = len(comps_unknown)
-if n_manifest_new == 0:
-    print("  - All manifest packages are already listed in comps.")
-else:
-    print(f'  - {n_manifest_new} packages not in {ws_env_name}:')
+n_comps_new = len(pkgs_added)
+print(f'Syncing common packages:\t+{n_comps_new}, -{n_manifest_new}')
+if n_manifest_new != 0:
     for (pkg, arch) in sorted(comps_unknown, key = lambda x: x[0]):
-        print(f'    {pkg} (arch: {arch})')
         manifest_packages[arch].remove(pkg)
-
-# Look for packages in workstation but not in the manifest
-ws_added = {}
-for (pkg,data) in ws_pkgs.items():
-    if set(ARCHES) == set(data[2]):
-        if pkg not in manifest_packages['all']:
-            ws_added[pkg] = data
+        print(f'  - {pkg} (arches: {arch})')
+if n_comps_new != 0:
+    for pkg in sorted(pkgs_added):
+        (req, groups, arches) = pkgs_added[pkg]
+        if set(ARCHES) == arches:
             manifest_packages['all'].add(pkg)
-    else:
-        for arch in data[2]:
-            if pkg not in manifest_packages[arch]:
+            print('  + {} ({}, groups: {}, arches: all)'.format(pkg, format_pkgtype(req), ', '.join(groups)))
+        else:
+            for arch in arches:
                 manifest_packages[arch].add(pkg)
-                if pkg not in ws_added:
-                    ws_added[pkg] = (data[0], data[1], set([arch]))
-                else:
-                    ws_added[pkg][2].add(arch)
-
-n_comps_new = len(ws_added)
-if n_comps_new == 0:
-    print("  - All comps packages are already listed in manifest.")
-else:
-    print(f'  - {n_comps_new} packages not in manifest:')
-    for pkg in sorted(ws_added):
-        (req, groups, arches) = ws_added[pkg]
-        print('    {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
+            print('  + {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
 
 if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
     write_manifest(manifest_path, manifest_packages)

From db352bcf69a2384c9e2a5323316ec95970880743 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 8/14] comps-sync.py: Use new functions for desktop specific manifests


---

diff --git a/comps-sync.py b/comps-sync.py
index a414278..8797346 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -192,72 +192,34 @@ desktops_comps_groups = {
 # Generate treefiles for all desktops
 for desktop, groups in desktops_comps_groups.items():
     print()
-    print(f'Syncing packages for {desktop}:')
 
     manifest_path = f'{desktop}-desktop-pkgs.yaml'
     manifest_packages = load_packages_from_manifest(manifest_path)
 
-    # Filter packages in the comps desktop group using the exclude_list
     comps_group_pkgs = {}
-    for arch in ARCHES:
-        filtered = comps.arch_filter([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, comps_exclude_list_all):
-                    continue
-                if pkgname in comps_group_pkgs:
-                    comps_group_pkgs[pkgname].add(arch)
-                else:
-                    comps_group_pkgs[pkgname] = set([arch])
+    for group in groups:
+        exclude_list = comps_desktop_exclude_list.get(group, set())
+        comps_group_pkgs = load_packages_from_comps_group(comps_group_pkgs, comps, group, exclude_list, comps_exclude_list_all)
 
-    comps_unknown = set()
-    for arch in manifest_packages:
-        for pkg in manifest_packages[arch]:
-            if arch == "all":
-                if pkg in comps_group_pkgs and set(comps_group_pkgs[pkg]) == set(ARCHES):
-                    continue
-            else:
-                if pkg in comps_group_pkgs and arch in comps_group_pkgs[pkg]:
-                    continue
-            comps_unknown.add((pkg, arch))
+    (comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages)
 
-    # Look for packages in the manifest but not in comps at all
     n_manifest_new = len(comps_unknown)
-    if n_manifest_new == 0:
-        print("  - All manifest packages are already listed in comps.")
-    else:
-        print(f'  - {n_manifest_new} packages not in {ws_env_name}:')
+    n_comps_new = len(pkgs_added)
+    print(f'Syncing packages for {desktop}:\t+{n_comps_new}, -{n_manifest_new}')
+    if n_manifest_new != 0:
         for (pkg, arch) in sorted(comps_unknown, key = lambda x: x[0]):
-            print(f'    {pkg} (arch: {arch})')
             manifest_packages[arch].remove(pkg)
-
-
-    # Look for packages in comps but not in the manifest
-    desktop_pkgs_added = {}
-    for (pkg, parches) in comps_group_pkgs.items():
-        if set(ARCHES) == set(parches):
-            if pkg not in manifest_packages['all']:
-                desktop_pkgs_added[pkg] = parches
+            print(f'  - {pkg} (arches: {arch})')
+    if n_comps_new != 0:
+        for pkg in sorted(pkgs_added):
+            (req, groups, arches) = pkgs_added[pkg]
+            if set(ARCHES) == arches:
                 manifest_packages['all'].add(pkg)
-        else:
-            for arch in parches:
-                if pkg not in manifest_packages[arch]:
+                print('  + {} ({}, groups: {}, arches: all)'.format(pkg, format_pkgtype(req), ', '.join(groups)))
+            else:
+                for arch in arches:
                     manifest_packages[arch].add(pkg)
-                    if pkg not in desktop_pkgs_added:
-                        desktop_pkgs_added[pkg] = set([arch])
-                    else:
-                        desktop_pkgs_added[pkg].add(arch)
-
-    n_comps_new = len(desktop_pkgs_added)
-    if n_comps_new == 0:
-        print("  - All comps packages are already listed in manifest.")
-    else:
-        print(f'  - {n_comps_new} packages not in {desktop} manifest:')
-        for pkg in sorted(desktop_pkgs_added):
-            arches = desktop_pkgs_added[pkg]
-            print('    {} (arches: {})'.format(pkg, ', '.join(arches)))
+                print('  + {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
 
     # Update manifest
     if (n_manifest_new > 0 or n_comps_new > 0) and args.save:

From ffdc9c4f77308ac7118a41b5fa7cda2a789f020a Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 9/14] comps-sync.py: Clarify the groups we get packages from


---

diff --git a/comps-sync.py b/comps-sync.py
index 8797346..e6ef668 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -132,28 +132,29 @@ with open('comps-sync-exclude-list.yml', encoding='UTF-8') as f:
     comps_desktop_exclude_list = doc['desktop_exclude_list']
     comps_exclude_list_all = [re.compile(x) for x in doc['exclude_list_all_regexp']]
 
-# Parse comps, and build up a set of all packages so we
-# can find packages not listed in comps *at all*, beyond
-# just the workstation environment.
+# Parse comps, and build up a set of all packages so we can find packages not
+# listed in comps *at all*, beyond just the workstation environment.
 comps = libcomps.Comps()
 comps.fromxml_f(args.src)
 
-# Parse the workstation-product environment, gathering
-# default or mandatory packages.
-ws_env_name = 'workstation-product-environment'
-ws_ostree_name = 'workstation-ostree-support'
-ws_environ = comps.environments[ws_env_name]
-ws_pkgs = {}
-for gid in ws_environ.group_ids:
+# Parse the workstation-product environment to get the list of comps groups to
+# get packages from.
+groups = []
+for gid in comps.environments['workstation-product-environment'].group_ids:
     if gid.name in comps_exclude_list_groups:
         continue
-    exclude_list = comps_exclude_list.get(gid.name, set())
-    ws_pkgs = load_packages_from_comps_group(ws_pkgs, comps, gid.name, exclude_list, comps_exclude_list_all)
+    groups.append(gid.name)
 
-exclude_list = comps_exclude_list.get(ws_ostree_name, set())
-ws_pkgs = load_packages_from_comps_group(ws_pkgs, comps, ws_ostree_name, exclude_list, comps_exclude_list_all)
+# Always include the packages from the workstation-ostree-support group
+groups.append('workstation-ostree-support')
 
-(comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(ws_pkgs, manifest_packages)
+# Get the packages from those groups, filtering the ones we don't need
+comps_group_pkgs = {}
+for group in groups:
+    exclude_list = comps_exclude_list.get(group, set())
+    comps_group_pkgs = load_packages_from_comps_group(comps_group_pkgs, comps, group, exclude_list, comps_exclude_list_all)
+
+(comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages)
 
 n_manifest_new = len(comps_unknown)
 n_comps_new = len(pkgs_added)

From 4ca120676a2dd0f61e62117fedcedc8c340455d4 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 10/14] comps-sync.py: Factor the manifest update


---

diff --git a/comps-sync.py b/comps-sync.py
index e6ef668..1eb9bce 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -116,15 +116,50 @@ def compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages):
 
     return comps_unknown, pkgs_added
 
+def update_manifests_from_groups(comps, groups, path, desktop, save, comps_exclude_list, comps_exclude_list_all):
+    manifest_packages = load_packages_from_manifest(path)
+
+    comps_group_pkgs = {}
+    for group in groups:
+        exclude_list = comps_exclude_list.get(group, set())
+        comps_group_pkgs = load_packages_from_comps_group(comps_group_pkgs, comps, group, exclude_list, comps_exclude_list_all)
+
+    (comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages)
+
+    n_manifest_new = len(comps_unknown)
+    n_comps_new = len(pkgs_added)
+
+    if desktop == "common":
+        print(f'Syncing common packages:\t+{n_comps_new}, -{n_manifest_new}')
+    else:
+        print(f'Syncing packages for {desktop}:\t+{n_comps_new}, -{n_manifest_new}')
+    if n_manifest_new != 0:
+        for (pkg, arch) in sorted(comps_unknown, key = lambda x: x[0]):
+            manifest_packages[arch].remove(pkg)
+            print(f'  - {pkg} (arches: {arch})')
+    if n_comps_new != 0:
+        for pkg in sorted(pkgs_added):
+            (req, groups, arches) = pkgs_added[pkg]
+            if set(ARCHES) == arches:
+                manifest_packages['all'].add(pkg)
+                print('  + {} ({}, groups: {}, arches: all)'.format(pkg, format_pkgtype(req), ', '.join(groups)))
+            else:
+                for arch in arches:
+                    manifest_packages[arch].add(pkg)
+                print('  + {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
+
+    if (n_manifest_new > 0 or n_comps_new > 0) and save:
+        if desktop == "common":
+            write_manifest(path, manifest_packages)
+        else:
+            write_manifest(path, manifest_packages, include="fedora-common-ostree.yaml")
+
 parser = argparse.ArgumentParser()
 parser.add_argument("--save", help="Write changes", action='store_true')
 parser.add_argument("src", help="Source path")
 
 args = parser.parse_args()
 
-manifest_path = 'fedora-common-ostree-pkgs.yaml'
-manifest_packages = load_packages_from_manifest(manifest_path)
-
 with open('comps-sync-exclude-list.yml', encoding='UTF-8') as f:
     doc = yaml.safe_load(f)
     comps_exclude_list = doc['exclude_list']
@@ -148,34 +183,7 @@ for gid in comps.environments['workstation-product-environment'].group_ids:
 # Always include the packages from the workstation-ostree-support group
 groups.append('workstation-ostree-support')
 
-# Get the packages from those groups, filtering the ones we don't need
-comps_group_pkgs = {}
-for group in groups:
-    exclude_list = comps_exclude_list.get(group, set())
-    comps_group_pkgs = load_packages_from_comps_group(comps_group_pkgs, comps, group, exclude_list, comps_exclude_list_all)
-
-(comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages)
-
-n_manifest_new = len(comps_unknown)
-n_comps_new = len(pkgs_added)
-print(f'Syncing common packages:\t+{n_comps_new}, -{n_manifest_new}')
-if n_manifest_new != 0:
-    for (pkg, arch) in sorted(comps_unknown, key = lambda x: x[0]):
-        manifest_packages[arch].remove(pkg)
-        print(f'  - {pkg} (arches: {arch})')
-if n_comps_new != 0:
-    for pkg in sorted(pkgs_added):
-        (req, groups, arches) = pkgs_added[pkg]
-        if set(ARCHES) == arches:
-            manifest_packages['all'].add(pkg)
-            print('  + {} ({}, groups: {}, arches: all)'.format(pkg, format_pkgtype(req), ', '.join(groups)))
-        else:
-            for arch in arches:
-                manifest_packages[arch].add(pkg)
-            print('  + {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
-
-if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
-    write_manifest(manifest_path, manifest_packages)
+update_manifests_from_groups(comps, groups, 'fedora-common-ostree-pkgs.yaml', "common", args.save, comps_exclude_list, comps_exclude_list_all)
 
 # List of comps groups used for each desktop
 desktops_comps_groups = {
@@ -193,35 +201,4 @@ desktops_comps_groups = {
 # Generate treefiles for all desktops
 for desktop, groups in desktops_comps_groups.items():
     print()
-
-    manifest_path = f'{desktop}-desktop-pkgs.yaml'
-    manifest_packages = load_packages_from_manifest(manifest_path)
-
-    comps_group_pkgs = {}
-    for group in groups:
-        exclude_list = comps_desktop_exclude_list.get(group, set())
-        comps_group_pkgs = load_packages_from_comps_group(comps_group_pkgs, comps, group, exclude_list, comps_exclude_list_all)
-
-    (comps_unknown, pkgs_added) = compare_comps_manifest_package_lists(comps_group_pkgs, manifest_packages)
-
-    n_manifest_new = len(comps_unknown)
-    n_comps_new = len(pkgs_added)
-    print(f'Syncing packages for {desktop}:\t+{n_comps_new}, -{n_manifest_new}')
-    if n_manifest_new != 0:
-        for (pkg, arch) in sorted(comps_unknown, key = lambda x: x[0]):
-            manifest_packages[arch].remove(pkg)
-            print(f'  - {pkg} (arches: {arch})')
-    if n_comps_new != 0:
-        for pkg in sorted(pkgs_added):
-            (req, groups, arches) = pkgs_added[pkg]
-            if set(ARCHES) == arches:
-                manifest_packages['all'].add(pkg)
-                print('  + {} ({}, groups: {}, arches: all)'.format(pkg, format_pkgtype(req), ', '.join(groups)))
-            else:
-                for arch in arches:
-                    manifest_packages[arch].add(pkg)
-                print('  + {} ({}, groups: {}, arches: {})'.format(pkg, format_pkgtype(req), ', '.join(groups), ', '.join(arches)))
-
-    # Update manifest
-    if (n_manifest_new > 0 or n_comps_new > 0) and args.save:
-        write_manifest(manifest_path, manifest_packages, include="fedora-common-ostree.yaml")
+    update_manifests_from_groups(comps, groups, f'{desktop}-desktop-pkgs.yaml', desktop, args.save, comps_desktop_exclude_list, comps_exclude_list_all)

From fd1056f739a38f96c7fdd0d11614d7dd151e1357 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 11/14] comps-sync.py: Move code under main function


---

diff --git a/comps-sync.py b/comps-sync.py
index 1eb9bce..9170bb9 100755
--- a/comps-sync.py
+++ b/comps-sync.py
@@ -154,51 +154,55 @@ def update_manifests_from_groups(comps, groups, path, desktop, save, comps_exclu
         else:
             write_manifest(path, manifest_packages, include="fedora-common-ostree.yaml")
 
-parser = argparse.ArgumentParser()
-parser.add_argument("--save", help="Write changes", action='store_true')
-parser.add_argument("src", help="Source path")
-
-args = parser.parse_args()
-
-with open('comps-sync-exclude-list.yml', encoding='UTF-8') as f:
-    doc = yaml.safe_load(f)
-    comps_exclude_list = doc['exclude_list']
-    comps_exclude_list_groups = doc['exclude_list_groups']
-    comps_desktop_exclude_list = doc['desktop_exclude_list']
-    comps_exclude_list_all = [re.compile(x) for x in doc['exclude_list_all_regexp']]
-
-# Parse comps, and build up a set of all packages so we can find packages not
-# listed in comps *at all*, beyond just the workstation environment.
-comps = libcomps.Comps()
-comps.fromxml_f(args.src)
-
-# Parse the workstation-product environment to get the list of comps groups to
-# get packages from.
-groups = []
-for gid in comps.environments['workstation-product-environment'].group_ids:
-    if gid.name in comps_exclude_list_groups:
-        continue
-    groups.append(gid.name)
-
-# Always include the packages from the workstation-ostree-support group
-groups.append('workstation-ostree-support')
-
-update_manifests_from_groups(comps, groups, 'fedora-common-ostree-pkgs.yaml', "common", args.save, comps_exclude_list, comps_exclude_list_all)
-
-# List of comps groups used for each desktop
-desktops_comps_groups = {
-    "gnome": ["gnome-desktop", "base-x"],
-    "kde": ["kde-desktop", "base-x"],
-    "xfce": ["xfce-desktop", "base-x"],
-    "lxqt": ["lxqt-desktop", "base-x"],
-    "deepin": ["deepin-desktop", "base-x"],
-    "mate": ["mate-desktop", "base-x"],
-    "sway": ["swaywm", "swaywm-extended"],
-    "cinnamon": ["cinnamon-desktop", "base-x"],
-    "budgie": ["budgie-desktop", "budgie-desktop-apps", "base-x"]
-}
-
-# Generate treefiles for all desktops
-for desktop, groups in desktops_comps_groups.items():
-    print()
-    update_manifests_from_groups(comps, groups, f'{desktop}-desktop-pkgs.yaml', desktop, args.save, comps_desktop_exclude_list, comps_exclude_list_all)
+def main():
+    parser = argparse.ArgumentParser()
+    parser.add_argument("--save", help="Write changes", action='store_true')
+    parser.add_argument("src", help="Source path")
+
+    args = parser.parse_args()
+
+    with open('comps-sync-exclude-list.yml', encoding='UTF-8') as f:
+        doc = yaml.safe_load(f)
+        comps_exclude_list = doc['exclude_list']
+        comps_exclude_list_groups = doc['exclude_list_groups']
+        comps_desktop_exclude_list = doc['desktop_exclude_list']
+        comps_exclude_list_all = [re.compile(x) for x in doc['exclude_list_all_regexp']]
+
+    # Parse comps, and build up a set of all packages so we can find packages not
+    # listed in comps *at all*, beyond just the workstation environment.
+    comps = libcomps.Comps()
+    comps.fromxml_f(args.src)
+
+    # Parse the workstation-product environment to get the list of comps groups to
+    # get packages from.
+    groups = []
+    for gid in comps.environments['workstation-product-environment'].group_ids:
+        if gid.name in comps_exclude_list_groups:
+            continue
+        groups.append(gid.name)
+
+    # Always include the packages from the workstation-ostree-support group
+    groups.append('workstation-ostree-support')
+
+    update_manifests_from_groups(comps, groups, 'fedora-common-ostree-pkgs.yaml', "common", args.save, comps_exclude_list, comps_exclude_list_all)
+
+    # List of comps groups used for each desktop
+    desktops_comps_groups = {
+        "gnome": ["gnome-desktop", "base-x"],
+        "kde": ["kde-desktop", "base-x"],
+        "xfce": ["xfce-desktop", "base-x"],
+        "lxqt": ["lxqt-desktop", "base-x"],
+        "deepin": ["deepin-desktop", "base-x"],
+        "mate": ["mate-desktop", "base-x"],
+        "sway": ["swaywm", "swaywm-extended"],
+        "cinnamon": ["cinnamon-desktop", "base-x"],
+        "budgie": ["budgie-desktop", "budgie-desktop-apps", "base-x"]
+    }
+
+    # Generate treefiles for all desktops
+    for desktop, groups in desktops_comps_groups.items():
+        print()
+        update_manifests_from_groups(comps, groups, f'{desktop}-desktop-pkgs.yaml', desktop, args.save, comps_desktop_exclude_list, comps_exclude_list_all)
+
+if __name__ == "__main__":
+    main()

From 8cd51faa3c3e45c0837fadc8733aa4f3461ddb36 Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 12/14] comps-sync-exclude-list.yml: Update comments


---

diff --git a/comps-sync-exclude-list.yml b/comps-sync-exclude-list.yml
index 3e68bf7..c273bb7 100644
--- a/comps-sync-exclude-list.yml
+++ b/comps-sync-exclude-list.yml
@@ -1,15 +1,15 @@
-# This file has a list of packages to skip from comps that we don't want, plus
-# a few include listed things.
+# This file has a list of packages to skip from comps that we don't want
 
-# Entirely skip all packages in libreoffice
+# Entirely skip all packages in those groups for the common set of packages
 exclude_list_groups:
   - libreoffice
   - gnome-desktop
   - container-management
   - base-x
 
-# PackageKit is spread across various groups
-# We can not include openh264. See https://fedoraproject.org/wiki/OpenH264
+# Always exclude packages matching those regexp:
+# - PackageKit is spread across various groups
+# - We can not include openh264. See https://fedoraproject.org/wiki/OpenH264
 exclude_list_all_regexp:
   - "PackageKit.*"
   - "gstreamer1-plugin-openh264"

From 8c60f55dd3cba602c02307be9d0c52a2d33b78aa Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 13/14] comps-sync-exclude-list.yml: Remove obsolete excludes


---

diff --git a/comps-sync-exclude-list.yml b/comps-sync-exclude-list.yml
index c273bb7..4d15adb 100644
--- a/comps-sync-exclude-list.yml
+++ b/comps-sync-exclude-list.yml
@@ -52,8 +52,6 @@ exclude_list:
     # drags in usermode, which should also be deprecated
     # and blocks a /usr/sbin + /usr/bin unification.
     - setuptool
-    # Really?
-    - tcp_wrappers
     # This probably doesn't need to be default
     - ppp
     # We removed cronie a while ago, should nuke these too

From 7211f15de2181f15907e146bd256d6487bd05ade Mon Sep 17 00:00:00 2001
From: Timothée Ravier <tim@siosm.fr>
Date: Sep 27 2023 18:02:11 +0000
Subject: [PATCH 14/14] fedora-common-ostree: Document nss-altfiles inclusion


---

diff --git a/fedora-common-ostree.yaml b/fedora-common-ostree.yaml
index a94de60..9a821e8 100644
--- a/fedora-common-ostree.yaml
+++ b/fedora-common-ostree.yaml
@@ -29,6 +29,9 @@ packages:
   # Required for compatibility with old bootloaders until we have bootupd
   # See https://github.com/fedora-silverblue/issue-tracker/issues/120
   - ostree-grub2
+  # Required until we've completed the move to systemd-sysusers
+  # See: https://github.com/fedora-silverblue/issue-tracker/issues/362
+  - nss-altfiles
   # Container management
   - buildah
   - podman

