- support distepoch handling in release, used by the M&M distros
authorMichael Schroeder <mls@suse.de>
Thu, 22 Mar 2012 17:04:36 +0000 (18:04 +0100)
committerMichael Schroeder <mls@suse.de>
Thu, 22 Mar 2012 17:05:30 +0000 (18:05 +0100)
ext/testcase.c
src/evr.c
src/pool.h

index 15579db..7081f9d 100644 (file)
@@ -103,6 +103,7 @@ static struct poolflags2str {
   { POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES, "implicitobsoleteusesprovides", 0 },
   { POOL_FLAG_OBSOLETEUSESCOLORS,           "obsoleteusescolors", 0 },
   { POOL_FLAG_NOINSTALLEDOBSOLETES,         "noinstalledobsoletes", 0 },
+  { POOL_FLAG_HAVEDISTEPOCH,                "havedistepoch", 0 },
   { 0, 0, 0 }
 };
 
index a209e65..cdd7bd8 100644 (file)
--- 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)
     {
index cbc8e1a..7b149de 100644 (file)
@@ -122,6 +122,7 @@ struct _Pool {
 #ifdef LIBSOLV_INTERNAL
   /* flags to tell the library how the installed package manager works */
   int promoteepoch;            /* true: missing epoch is replaced by epoch of dependency   */
+  int havedistepoch;           /* true: thr release part in the evr may contain a distepoch suffix */
   int obsoleteusesprovides;    /* true: obsoletes are matched against provides, not names */
   int implicitobsoleteusesprovides;    /* true: implicit obsoletes due to same name are matched against provides, not names */
   int obsoleteusescolors;      /* true: obsoletes check arch color */
@@ -167,6 +168,7 @@ struct _Pool {
 #define POOL_FLAG_IMPLICITOBSOLETEUSESPROVIDES         4
 #define POOL_FLAG_OBSOLETEUSESCOLORS                   5
 #define POOL_FLAG_NOINSTALLEDOBSOLETES                 6
+#define POOL_FLAG_HAVEDISTEPOCH                                7
 
 /* ----------------------------------------------- */