summaryrefslogtreecommitdiff
path: root/src/evr.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-04-24 16:26:53 +0200
committerMichael Schroeder <mls@suse.de>2012-04-24 16:26:53 +0200
commitc02d7594b6c1f68fb227095072f556194a726367 (patch)
tree73deba123711ac91682dcebbd534b59c2493dc5b /src/evr.c
parent7eb79cd7cb28b5eb639cc113ef65d57916d96656 (diff)
downloadlibsolv-c02d7594b6c1f68fb227095072f556194a726367.tar.gz
libsolv-c02d7594b6c1f68fb227095072f556194a726367.tar.bz2
libsolv-c02d7594b6c1f68fb227095072f556194a726367.zip
treat an empty release as a missing release
i.e. "Requires: foo = 4-" as "Requires: foo = 4"
Diffstat (limited to 'src/evr.c')
-rw-r--r--src/evr.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/evr.c b/src/evr.c
index 4de8d64..cbb0fb0 100644
--- a/src/evr.c
+++ b/src/evr.c
@@ -308,6 +308,14 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
}
if (mode == EVRCMP_COMPARE_EVONLY)
return 0;
+ if (mode == EVRCMP_MATCH_RELEASE)
+ {
+ /* rpm treats empty releases as missing, i.e "foo = 4-" is the same as "foo = 4" */
+ if (r1 && r1 + 1 == s1)
+ r1 = 0;
+ if (r2 && r2 + 1 == s2)
+ r2 = 0;
+ }
if (r1 && r2)
{
r1++;
@@ -324,9 +332,9 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
if (*d2 == ':')
break;
/* XXX: promote just in one direction? */
- r = solv_vercmp(r1, d1 ? d1 : s1, r2, d2 ? d2 : s2);
+ r = solv_vercmp(r1, d1 ? d1 : s1, r2, d2 ? d2 : s2);
if (r == 0 && d1 < s1 && d2 < s2)
- r = solv_vercmp(d1 + 1, s1, d2 + 1, s2);
+ r = solv_vercmp(d1 + 1, s1, d2 + 1, s2);
}
else
r = solv_vercmp(r1, s1, r2, s2);