[hotfix] Relax solvable_identical check for producs [bnc#881493]
[platform/upstream/libsolv.git] / src / solvable.c
index 108d2f0..b3e73a6 100644 (file)
@@ -51,6 +51,7 @@ pool_solvable2str(Pool *pool, Solvable *s)
     {
       p[nl++] = '-';
       strncpy(p + nl, e, el);
+      p[nl + el] = 0;
     }
   if (al)
     {
@@ -171,9 +172,18 @@ solvable_lookup_str_base(Solvable *s, Id keyname, Id basekeyname, int usebase)
            return str;
        }
 #ifdef ENABLE_LINKED_PKGS
-      /* autopattern translation magic */
-      if (pass && !strncmp("pattern:", pool_id2str(pool, name), 8) && (name = find_autopattern_name(pool, s)) != 0)
-       pass = -1;
+      /* autopattern/product translation magic */
+      if (pass)
+       {
+         const char *n = pool_id2str(pool, name);
+         if (*n == 'p')
+           {
+             if (!strncmp("pattern:", n, 8) && (name = find_autopattern_name(pool, s)) != 0)
+               pass = -1;
+             if (!strncmp("product:", n, 8) && (name = find_autoproduct_name(pool, s)) != 0)
+               pass = -1;
+           }
+       }
 #endif
     }
   return usebase ? basestr : 0;
@@ -403,7 +413,7 @@ static inline Id dep2name(Pool *pool, Id dep)
 {
   while (ISRELDEP(dep))
     {
-      Reldep *rd = rd = GETRELDEP(pool, dep);
+      Reldep *rd = GETRELDEP(pool, dep);
       dep = rd->name;
     }
   return dep;
@@ -735,19 +745,27 @@ pool_create_state_maps(Pool *pool, Queue *installed, Map *installedmap, Map *con
 /* Tests if two solvables have identical content. Currently
  * both solvables need to come from the same pool
  */
+
+#warning HOTFIX [Bug 881493] New: zypper dup does always update sles-release
+inline int isProduct(const char *name)
+{ return name && strncmp(name, "product:", 8) == 0; }
+
 int
 solvable_identical(Solvable *s1, Solvable *s2)
 {
   unsigned int bt1, bt2;
   Id rq1, rq2;
   Id *reqp;
-
   if (s1->name != s2->name)
     return 0;
   if (s1->arch != s2->arch)
     return 0;
   if (s1->evr != s2->evr)
     return 0;
+
+  if (isProduct(pool_id2str(s1->repo->pool, s1->name))) // HOTFIX [Bug 881493] end check for products here
+    return 1;
+
   /* map missing vendor to empty string */
   if ((s1->vendor ? s1->vendor : 1) != (s2->vendor ? s2->vendor : 1))
     return 0;