public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] pr775-checkpolicy-revdeps: kernel/selinux-testsuite: improve kernel package detection
@ 2026-09-11 13:20 Ondrej Mosnacek
  0 siblings, 0 replies; only message in thread
From: Ondrej Mosnacek @ 2026-09-11 13:20 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : pr775-checkpolicy-revdeps
            Commit : 5ab7ce1a0ced2d528e08bb8e1c91315fd7eeb62e
            Author : Ondrej Mosnacek <omosnace@redhat.com>
            Date   : 2023-07-21T13:36:10+02:00
            Stats  : +21/-12 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/5ab7ce1a0ced2d528e08bb8e1c91315fd7eeb62e?branch=pr775-checkpolicy-revdeps

            Log:
            kernel/selinux-testsuite: improve kernel package detection

Instead of relying on the existing kernel package naming and versioning
conventions, which are subject to change in RHEL, determine the main
kernel package name via `rpm -qf "/lib/modules/$(uname -r)/vmlinuz"` and
derive the rest from that.

Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>

---
diff --git a/kernel/selinux-testsuite/runtest.sh b/kernel/selinux-testsuite/runtest.sh
index 9a27392..d5733ad 100755
--- a/kernel/selinux-testsuite/runtest.sh
+++ b/kernel/selinux-testsuite/runtest.sh
@@ -113,25 +113,34 @@ function boolSet() {
 
 rlJournalStart
     rlPhaseStartSetup "Install"
+        # Determine the base kernel package name and version corresponding
+        # to the currently running kernel. Use this information to derive
+        # the correct kernel subpackages to install.
+        if KERNEL_CORE_NVRA="$(rpm -qf "/lib/modules/$(uname -r)/vmlinuz")"; then
+            KERNEL_CORE_NV="${KERNEL_CORE_NVRA%-*}"
+            KERNEL_CORE_N="${KERNEL_CORE_NV%-*}"
+
+            KERNEL_PKG_VRA="${KERNEL_CORE_NVRA#$KERNEL_CORE_N-}"
+            KERNEL_PKG_BASE="${KERNEL_CORE_N%-core}"
+
+            rlLog "Detected kernel package base name '$KERNEL_PKG_BASE' and version-release.arch '$KERNEL_PKG_VRA'"
+            KERNEL_PKGS="
+                $KERNEL_PKG_BASE-modules-extra-$KERNEL_PKG_VRA
+                $KERNEL_PKG_BASE-devel-$KERNEL_PKG_VRA
+            "
+        else
+            rlLog "Detected non-RPM running kernel - no extra kernel packages will be installed"
+            KERNEL_PKGS=""
+        fi
+
         # We need to install the kernel-* packages by ourselves, since we need
         # the same versions as the running kernel. And since we already need a
         # reliable package install function, let's just install all the
         # dependencies here. Thus we don't need to maintain duplicate lists of
         # package requirements in many places (RH repo, Fedora kernel dist-git,
         # CKI).
-        PKG_SUFFIX=""
-        KERNEL_VERSION="$(uname -r)"
-        PKG_VERSION="${KERNEL_VERSION%+debug}"
-        if [ "$PKG_VERSION" != "$KERNEL_VERSION" ]; then
-            rlLog "Detected debug kernel running."
-            PKG_SUFFIX="-debug"
-        fi
-
         REQUIRES="
-            kernel$PKG_SUFFIX-modules-extra-$PKG_VERSION
-            kernel-rt$PKG_SUFFIX-modules-extra-$PKG_VERSION
-            kernel$PKG_SUFFIX-devel-$PKG_VERSION
-            kernel-rt$PKG_SUFFIX-devel-$PKG_VERSION
+            $KERNEL_PKGS
             /usr/bin/unbuffer
             attr
             audit

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-11 13:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 13:20 [tests/selinux] pr775-checkpolicy-revdeps: kernel/selinux-testsuite: improve kernel package detection Ondrej Mosnacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox