Bug 865377
| Summary: | Invalid result of compare_nvr | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Martin Magr <mmagr> |
| Component: | kobo | Assignee: | Daniel Mach <dmach> |
| Status: | CLOSED NOTABUG | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 17 | CC: | dmach, pschiffe |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2012-10-11 10:21:32 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
| Bug Depends On: | |||
| Bug Blocks: | 854258 | ||
I just found out, that if you fit version length, then result is OK. SO maybe it could be fixed with this:
n [1]: from kobo import rpmlib
In [2]: nvr_new = rpmlib.parse_nvr('man-pages-pl-0.30-2.el7')
In [3]: nvr_old = rpmlib.parse_nvr('man-pages-pl-0.24-13.el7')
In [4]: result = rpmlib.compare_nvr(nvr_new, nvr_old)
In [5]: result
Out[5]: 1
This is expected. RPM splits versions by dots and underscores and compares them part by part. If both parts are numeric, they are compared as numbers. 0.24 > 0.3 because 0 = 0 && 24 > 3 Yes, this is correct, however it is like this: man-pages-pl-0:0.24-13.el7 and man-pages-pl-1:0.3-2.el7 The problem is that comparison is ignoring the epoch number.. |
Description of problem: from kobo import rpmlib nvr_old = rpmlib.parse_nvr('man-pages-pl-0.24-13.el7') nvr_new = rpmlib.parse_nvr('man-pages-pl-0.3-2.el7') result = rpmlib.compare_nvr(nvr_new, nvr_old) Version-Release number of selected component (if applicable): kobo-rpmlib-0.3.6-1.fc17.noarch How reproducible: In [1]: from kobo import rpmlib In [2]: nvr_old = rpmlib.parse_nvr('man-pages-pl-0.24-13.el7') In [3]: nvr_new = rpmlib.parse_nvr('man-pages-pl-0.3-2.el7') In [4]: result = rpmlib.compare_nvr(nvr_new, nvr_old) In [5]: result Out[5]: -1 Actual results: 'man-pages-pl-0.3-2.el7' resulting to be older than 'man-pages-pl-0.24-13.el7' Expected results: 'man-pages-pl-0.3-2.el7' resulting to be newer (e.g. result=1) than 'man-pages-pl-0.24-13.el7' Additional info: None