dnf - arches must be the same in the is_newer_installed check (#83417) (#83505)

Fixes #83406

(cherry picked from commit 2930a4664c)
pull/83546/head
Martin Krizek 5 months ago committed by GitHub
parent a4499fdba0
commit 58b22a3476
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,2 @@
bugfixes:
- dnf - fix an issue where two packages of the same ``evr`` but different arch failed to install (https://github.com/ansible/ansible/issues/83406)

@ -739,7 +739,7 @@ class DnfModule(YumDnf):
installed = sorted(self.base.sack.query().installed().filter(name=available.name).run())[-1] installed = sorted(self.base.sack.query().installed().filter(name=available.name).run())[-1]
except IndexError: except IndexError:
return False return False
return installed > available return installed.evr_gt(available) and installed.arch == available.arch
def _mark_package_install(self, pkg_spec, upgrade=False): def _mark_package_install(self, pkg_spec, upgrade=False):
"""Mark the package for install.""" """Mark the package for install."""

@ -414,3 +414,23 @@
dnf: dnf:
name: provides_foo* name: provides_foo*
state: absent state: absent
- name: test that only evr is compared, avoiding a situation when a specific arch would be considered as a "newer" package
block:
- dnf:
name: "{{ item }}"
state: present
loop:
- "dinginessentail-1.0-1.x86_64"
- "dinginessentail-1.0-1.i686"
register: dnf_results
- assert:
that:
- dnf_results["results"][0] is changed
- dnf_results["results"][1] is changed
always:
- name: Clean up
dnf:
name: dinginessentail
state: absent

Loading…
Cancel
Save