Use rpmdev-vercmp to determine correct version of rpms in CentOS5
I am seeing this manifested on 2015.8 and 2016.3. If I use salt to install a package, 'foo-1.1-1' it works. If I then use salt to upgrade to a test build, 'foo-1.testbuild-1' that also works. If I then try to revert back to 'foo-1.1-1' it fails. In this case yum and salt appear to disagree as to whether this is an upgrade or downgrade. Salt should be deferring to yum but doesn't appear to.
ping @terminalmage looks like you wanted to be notified of this issue from here #21912
Looks like your latest comment on that issue leads me to believe this will be possible to fix for centos5 using rpmdev-vercmp Not sure if you guys want to move the conversation to this issue. Thanks
The fixes described in that issue work just fine in 2015.8 and 2016.3.
CentOS 5 was never included in the fix because it doesn't have access the rpm or rpmUtils modules directly due to the fact that Cent5 has a system Python of 2.4.3 while Salt runs on Python 2.6.
I'll modify this issue title to be more clear about the issue in light of @terminalmage's feedback.
Fixed in https://github.com/saltstack/salt/pull/34401.
[root@erik-cent5 salt]# chmod -x /usr/bin/rpmdev-vercmp
[root@erik-cent5 salt]# salt-call --local pkg.version_cmp '0.2-001' '0.2.0.1-002'
[WARNING ] rpmdevtools is not installed, please install it for more accurate version comparisons
local:
1
[root@erik-cent5 salt]# chmod +x /usr/bin/rpmdev-vercmp
[root@erik-cent5 salt]# salt-call --local pkg.version_cmp '0.2-001' '0.2.0.1-002'
local:
-1
Thanks!