]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
packit: Load fmf metadata from rpm spec repository 36825/head
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 21 Mar 2025 14:13:22 +0000 (15:13 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Fri, 21 Mar 2025 15:30:31 +0000 (16:30 +0100)
Maintaining the fmf metadata and script upstream makes it painful
to reuse downstream so let's move the metadata and testing script
downstream and load it upstream instead.

.packit.yml
test/fmf/.fmf/version [deleted file]
test/fmf/integration-tests/main.fmf [deleted file]
test/fmf/integration-tests/test.sh [deleted file]
test/fmf/plans/ci.fmf [deleted file]
tools/fetch-distro.py

index 9111c0e07a063e4ffa5d1902de4455a51b046330..8989fd431138cb2539dba62c1cde4967e833ea7e 100644 (file)
@@ -37,8 +37,17 @@ jobs:
 
 - job: tests
   trigger: pull_request
-  fmf_path: test/fmf
-  tmt_plan: ci
-  use_target_repo_for_fmf_url: true
+  fmf_url: https://src.fedoraproject.org/rpms/systemd
+  # This is automatically updated by tools/fetch-distro.py --update fedora
+  fmf_ref: 2ecfbec1a444a2ec9e3dab91d04565330cf809ea
   targets:
   - fedora-rawhide-x86_64
+  # testing-farm in the Fedora repository is explicitly configured to use testing-farm bare metal runners as
+  # the volume of pull requests there is very low. Upstream the volume of pull requests is much higher and
+  # we'll bottleneck ourselves if we insist on bare metal runners, so explicitly do not request support for
+  # nested virtualization so we don't only consider bare metal runners.
+  tf_extra_params:
+    environments:
+      - hardware:
+          virtualization:
+            is-supported: false
diff --git a/test/fmf/.fmf/version b/test/fmf/.fmf/version
deleted file mode 100644 (file)
index d00491f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/test/fmf/integration-tests/main.fmf b/test/fmf/integration-tests/main.fmf
deleted file mode 100644 (file)
index e7a38d3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-summary: Run the upstream integration test suite
-test: ./test.sh
-duration: 2h
-require:
-    - coreutils
-    - distribution-gpg-keys
-    - dnf
-    - git-core
-    - koji
-    - centos-packager
-    - copr-cli
diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh
deleted file mode 100755 (executable)
index 447ab30..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-#!/bin/bash
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-set -eux
-set -o pipefail
-
-# Switch SELinux to permissive if possible, since the tests don't set proper contexts
-setenforce 0 || true
-
-echo "CPU and Memory information:"
-lscpu
-lsmem
-
-echo "Clock source: $(cat /sys/devices/system/clocksource/clocksource0/current_clocksource)"
-
-# Bump inotify limits if we can so nspawn containers don't run out of inotify file descriptors.
-sysctl fs.inotify.max_user_watches=65536 || true
-sysctl fs.inotify.max_user_instances=1024 || true
-
-if [[ -n "${KOJI_TASK_ID:-}" ]]; then
-    koji download-task --noprogress --arch="src,noarch,$(rpm --eval '%{_arch}')" "$KOJI_TASK_ID"
-elif [[ -n "${CBS_TASK_ID:-}" ]]; then
-    cbs download-task --noprogress --arch="src,noarch,$(rpm --eval '%{_arch}')" "$CBS_TASK_ID"
-elif [[ -n "${PACKIT_SRPM_URL:-}" ]]; then
-    COPR_BUILD_ID="$(basename "$(dirname "$PACKIT_SRPM_URL")")"
-    COPR_CHROOT="$(basename "$(dirname "$(dirname "$PACKIT_BUILD_LOG_URL")")")"
-    copr download-build --rpms --chroot "$COPR_CHROOT" "$COPR_BUILD_ID"
-    mv "$COPR_CHROOT"/* .
-else
-    echo "Not running within packit and no CBS/koji task ID provided"
-    exit 1
-fi
-
-mkdir systemd
-rpm2cpio ./systemd-*.src.rpm | cpio --to-stdout --extract './systemd-*.tar.gz' | tar xz --strip-components=1 -C systemd
-pushd systemd
-
-# Now prepare mkosi at the same version required by the systemd repo.
-git clone https://github.com/systemd/mkosi
-mkosi_hash="$(grep systemd/mkosi@ .github/workflows/mkosi.yml | sed "s|.*systemd/mkosi@||g")"
-git -C mkosi checkout "$mkosi_hash"
-
-export PATH="$PWD/mkosi/bin:$PATH"
-
-# shellcheck source=/dev/null
-. /etc/os-release || . /usr/lib/os-release
-
-tee mkosi.local.conf <<EOF
-[Distribution]
-Distribution=${MKOSI_DISTRIBUTION:-$ID}
-Release=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}}
-
-[Content]
-PackageDirectories=..
-SELinuxRelabel=yes
-
-[Build]
-ToolsTreeDistribution=${MKOSI_DISTRIBUTION:-$ID}
-ToolsTreeRelease=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}}
-ToolsTreePackageDirectories=..
-Environment=NO_BUILD=1
-WithTests=yes
-EOF
-
-if [[ -n "${TEST_SELINUX_CHECK_AVCS:-}" ]]; then
-    tee --append mkosi.local.conf <<EOF
-[Runtime]
-KernelCommandLineExtra=systemd.setenv=TEST_SELINUX_CHECK_AVCS=$TEST_SELINUX_CHECK_AVCS
-EOF
-fi
-
-# If we don't have KVM, skip running in qemu, as it's too slow. But try to load the module first.
-modprobe kvm || true
-if [[ ! -e /dev/kvm ]]; then
-    export TEST_NO_QEMU=1
-fi
-
-NPROC="$(nproc)"
-if [[ "$NPROC" -ge 10 ]]; then
-    export TEST_JOURNAL_USE_TMP=1
-    NPROC="$((NPROC / 3))"
-else
-    NPROC="$((NPROC - 1))"
-fi
-
-# This test is only really useful if we're building with sanitizers and takes a long time, so let's skip it
-# for now.
-export TEST_SKIP="TEST-21-DFUZZER"
-
-mkosi summary
-mkosi -f sandbox -- true
-mkosi sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build
-mkosi genkey
-mkosi -f
-mkosi sandbox -- \
-    meson test \
-    -C build \
-    --no-rebuild \
-    --suite integration-tests \
-    --print-errorlogs \
-    --no-stdsplit \
-    --num-processes "$NPROC" && EC=0 || EC=$?
-
-[[ -d build/meson-logs ]] && find build/meson-logs -type f -exec mv {} "$TMT_TEST_DATA" \;
-[[ -d build/test/journal ]] && find build/test/journal -type f -exec mv {} "$TMT_TEST_DATA" \;
-
-popd
-
-exit "$EC"
diff --git a/test/fmf/plans/ci.fmf b/test/fmf/plans/ci.fmf
deleted file mode 100644 (file)
index 3e2a16b..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-
-summary: systemd Fedora test suite
-discover:
-  how: fmf
-prepare:
-  - name: systemd
-    how: install
-    exclude:
-      - systemd-standalone-.*
-execute:
-  how: tmt
index 1d9f10005ea29c784cfe38e9531678900686358f..6d1c35ba6bf5e98020c5c1dba0565aab49c4f45c 100755 (executable)
@@ -42,13 +42,13 @@ def read_config(distro: str):
     images = {image["Image"]: image for image in data["Images"]}
     return images["build"]
 
-def commit_file(distro: str, file: Path, commit: str, changes: str):
+def commit_file(distro: str, files: list[Path], commit: str, changes: str):
     message = '\n'.join((
         f'mkosi: update {distro} commit reference',
         '',
         changes))
 
-    cmd = ['git', 'commit', '-m', message, str(file)]
+    cmd = ['git', 'commit', '-m', message, *(str(file) for file in files)]
     print(f"+ {shlex.join(cmd)}")
     subprocess.check_call(cmd)
 
@@ -135,7 +135,17 @@ def update_distro(args, distro: str, config: dict):
             new = s.replace(old_commit, new_commit)
             assert new != s
             file.write_text(new)
-            commit_file(distro, file, new_commit, changes)
+            tocommit = [file]
+
+            if distro == "fedora":
+                packit = Path(".packit.yml")
+                s = packit.read_text()
+                assert old_commit in s
+                new = s.replace(old_commit, new_commit)
+                packit.write_text(new)
+                tocommit += [packit]
+
+            commit_file(distro, tocommit, new_commit, changes)
             break
     else:
         raise ValueError(f'{distro}: hash {new_commit} not found under {conf_dir}')