Imported Upstream version 0.7.2
[platform/upstream/libsolv.git] / src / evr.c
index a7d4311..c63878e 100644 (file)
--- a/src/evr.c
+++ b/src/evr.c
@@ -77,10 +77,10 @@ solv_vercmp_rpm(const char *s1, const char *q1, const char *s2, const char *q2)
   for (;;)
     {
       while (s1 < q1 && !(*s1 >= '0' && *s1 <= '9') &&
-          !(*s1 >= 'a' && *s1 <= 'z') && !(*s1 >= 'A' && *s1 <= 'Z') && *s1 != '~')
+          !(*s1 >= 'a' && *s1 <= 'z') && !(*s1 >= 'A' && *s1 <= 'Z') && *s1 != '~' && *s1 != '^')
        s1++;
       while (s2 < q2 && !(*s2 >= '0' && *s2 <= '9') &&
-          !(*s2 >= 'a' && *s2 <= 'z') && !(*s2 >= 'A' && *s2 <= 'Z') && *s2 != '~')
+          !(*s2 >= 'a' && *s2 <= 'z') && !(*s2 >= 'A' && *s2 <= 'Z') && *s2 != '~' && *s2 != '^')
        s2++;
       if (s1 < q1 && *s1 == '~')
         {
@@ -94,6 +94,18 @@ solv_vercmp_rpm(const char *s1, const char *q1, const char *s2, const char *q2)
         }
       if (s2 < q2 && *s2 == '~')
        return 1;
+      if (s1 < q1 && *s1 == '^')
+       {
+         if (s2 < q2 && *s2 == '^')
+           {
+             s1++;
+             s2++;
+             continue;
+           }
+         return s2 < q2 ? -1 : 1;
+       }
+      if (s2 < q2 && *s2 == '^')
+       return s1 < q1 ? 1 : -1;
       if (s1 >= q1 || s2 >= q2)
        break;
       if ((*s1 >= '0' && *s1 <= '9') || (*s2 >= '0' && *s2 <= '9'))