Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If dnf5 and dnf-3 are installed, use dnf5 #55

Merged
merged 4 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions mtps-pkg-test
Original file line number Diff line number Diff line change
Expand Up @@ -202,14 +202,14 @@ pkg_remove_any() {
debug "${FUNCNAME[0]}: $name is not installed. Not removing."
return 0
fi
# yum remove --allowerasing kernel-rt-kvm
# yum remove kernel-rt-kvm
#=============================================================================
# Package Arch Version Repository Size
#=============================================================================
#Removing:
# kernel-rt-kvm x86_64 4.18.0-39.rt9.82.el8 @rhel-8-buildroot 361 k
# kernel-rt-kvm x86_64 4.18.0-37.rt9.80.el8 @rhel-8-buildroot-old 361 k
"$YUMDNFCMD" -y remove ${ALLOWERASING} "$name" || :
"$YUMDNFCMD" -y remove "$name" || :
# yum returns 1 for removing non-existing package for yum4/dnf
local ret=0
pkg_is_present "$name" && ret=1
Expand Down Expand Up @@ -393,7 +393,7 @@ pkg_remove_any_newer() {
continue
fi
echo "Removing package: $to_remove"
"$YUMDNFCMD" -y remove "$ALLOWERASING" "$to_remove" || :
"$YUMDNFCMD" -y remove "$to_remove" || :
done
}

Expand All @@ -409,7 +409,7 @@ pkg_remove_any_older() {
fi
if nevra_older_then "$to_remove" "$nevra"; then
echo "Removing older package: $to_remove"
"$YUMDNFCMD" -y remove "$ALLOWERASING" "$to_remove" || :
"$YUMDNFCMD" -y remove "$to_remove" || :
else
debug "Not removing newer package: $to_remove"
continue
Expand Down
2 changes: 0 additions & 2 deletions mtps-run-tests
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,6 @@ TESTRUN_ID="$(date +%H%M%S)"
if [ -z "${nevras_in_repo// /}" ]; then
logfname="${LOGS_DIR%%/}/FAIL-${TESTRUN_ID}-${TEST}-mtps-run-tests.log"
echo "Test '$TEST' failed due no packages for testing in repo '$REPONAME:'." | tee -a "$logfname"
echo "Output for: ${YUMDNFCMD} repo-pkgs $REPONAME list --showduplicates" | tee -a "$logfname"
"$YUMDNFCMD" repo-pkgs "$REPONAME" list --showduplicates 2>&1 | tee -a "$logfname"
exit 1
fi

Expand Down
14 changes: 3 additions & 11 deletions mtps-setup
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
# 2. If /usr/bin/yum is symlink:
#
# * read this symlink
# * <=f38, c8s, c9s, rhel8, rhel9:
# * <=f40, <= c10s, <= rhel10:
#
# lrwxrwxrwx. 1 root root 5 May 29 00:00 /usr/bin/yum -> dnf-3
#
# * >=F39:
# * >=F41:
#
# lrwxrwxrwx. 1 root root 4 Jul 19 00:00 /usr/bin/yum -> dnf5
#
Expand All @@ -41,15 +41,7 @@ if [ -z "$YUMDNFCMD" ]; then
if [ -f "/usr/bin/yum" ]; then
YUMDNFCMD="yum"
if [ -L "/usr/bin/yum" ]; then
YUMLINK="$(readlink "/usr/bin/yum")"
if [[ "$YUMLINK" == *dnf5* && -x "/usr/bin/dnf-3" ]]; then
YUMDNFCMD="/usr/bin/dnf-3"
if [ "$EUID" -eq 0 ]; then
if ! rpm -q python3-dnf >/dev/null; then
dnf -y install python3-dnf
fi
fi
fi
YUMDNFCMD="$(readlink "/usr/bin/yum")"
fi
else
YUMDNFCMD="dnf"
Expand Down
16 changes: 8 additions & 8 deletions profiles/fedora/prepare-system
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ skip_if_unavailable=True
EOF
fi

# Ugly hack for
# https://github.com/fedora-ci/mini-tps/issues/57#issuecomment-2134998129
# Remove it with a proper fix for mini-tps/issues/57 !
"$YUMDNFCMD" -y install dnf-plugins-core

# Make sure fedora and fedora-updates repos are enabled
"$YUMDNFCMD" config-manager --set-enabled 'fedora' 'updates'
# Disable all COPR repositories (mini-tps, ...)
"$YUMDNFCMD" config-manager --set-disabled 'copr:*'
if [[ "$YUMDNFCMD" == "dnf5" ]]; then
dnf5 -y install dnf5-plugins # config-manager
dnf5 config-manager setopt fedora.enabled=1 updates.enabled=1
dnf5 repo list
else
"$YUMDNFCMD" -y install dnf-plugins-core # config-manager
"$YUMDNFCMD" config-manager --set-enabled fedora updates
fi

echo "Recreating the DNF cache..."
"$YUMDNFCMD" clean all
Expand Down