Skip to content

Commit a48b17a

Browse files
MDBF-1121 - libvirt - RPM automatic upgrades
As per MDEV-33459, major upgrades within the same family (>10) and vendor (!=distro) should work without removing old packages first.
1 parent 6094f89 commit a48b17a

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

scripts/rpm-upgrade.sh

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -138,13 +138,25 @@ if [[ $package_version == "$old_version" ]]; then
138138
exit
139139
fi
140140

141-
# //TEMP upgrade does not work without this but why? Can't we fix it?
142-
if [[ "$test_type" =~ ^(major|distro)$ ]]; then
143-
bb_log_info "remove old packages for major upgrade"
144-
packages_to_remove=$(rpm -qa | grep -E '^(MariaDB|mariadb)-' | awk -F'-' '{print $1"-"$2}')
145-
echo "$packages_to_remove" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" remove
146-
rpm -qa | grep -iE 'maria|mysql' || true
141+
# ------------------------------------------------------------------------------
142+
# -- MDBF-1121 / MDEV-33459 --
143+
# ------------------------------------------------------------------------------
144+
145+
# Major upgrades within the same family (>10) and vendor (!=distro)
146+
# should work without removing old packages first.
147+
148+
old_family=$(echo "$prev_major_version" | sed -n -e 's,^\([1-9][0-9]*\)\..*$,\1,p')
149+
new_family=$(echo "$major_version" | sed -n -e 's,^\([1-9][0-9]*\)\..*$,\1,p')
150+
151+
if [[ "$test_type" == "distro" ||
152+
( "$old_family" -lt 11 && "$test_type" != "minor" ) ||
153+
"$old_family" -ne "$new_family" ]]; then
154+
bb_log_info "remove old packages for major upgrade"
155+
packages_to_remove=$(rpm -qa | grep -E '^(MariaDB|mariadb)-' | awk -F'-' '{print $1"-"$2}')
156+
echo "$packages_to_remove" | xargs sudo "$pkg_cmd" "$pkg_cmd_options" remove
157+
rpm -qa | grep -iE 'maria|mysql' || true
147158
fi
159+
# ------------------------------------------------------------------------------
148160

149161
rpm_setup_bb_galera_artifacts_mirror
150162
rpm_setup_bb_artifacts_mirror

0 commit comments

Comments
 (0)