Add support for Haiku compat version comparison
authorIngo Weinhold <ingo_weinhold@gmx.de>
Sat, 30 Mar 2013 13:22:24 +0000 (13:22 +0000)
committerMichael Schroeder <mls@suse.de>
Tue, 16 Apr 2013 09:09:45 +0000 (11:09 +0200)
src/pool.c
src/pool.h

index 2bcb71c..f5dfc40 100644 (file)
@@ -611,6 +611,19 @@ pool_match_flags_evr(Pool *pool, int pflags, Id pevr, int flags, int evr)
     return 1;          /* both rels show in the same direction */
   if (pevr == evr)
     return (flags & pflags & REL_EQ) ? 1 : 0;
+  if (ISRELDEP(pevr))
+    {
+      Reldep *range = GETRELDEP(pool, pevr);
+      if (range->flags != REL_COMPAT)
+        return 0;      /* unsupported */
+      /* range->name is the backwards compatibility version, range->evr the
+         actual version. If flags are '>=' or '>', we match the compatibility
+         version as well, otherwise only the actual version. */
+      if (!(flags & REL_GT) || (flags & REL_LT))
+        return pool_match_flags_evr(pool, REL_EQ, range->evr, flags, evr);
+      return pool_match_flags_evr(pool, REL_LT | REL_EQ, range->evr, flags, evr) && 
+        pool_match_flags_evr(pool, REL_GT | REL_EQ, range->name, REL_EQ, evr);
+    }
   switch (pool_evrcmp(pool, pevr, evr, EVRCMP_DEPCMP))
     {
     case -2:
index bed2052..b40c88d 100644 (file)
@@ -202,6 +202,7 @@ struct _Pool {
 #define REL_ARCH       20
 #define REL_FILECONFLICT       21
 #define REL_COND       22
+#define REL_COMPAT     23
 
 #if !defined(__GNUC__) && !defined(__attribute__)
 # define __attribute__(x)