Bugzilla (bugzilla.redhat.com) will be under maintenance for infrastructure upgrades and will not be available on July 31st between 12:30 AM - 05:30 AM UTC. We appreciate your understanding and patience. You can follow status.redhat.com for details.
Bug 1409778 - repoman Version Comparison Does not Match RPM Version Comparison
Summary: repoman Version Comparison Does not Match RPM Version Comparison
Alias: None
Product: Repoman
Classification: Community
Component: Core
Version: unspecified
Hardware: Unspecified
OS: Unspecified
Target Milestone: 1.3
Assignee: Anton Marchukov
QA Contact: Eyal Edri
Depends On:
TreeView+ depends on / blocked
Reported: 2017-01-03 10:52 UTC by Anton Marchukov
Modified: 2017-01-03 17:23 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Last Closed:

Attachments (Terms of Use)

Description Anton Marchukov 2017-01-03 10:52:29 UTC
Description of problem:

repoman uses it's own code to compare version that differs from what is actually used by RPM. Also it is not possible to have single version comparison logic is different in different package manager and thus it is not possible to provide a single solution.

This should be made dependent on artifact type and if possible the corresponding library should be used to do comparison instead of own code.

> print cmpfullver('1.0-1.el7.centos', '1.0-1.20170103101841.git17e7bc0.el7.centos')


> rpmdev-vercmp 1.0-1.el7.centos 1.0-1.20161229142437.git17e7bc0.el7.centos
1.0-1.el7.centos < 1.0-1.20161229142437.git17e7bc0.el7.centos

Comment 1 Anton Marchukov 2017-01-03 13:21:25 UTC
Also and addition to the bug found during looking on the source code. As I see RPM_EPOCH is not being handled and compared also. At least hdr[rpm.RPMTAG_EPOCH] is not referenced anywhere.

Comment 2 Anton Marchukov 2017-01-03 17:23:07 UTC
Just to note to avoid confusion. cmpfullver for some reason uses output values inverted to what regular cmp [1] function will use:

> print cmpfullver('0', '1')

> print cmpfullver('1', '0')

> print cmpfullver('0', '0')


> print cmp('0', '1')

> print cmp('1', '0')

> print cmp('0', '0')
[1] https://docs.python.org/2/library/functions.html#cmp

Note You need to log in before you can comment on or make changes to this bug.