summaryrefslogtreecommitdiff
path: root/src/evr.c
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-03-22 18:04:36 +0100
committerMichael Schroeder <mls@suse.de>2012-03-22 18:05:30 +0100
commit907753cf3e1232bd3abba50ccaf2a617dc24982f (patch)
treeb84a50515732e797aa3c690282139a4cde94c307 /src/evr.c
parent2ad7460342efc41c44e60b5e61a444d897b377b8 (diff)
downloadlibsolv-907753cf3e1232bd3abba50ccaf2a617dc24982f.tar.gz
libsolv-907753cf3e1232bd3abba50ccaf2a617dc24982f.tar.bz2
libsolv-907753cf3e1232bd3abba50ccaf2a617dc24982f.zip
- support distepoch handling in release, used by the M&M distros
Diffstat (limited to 'src/evr.c')
-rw-r--r--src/evr.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/evr.c b/src/evr.c
index a209e65..cdd7bd8 100644
--- a/src/evr.c
+++ b/src/evr.c
@@ -225,8 +225,27 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
return 0;
if (r1 && r2)
{
- if (mode != EVRCMP_MATCH || (s1 != ++r1 && s2 != ++r2))
- r = solv_vercmp(r1, s1, r2, s2);
+ r1++;
+ r2++;
+ if (mode != EVRCMP_MATCH || (s1 != r1 && s2 != r2))
+ {
+ if (pool->havedistepoch)
+ {
+ const char *d1, *d2;
+ for (d1 = r1; d1 < s1; d1++)
+ if (*d1 == ':')
+ break;
+ for (d2 = r2; d2 < s2; d2++)
+ if (*d2 == ':')
+ break;
+ /* XXX: promote just in one direction? */
+ 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);
+ }
+ else
+ r = solv_vercmp(r1, s1, r2, s2);
+ }
}
else if (mode == EVRCMP_MATCH_RELEASE)
{