[LTP] [COMMITTED 1/2] ci: improve package manager support in fedora.sh

Li Wang liwang@redhat.com
Wed Apr 16 05:31:58 CEST 2025


Enhance Fedora CI script to support multiple versions of DNF. Prefer
`dnf5` if available, which supports the `--skip-unavailable` option.

Fallback to `dnf` or `yum` based on availability.

This improves compatibility with newer Fedora versions (e.g. Fedora 42+)
and prevents failures when unsupported options are passed to older DNF/YUM
versions.

Signed-off-by: Li Wang <liwang@redhat.com>
---
 ci/fedora.sh | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/ci/fedora.sh b/ci/fedora.sh
index bef5bcd2b..2b0701d08 100755
--- a/ci/fedora.sh
+++ b/ci/fedora.sh
@@ -2,7 +2,13 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018-2021 Petr Vorel <pvorel@suse.cz>
 
-yum="yum -y install --skip-broken"
+if command -v dnf5 >/dev/null 2>&1; then
+	yum="dnf5 -y install --skip-broken --skip-unavailable"
+elif command -v dnf >/dev/null 2>&1; then
+	yum="dnf -y install --skip-broken"
+else
+	yum="yum -y install --skip-broken"
+fi
 
 $yum \
 	autoconf \
-- 
2.49.0



More information about the ltp mailing list