]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fmf: Download rpms manually instead of going via repositories
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 19 Mar 2025 11:39:18 +0000 (12:39 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 20 Mar 2025 08:24:03 +0000 (09:24 +0100)
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
test/fmf/integration-tests/test.sh

index a1686c09c3dac54c9f9a139500d120e58d00c456..e7a38d3c0095e1c4c09e854ce4d2b49c9647ca10 100644 (file)
@@ -8,3 +8,6 @@ require:
     - distribution-gpg-keys
     - dnf
     - git-core
+    - koji
+    - centos-packager
+    - copr-cli
index e57a03026e3494267698885980d2ea23ee126bd5..f59ab9a97f233f388bd0ed5d13a6a54d99af6591 100755 (executable)
@@ -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 <<EOF
 [Distribution]
+Distribution=$ID
 Release=${VERSION_ID:-rawhide}
 
+[Content]
+PackageDirectories=..
+SELinuxRelabel=yes
+
 [Build]
 ToolsTreeDistribution=$ID
 ToolsTreeRelease=${VERSION_ID:-rawhide}
+Environment=NO_BUILD=1
+WithTests=yes
 EOF
 
 if [[ -n "${TEST_SELINUX_CHECK_AVCS:-}" ]]; then
@@ -61,32 +68,6 @@ KernelCommandLineExtra=systemd.setenv=TEST_SELINUX_CHECK_AVCS=$TEST_SELINUX_CHEC
 EOF
 fi
 
-if [[ -n "${TESTING_FARM_REQUEST_ID:-}" ]]; then
-    tee --append mkosi.local.conf <<EOF
-[Content]
-SELinuxRelabel=yes
-
-[Build]
-ToolsTreeSandboxTrees=
-        /etc/yum.repos.d/:/etc/yum.repos.d/
-        /var/share/test-artifacts/:/var/share/test-artifacts/
-SandboxTrees=
-        /etc/yum.repos.d/:/etc/yum.repos.d/
-        /var/share/test-artifacts/:/var/share/test-artifacts/
-Environment=NO_BUILD=1
-WithTests=yes
-EOF
-
-    cat /etc/dnf/dnf.conf
-    cat /etc/yum.repos.d/*
-
-    # Ensure packages built for this test have highest priority
-    echo -e "\npriority=1" >> /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