From e2acfdafc477c28a07712bf71838aaad17aed0c2 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: Apr 12 2024 17:07:16 +0000 Subject: [PATCH 1/4] comps-sync.py: Return non-zero if changes are needed but not saved This will let us use that in CI to check for pending comps-sync changes. --- diff --git a/comps-sync.py b/comps-sync.py index 03e5101..885e62e 100755 --- a/comps-sync.py +++ b/comps-sync.py @@ -1,10 +1,14 @@ #!/usr/bin/python3 ''' -Usage: ./comps-sync.py /path/to/comps-f39.xml.in +Usage: ./comps-sync.py [--save] /path/to/comps-f40.xml.in -Can both remove packages from the manifest which are not mentioned in comps, -and add packages from comps. +Filter and sync packages from comps groups into rpm-ostree manifests. The sync +will remove packages from the manifests which are not mentioned in comps and +add missing packages from comps to the manifests. + +Use --save to write the changes and always exit with a 0 return code. +Otherwise, exit with a non zero return code if any changes are needed. ''' import argparse @@ -148,15 +152,18 @@ def update_manifests_from_groups(comps, groups, path, desktop, save, comps_exclu 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") + if (n_manifest_new > 0 or n_comps_new > 0): + if save: + if desktop == "common": + write_manifest(path, manifest_packages) + else: + write_manifest(path, manifest_packages, include="fedora-common-ostree.yaml") + return 1 + return 0 def main(): parser = argparse.ArgumentParser() - parser.add_argument("--save", help="Write changes", action='store_true') + parser.add_argument("--save", help="Write changes to manifests", action='store_true') parser.add_argument("src", help="Source path") args = parser.parse_args() @@ -184,7 +191,10 @@ def main(): # 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) + # Return code indicates if changes have or would have been done + ret = 0 + + ret += 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 = { @@ -202,7 +212,10 @@ def main(): # 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) + ret += update_manifests_from_groups(comps, groups, f'{desktop}-desktop-pkgs.yaml', desktop, args.save, comps_desktop_exclude_list, comps_exclude_list_all) + + if not args.save and ret != 0: + sys.exit(1) if __name__ == "__main__": main() From e9b96219f7064c4d3da48efbdc880b794fb56f94 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: Apr 12 2024 17:07:19 +0000 Subject: [PATCH 2/4] justfile: Add a recipe to check for comps sync changes Will be used by Zuul CI. --- diff --git a/justfile b/justfile index 82a14f1..5b360bc 100644 --- a/justfile +++ b/justfile @@ -45,6 +45,24 @@ comps-sync: version="$(rpm-ostree compose tree --print-only --repo=repo fedora-${default_variant}.yaml | jq -r '."mutate-os-release"')" ./comps-sync.py --save fedora-comps/comps-f${version}.xml.in +# Check if the manifests are in sync with the content of the comps groups +comps-sync-check: + #!/bin/bash + set -euo pipefail + + if [[ ! -d fedora-comps ]]; then + git clone https://pagure.io/fedora-comps.git + else + pushd fedora-comps > /dev/null || exit 1 + git fetch + git reset --hard origin/main + popd > /dev/null || exit 1 + fi + + default_variant={{default_variant}} + version="$(rpm-ostree compose tree --print-only --repo=repo fedora-${default_variant}.yaml | jq -r '."mutate-os-release"')" + ./comps-sync.py fedora-comps/comps-f${version}.xml.in + # Output the processed manifest for a given variant (defaults to Silverblue) manifest variant=default_variant: #!/bin/bash From 8c73219184745fbfd105eb36fddb34ee2d46bf05 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: Apr 12 2024 17:07:19 +0000 Subject: [PATCH 3/4] zuul: Verify that the comps and manifests are synced Best effort (as it will only run on PRs) check for comps / manifests sync. --- diff --git a/ci/validate.yaml b/ci/validate.yaml index b07f753..84d21e3 100644 --- a/ci/validate.yaml +++ b/ci/validate.yaml @@ -17,6 +17,13 @@ chdir: "{{ zuul.project.src_dir }}" cmd: just validate + - name: Verify that the comps and manifests are synced + ansible.builtin.shell: + chdir: "{{ zuul.project.src_dir }}" + cmd: "just validate comps-sync-check && touch .zuulci.comps" + # Still run the next step if this one fails + ignore_errors: true + - name: Perform dependency resolution for Silverblue ansible.builtin.shell: chdir: "{{ zuul.project.src_dir }}" @@ -53,4 +60,4 @@ - name: Check if any previous dependency resolution steps failed ansible.builtin.shell: chdir: "{{ zuul.project.src_dir }}" - cmd: "[[ -f .zuulci.silverblue ]] && [[ -f .zuulci.kinoite ]] && [[ -f .zuulci.sericea ]] && [[ -f .zuulci.onyx ]]" + cmd: "[[ -f .zuulci.comps ]] && [[ -f .zuulci.silverblue ]] && [[ -f .zuulci.kinoite ]] && [[ -f .zuulci.sericea ]] && [[ -f .zuulci.onyx ]]" From 40bd2850c4e8fe8e1be1cb72560e83f1840433e7 Mon Sep 17 00:00:00 2001 From: Timothée Ravier Date: Apr 23 2024 13:03:47 +0000 Subject: [PATCH 4/4] fedora-common-ostree: Add slirp4netns Keep slirp4netns for rootless containers until it's fully deprecated in podman. See: https://github.com/fedora-silverblue/issue-tracker/issues/547 See: https://blog.podman.io/2024/03/podman-5-0-breaking-changes-in-detail/ --- diff --git a/fedora-common-ostree.yaml b/fedora-common-ostree.yaml index 9c0d3ef..4983ad5 100644 --- a/fedora-common-ostree.yaml +++ b/fedora-common-ostree.yaml @@ -31,6 +31,9 @@ packages: - buildah - podman - skopeo + # Keep slirp4netns for rootless containers until it's fully deprecated in podman + # See: https://github.com/fedora-silverblue/issue-tracker/issues/547 + - slirp4netns # See: https://github.com/fedora-silverblue/issue-tracker/issues/503 - systemd-container # Provides terminal tools like clear, reset, tput, and tset