[rpm] we need correctly process tilde in rpm package versioning
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
packetary |
Fix Released
|
Critical
|
Sergey Kulanov |
Bug Description
RPM package comparation doesn't take into account tilde "~", as the result we have wrong dep resolution:
1) Run:
$ python packetary/
centos_mirror.yaml:
- name: "mos-repos"
uri: "http://
priority: 1
path: "/tmp/mirrors/
2) Result:
openstack-neutron; >= 1:8.0.0~b3; -
python-neutron; >= 1:8.0.0~b3; -
At the same time, no issue with yum usage:
yum deplist openstack-neutron
Loaded plugins: fastestmirror, ovl
base | 3.6 kB 00:00:00
extras | 3.4 kB 00:00:00
mos | 3.6 kB 00:00:00
updates | 3.4 kB 00:00:00
(1/6): extras/
(2/6): base/7/
(3/6): mos/group_gz | 220 kB 00:00:00
(4/6): mos/primary_db | 755 kB 00:00:00
(5/6): base/7/
(6/6): updates/
Determining fastest mirrors
* base: mirror.tversu.ru
* extras: mirror.tversu.ru
* updates: mirror.tversu.ru
package: openstack-
dependency: /bin/bash
provider: bash.x86_64 4.2.46-19.el7
dependency: /bin/sh
provider: bash.x86_64 4.2.46-19.el7
dependency: /usr/bin/python2
provider: python.x86_64 2.7.5-34.el7
dependency: conntrack-tools
provider: conntrack-
dependency: dnsmasq
provider: dnsmasq.x86_64 2.66-14.el7_1
dependency: dnsmasq-utils
provider: dnsmasq-
dependency: ipset
provider: ipset.x86_64 6.19-4.el7
dependency: iptables
provider: iptables-
provider: iptables.x86_64 1.4.21-16.el7
provider: iptables.i686 1.4.21-16.el7
dependency: keepalived
provider: keepalived.x86_64 1.2.13-7.el7
dependency: openstack-
provider: openstack-
dependency: radvd
provider: radvd.x86_64 1.9.2-9.el7
dependency: shadow-utils
provider: shadow-utils.x86_64 2:4.1.5.1-18.el7
dependency: systemd
provider: systemd.x86_64 219-19.el7_2.9
The thing is that we don't take into account tilde usage in version, please check the algorithm [1]:
***
- If both strings start with a tilde, discard it and move on to the next character.
- If string a starts with a tilde and string b does not, return -1 (string a is older); and the inverse if string b starts with a tilde and string a does not.
***
and the implementation from rpm tool itself:
/* loop through each version segment of str1 and str2 and compare them */
while (*one || *two) {
while (*one && !risalnum(*one) && *one != '~') one++;
while (*two && !risalnum(*two) && *two != '~') two++;
/* handle the tilde separator, it sorts before everything else */
if (*one == '~' || *two == '~') {
if (*one != '~') return 1;
if (*two != '~') return -1;
one++;
two++;
continue;
}
So we need to align packetary.
[1]. http://
Fix proposed to branch: master /review. openstack. org/322744
Review: https:/