[rpm] Fix rpm package comparation with not defined release part

Bug #1587032 reported by Sergey Kulanov
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
packetary
Fix Released
Critical
Sergey Kulanov

Bug Description

RPM package version consists of three parts: E - epoch, V - version, R - release, so
if E1=E2 and V1=V2 we've comparing on release part, please check [1]:

1) Set each epoch value to 0 if it’s null/None.
2) Compare the epoch values using compare_values(). If they’re not equal, return that result, else move on to the next portion (version). The logic within compare_values() is that if one is empty/null and the other is not, the non-empty one is greater, and that ends the comparison. If neither of them is empty/not present, compare them using rpmvercmp() and follow the same logic; if one is “greater” (newer) than the other, that’s the end result of the comparison. Otherwise, move on to the next component (version).
3) Compare the versions using the same logic.
4) Compare the releases using the same logic.
5) If all of the components are “equal”, the packages are the same.

so we need to fix packetary to correctly process cases with empty release field:

[root@88a81c755aa2 /]# rpmdev-vercmp 8.0.0-0~rc1 8.0.0
8.0.0-0~rc1 > 8.0.0
[root@88a81c755aa2 /]# rpmdev-vercmp 13.9-16.12 13.9
13.9-16.12 > 13.9

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to packetary (master)

Fix proposed to branch: master
Review: https://review.openstack.org/322791

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on packetary (master)

Change abandoned by Sergey Kulanov (<email address hidden>) on branch: master
Review: https://review.openstack.org/322791
Reason: should be fixed by using rpm and yum-utils lib

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to packetary (master)

Reviewed: https://review.openstack.org/322978
Committed: https://git.openstack.org/cgit/openstack/packetary/commit/?id=07079a0b5557f9a6743d28b15e24f58565b62754
Submitter: Jenkins
Branch: master

commit 07079a0b5557f9a6743d28b15e24f58565b62754
Author: Sergey Kulanov <email address hidden>
Date: Mon May 30 23:03:32 2016 +0300

    [RPM] Use yum library for packages comparison

    Closes-bug: #1587032

    Change-Id: I8c857edb839a441b71864d915ef4a814463ed81b

Changed in packetary:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.