mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 12:50:22 -07:00
yum: allow for downgrade using rpm file (#31647)
This commit is contained in:
parent
1d86205933
commit
ee6ba5d590
2 changed files with 40 additions and 3 deletions
|
@ -747,16 +747,20 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos, i
|
|||
(name, ver, rel, epoch, arch) = splitFilename(envra)
|
||||
installed_pkgs = is_installed(module, repoq, name, conf_file, en_repos=en_repos, dis_repos=dis_repos, installroot=installroot)
|
||||
|
||||
# TODO support downgrade for rpm files
|
||||
if len(installed_pkgs) == 1:
|
||||
installed_pkg = installed_pkgs[0]
|
||||
(cur_name, cur_ver, cur_rel, cur_epoch, cur_arch) = splitFilename(installed_pkg)
|
||||
cur_epoch = cur_epoch or '0'
|
||||
compare = compareEVR((cur_epoch, cur_ver, cur_rel), (epoch, ver, rel))
|
||||
|
||||
# compare > 0 (higher version is installed) or compare == 0 (exact version is installed)
|
||||
if compare >= 0:
|
||||
# compare > 0 -> higher version is installed
|
||||
# compare == 0 -> exact version is installed
|
||||
# compare < 0 -> lower version is installed
|
||||
if compare > 0 and allow_downgrade:
|
||||
downgrade_candidate = True
|
||||
elif compare >= 0:
|
||||
continue
|
||||
|
||||
# else: if there are more installed packages with the same name, that would mean
|
||||
# kernel, gpg-pubkey or like, so just let yum deal with it and try to install it
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue