summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Schroeder <mls@suse.de>2012-02-22 13:24:36 +0100
committerMichael Schroeder <mls@suse.de>2012-02-22 13:24:36 +0100
commitdc62cb2ebf49314da629de9fa4e0bb1fb47c3451 (patch)
tree8e84549c19584a12325f12af66792303a413a1bb /src
parent9719138694aecbc578cc2bb3c8ea02ce1bc8fea5 (diff)
downloadlibsolv-dc62cb2ebf49314da629de9fa4e0bb1fb47c3451.tar.gz
libsolv-dc62cb2ebf49314da629de9fa4e0bb1fb47c3451.tar.bz2
libsolv-dc62cb2ebf49314da629de9fa4e0bb1fb47c3451.zip
- adapt to rpm changes regarding cornercases where the release is missing
Diffstat (limited to 'src')
-rw-r--r--src/evr.c9
-rw-r--r--src/pool.c45
2 files changed, 39 insertions, 15 deletions
diff --git a/src/evr.c b/src/evr.c
index c8cc940..a209e65 100644
--- a/src/evr.c
+++ b/src/evr.c
@@ -225,9 +225,16 @@ pool_evrcmp_str(const Pool *pool, const char *evr1, const char *evr2, int mode)
return 0;
if (r1 && r2)
{
- if (s1 != ++r1 && s2 != ++r2)
+ if (mode != EVRCMP_MATCH || (s1 != ++r1 && s2 != ++r2))
r = solv_vercmp(r1, s1, r2, s2);
}
+ else if (mode == EVRCMP_MATCH_RELEASE)
+ {
+ if (!r1 && r2)
+ return -2;
+ if (r1 && !r2)
+ return 2;
+ }
return r;
}
diff --git a/src/pool.c b/src/pool.c
index 9f6198e..99bc332 100644
--- a/src/pool.c
+++ b/src/pool.c
@@ -546,15 +546,26 @@ pool_match_nevr_rel(Pool *pool, Solvable *s, Id d)
if (!pool_match_nevr(pool, s, name))
return 0;
if (evr == s->evr)
- return flags & 2 ? 1 : 0;
+ return (flags & REL_EQ) ? 1 : 0;
if (!flags)
return 0;
if (flags == 7)
return 1;
- if (flags != 2 && flags != 5)
- flags ^= 5;
- if ((flags & (1 << (1 + pool_evrcmp(pool, s->evr, evr, EVRCMP_DEPCMP)))) != 0)
- return 1;
+ switch (pool_evrcmp(pool, s->evr, evr, EVRCMP_DEPCMP))
+ {
+ case -2:
+ return 1;
+ case -1:
+ return (flags & REL_LT) ? 1 : 0;
+ case 0:
+ return (flags & REL_EQ) ? 1 : 0;
+ case 1:
+ return (flags & REL_GT) ? 1 : 0;
+ case 2:
+ return (flags & REL_EQ) ? 1 : 0;
+ default:
+ break;
+ }
return 0;
}
@@ -566,18 +577,24 @@ pool_match_flags_evr(Pool *pool, int pflags, Id pevr, int flags, int evr)
return 0;
if (flags == 7 || pflags == 7)
return 1; /* rel provides every version */
- if ((pflags & flags & 5) != 0)
+ if ((pflags & flags & (REL_LT | REL_GT)) != 0)
return 1; /* both rels show in the same direction */
if (pevr == evr)
+ return (flags & pflags & REL_EQ) ? 1 : 0;
+ switch (pool_evrcmp(pool, pevr, evr, EVRCMP_DEPCMP))
{
- if ((pflags & flags & 2) != 0)
- return 1; /* both have '=', match */
- }
- else
- {
- int f = flags == 5 ? 5 : flags == 2 ? pflags : (flags ^ 5) & (pflags | 5);
- if ((f & (1 << (1 + pool_evrcmp(pool, pevr, evr, EVRCMP_DEPCMP)))) != 0)
- return 1;
+ case -2:
+ return (pflags & REL_EQ) ? 1 : 0;
+ case -1:
+ return (flags & REL_LT) || (pflags & REL_GT) ? 1 : 0;
+ case 0:
+ return (flags & pflags & REL_EQ) ? 1 : 0;
+ case 1:
+ return (flags & REL_GT) || (pflags & REL_LT) ? 1 : 0;
+ case 2:
+ return (flags & REL_EQ) ? 1 : 0;
+ default:
+ break;
}
return 0;
}