Merge pull request #44 from akozumpl/archs
[platform/upstream/libsolv.git] / src / solvable.c
index c07f4c8..8e94976 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;
@@ -392,7 +402,7 @@ solvable_lookup_sourcepkg(Solvable *s)
       str = pool_tmpappend(pool, str, ".", pool_id2str(pool, archid));
       return pool_tmpappend(pool, str, ".rpm", 0);
     }
-  else 
+  else
     return name;       /* FIXME */
 }
 
@@ -403,20 +413,20 @@ 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;
 }
 
-static int providedbyinstalled_multiversion(Pool *pool, Map *installed, Id n, Id con) 
+static int providedbyinstalled_multiversion(Pool *pool, Map *installed, Id n, Id con)
 {
   Id p, pp;
-  Solvable *sn = pool->solvables + n; 
+  Solvable *sn = pool->solvables + n;
 
   FOR_PROVIDES(p, pp, sn->name)
-    {    
-      Solvable *s = pool->solvables + p; 
+    {
+      Solvable *s = pool->solvables + p;
       if (s->name != sn->name || s->arch != sn->arch)
         continue;
       if (!MAPTST(installed, p))
@@ -424,7 +434,7 @@ static int providedbyinstalled_multiversion(Pool *pool, Map *installed, Id n, Id
       if (pool_match_nevr(pool, pool->solvables + p, con))
         continue;
       return 1;         /* found installed package that doesn't conflict */
-    }    
+    }
   return 0;
 }
 
@@ -616,7 +626,7 @@ solvable_trivial_installable_repo(Solvable *s, Repo *installed, Map *multiversio
 static int
 pool_illegal_vendorchange(Pool *pool, Solvable *s1, Solvable *s2)
 {
-  Id v1, v2; 
+  Id v1, v2;
   Id vendormask1, vendormask2;
 
   if (pool->custom_vendorcheck)
@@ -624,7 +634,7 @@ pool_illegal_vendorchange(Pool *pool, Solvable *s1, Solvable *s2)
   /* treat a missing vendor as empty string */
   v1 = s1->vendor ? s1->vendor : ID_EMPTY;
   v2 = s2->vendor ? s2->vendor : ID_EMPTY;
-  if (v1 == v2) 
+  if (v1 == v2)
     return 0;
   vendormask1 = pool_vendor2mask(pool, v1);
   if (!vendormask1)
@@ -695,7 +705,7 @@ solvable_is_irrelevant_patch(Solvable *s, Map *installedmap)
 /*
  * Create maps containing the state of each solvable. Input is a "installed" queue,
  * it contains all solvable ids that are considered to be installed.
- * 
+ *
  * The created maps can be used for solvable_trivial_installable_map(),
  * pool_calc_duchanges(), pool_calc_installsizechange().
  *