From 197e3b5a8cf98e591fc32e9158e54d620ea4224d Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 10:54:51 +0100 Subject: [PATCH 1/9] packit: Enable use_target_repo_for_fmf_url option Currently this is picked up from the main branch of the fork which is suboptimal. The packit folks implemented this new option for us which should fix the problem. --- .packit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.packit.yml b/.packit.yml index 37bf55a0cb..92c78a5b1e 100644 --- a/.packit.yml +++ b/.packit.yml @@ -38,5 +38,6 @@ jobs: trigger: pull_request fmf_path: test/fmf tmt_plan: ci + use_target_repo_for_fmf_url: true targets: - fedora-rawhide-x86_64 From 33bcafe6d10ea90ad3345329e14bb9a347493c5d Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 11:03:05 +0100 Subject: [PATCH 2/9] packit: Use same specfile revision as mkosi uses --- .packit.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.packit.yml b/.packit.yml index 92c78a5b1e..5c3af67505 100644 --- a/.packit.yml +++ b/.packit.yml @@ -19,6 +19,7 @@ actions: post-upstream-clone: # Use the Fedora Rawhide specfile - git clone https://src.fedoraproject.org/rpms/systemd .packit_rpm --depth=1 + - bash -c 'git -C .packit_rpm checkout "$(grep GIT_COMMIT= mkosi.images/build/mkosi.conf.d/centos-fedora/mkosi.conf | cut -d= -f2)"' - bash -c 'echo "%bcond upstream 1" > .packit_rpm/systemd.spec.new' - bash -c 'echo "%define meson_extra_configure_options --werror" >> .packit_rpm/systemd.spec.new' - bash -c 'cat .packit_rpm/systemd.spec >> .packit_rpm/systemd.spec.new' From 3f2700287f8a14e18abbe43802a448df011f01e1 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 11:09:04 +0100 Subject: [PATCH 3/9] fmf: Drop btrfs workaround We switched to ext4 in mkosi.repart itself, so drop the workaround in the fmf integration test script. --- test/fmf/integration-tests/test.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index 5c9f03c960..64e6c48fd2 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -108,9 +108,6 @@ EOF touch /etc/yum.repos.d/mkosi.repo fi -# TODO: drop once BTRFS regression is fixed in kernel 6.13 -sed -i "s/Format=btrfs/Format=ext4/" mkosi.repart/10-root.conf - # 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 From 91418656e88512921c9d8d96aab6a7b336677464 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 11:09:43 +0100 Subject: [PATCH 4/9] fmf: Stop creating /etc/pacman.d/gnupg mountpoint Not needed anymore with latest versions of mkosi. --- test/fmf/integration-tests/test.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index 64e6c48fd2..7e7e1130fc 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -126,9 +126,6 @@ fi # for now. export TEST_SKIP="TEST-21-DFUZZER" -# Create missing mountpoint for mkosi sandbox. -mkdir -p /etc/pacman.d/gnupg - mkosi summary mkosi -f sandbox -- true mkosi -f sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build From da42c1441b07871cc65703f35452926a6b6106ee Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 12:36:20 +0100 Subject: [PATCH 5/9] fmf: Drop support for dist-git-source: true In preparation for moving the fmf stuff to the fedora spec repo instead of maintaining it upstream, let's drop support for dist-git-source: true which won't be needed anymore when we move the fmf stuff to the Fedora spec repository. --- test/fmf/integration-tests/test.sh | 23 +---------------------- 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index 7e7e1130fc..e57a03026e 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -17,28 +17,7 @@ echo "Clock source: $(cat /sys/devices/system/clocksource/clocksource0/current_c sysctl fs.inotify.max_user_watches=65536 || true sysctl fs.inotify.max_user_instances=1024 || true -# Allow running the integration tests downstream in dist-git with something like -# the following snippet which makes the dist-git sources available in $TMT_SOURCE_DIR: -# -# summary: systemd Fedora test suite -# discover: -# how: fmf -# dist-git-source: true -# dist-git-install-builddeps: false -# prepare: -# - name: systemd -# how: install -# exclude: -# - systemd-standalone-.* -# execute: -# how: tmt - -shopt -s extglob - -if [[ -n "${TMT_SOURCE_DIR:-}" ]]; then - # Match either directories ending with branch names (e.g. systemd-fmf) or releases (e.g systemd-257.1). - pushd "$TMT_SOURCE_DIR"/systemd-+([0-9a-z.~])/ -elif [[ -n "${PACKIT_TARGET_URL:-}" ]]; then +if [[ -n "${PACKIT_TARGET_URL:-}" ]]; then # Prepare systemd source tree git clone "$PACKIT_TARGET_URL" systemd --branch "$PACKIT_TARGET_BRANCH" pushd systemd From a3b8fee46eefd2cbb4c3ef4cae85b60781c9bd3c Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 12:39:18 +0100 Subject: [PATCH 6/9] fmf: Download rpms manually instead of going via repositories This both makes the script more independent, and allows us to add support for CBS (CentOS Community Build System) at the same time. --- test/fmf/integration-tests/main.fmf | 3 ++ test/fmf/integration-tests/test.sh | 63 ++++++++++------------------- 2 files changed, 25 insertions(+), 41 deletions(-) diff --git a/test/fmf/integration-tests/main.fmf b/test/fmf/integration-tests/main.fmf index a1686c09c3..e7a38d3c00 100644 --- a/test/fmf/integration-tests/main.fmf +++ b/test/fmf/integration-tests/main.fmf @@ -8,3 +8,6 @@ require: - 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 index e57a03026e..f59ab9a97f 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -17,25 +17,25 @@ echo "Clock source: $(cat /sys/devices/system/clocksource/clocksource0/current_c sysctl fs.inotify.max_user_watches=65536 || true sysctl fs.inotify.max_user_instances=1024 || true -if [[ -n "${PACKIT_TARGET_URL:-}" ]]; then - # Prepare systemd source tree - git clone "$PACKIT_TARGET_URL" systemd --branch "$PACKIT_TARGET_BRANCH" - pushd systemd - - # If we're running in a pull request job, merge the remote branch into the current main - if [[ -n "${PACKIT_SOURCE_URL:-}" ]]; then - git remote add pr "${PACKIT_SOURCE_URL:?}" - git fetch pr "${PACKIT_SOURCE_BRANCH:?}" - git merge "pr/$PACKIT_SOURCE_BRANCH" - fi - - git log --oneline -5 +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 or Fedora CI" + echo "Not running within packit and no CBS/koji task ID provided" exit 1 fi -# Now prepare mkosi, possibly at the same version required by the systemd repo +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" @@ -47,11 +47,18 @@ export PATH="$PWD/mkosi/bin:$PATH" tee mkosi.local.conf <> /etc/yum.repos.d/copr_build* - - # Disable mkosi's own repository logic - touch /etc/yum.repos.d/mkosi.repo -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 From 1f3bf2a9a2b056ab55464858944474a7806a7172 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 12:52:36 +0100 Subject: [PATCH 7/9] fmf: Allow overriding the mkosi distribution and release used --- test/fmf/integration-tests/test.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index f59ab9a97f..bdde6031cf 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -47,16 +47,16 @@ export PATH="$PWD/mkosi/bin:$PATH" tee mkosi.local.conf < Date: Wed, 19 Mar 2025 14:07:42 +0100 Subject: [PATCH 8/9] fmf: Drop -f from subsequent mkosi sandbox calls Only required for the first call to mkosi sandbox, after that we can assume the tools tree has already been built. --- test/fmf/integration-tests/test.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index bdde6031cf..582cc7d865 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -88,10 +88,10 @@ export TEST_SKIP="TEST-21-DFUZZER" mkosi summary mkosi -f sandbox -- true -mkosi -f sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build +mkosi sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build mkosi genkey -mkosi -f sandbox -- meson compile -C build mkosi -mkosi -f sandbox -- \ +mkosi sandbox -- meson compile -C build mkosi +mkosi sandbox -- \ meson test \ -C build \ --no-rebuild \ From 314ea2ec7ba801adf3e25f29f12c426fda1f2b0e Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Wed, 19 Mar 2025 14:08:49 +0100 Subject: [PATCH 9/9] fmf: Use mkosi -f together with ToolsTreePackageDirectories= There's no need to build various systemd tools from source again to build the mkosi image when we can just install the packages that were already built from source into the tools tree so let's do that to avoid unnecessary compiling. --- test/fmf/integration-tests/test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/fmf/integration-tests/test.sh b/test/fmf/integration-tests/test.sh index 582cc7d865..447ab30bf9 100755 --- a/test/fmf/integration-tests/test.sh +++ b/test/fmf/integration-tests/test.sh @@ -57,6 +57,7 @@ SELinuxRelabel=yes [Build] ToolsTreeDistribution=${MKOSI_DISTRIBUTION:-$ID} ToolsTreeRelease=${MKOSI_RELEASE:-${VERSION_ID:-rawhide}} +ToolsTreePackageDirectories=.. Environment=NO_BUILD=1 WithTests=yes EOF @@ -90,7 +91,7 @@ mkosi summary mkosi -f sandbox -- true mkosi sandbox -- meson setup --buildtype=debugoptimized -Dintegration-tests=true build mkosi genkey -mkosi sandbox -- meson compile -C build mkosi +mkosi -f mkosi sandbox -- \ meson test \ -C build \