- fix noprovide handling in findupdate
authorMichael Schroeder <mls@suse.de>
Thu, 28 May 2009 09:13:25 +0000 (11:13 +0200)
committerMichael Schroeder <mls@suse.de>
Thu, 28 May 2009 09:13:25 +0000 (11:13 +0200)
- add stringify hack
- add missing pool_lookup functions

src/policy.c
src/pool.c
src/pool.h
src/repodata.c
src/solver.c

index 64274ec..0782592 100644 (file)
@@ -528,6 +528,7 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
   Id p, pp, n, p2, pp2;
   Id obs, *obsp;
   Solvable *ps;
+  int haveprovobs = 0;
 
   queue_empty(qs);
 
@@ -576,6 +577,7 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
          /* here we have 'p' with a matching provides/obsoletes combination
           * thus flagging p as a valid update candidate for s
           */
+         haveprovobs = 1;
        }
       else
         continue;
@@ -587,7 +589,7 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
     }
   /* if we have found some valid candidates and noupdateprovide is not set, we're
      done. otherwise we fallback to all obsoletes */
-  if (!solv->noupdateprovide && qs->count)
+  if (!solv->noupdateprovide && haveprovobs)
     return;
   if (solv->obsoletes && solv->obsoletes[n - solv->installed->start])
     {
index 0921904..56d5747 100644 (file)
@@ -1641,4 +1641,72 @@ pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res)
   pool_trivial_installable_noobsoletesmap(pool, installedmap, pkgs, res, 0);
 }
 
+const char *
+pool_lookup_str(Pool *pool, Id entry, Id keyname)
+{
+  if (entry == SOLVID_POS && pool->pos.repo)
+    return repodata_lookup_str(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname);
+  if (entry <= 0)
+    return 0;
+  return solvable_lookup_str(pool->solvables + entry, keyname);
+}
+
+Id
+pool_lookup_id(Pool *pool, Id entry, Id keyname)
+{
+  if (entry == SOLVID_POS && pool->pos.repo)
+    return repodata_lookup_id(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname);
+  if (entry <= 0)
+    return 0;
+  return solvable_lookup_id(pool->solvables + entry, keyname);
+}
+
+unsigned int
+pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned int notfound)
+{
+  if (entry == SOLVID_POS && pool->pos.repo)
+    {
+      unsigned int value;
+      if (repodata_lookup_num(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, &value))
+       return value;
+      return notfound;
+    }
+  if (entry <= 0)
+    return notfound;
+  return solvable_lookup_num(pool->solvables + entry, keyname, notfound);
+}
+
+int
+pool_lookup_void(Pool *pool, Id entry, Id keyname)
+{
+  if (entry == SOLVID_POS && pool->pos.repo)
+    return repodata_lookup_void(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname);
+  if (entry <= 0)
+    return 0;
+  return solvable_lookup_void(pool->solvables + entry, keyname);
+}
+
+const unsigned char *
+pool_lookup_bin_checksum(Pool *pool, Id entry, Id keyname, Id *typep)
+{
+  if (entry == SOLVID_POS && pool->pos.repo)
+    return repodata_lookup_bin_checksum(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, typep);
+  if (entry <= 0)
+    return 0;
+  return solvable_lookup_bin_checksum(pool->solvables + entry, keyname, typep);
+}
+
+const char *
+pool_lookup_checksum(Pool *pool, Id entry, Id keyname, Id *typep)
+{
+  if (entry == SOLVID_POS && pool->pos.repo)
+    {
+      const unsigned char *chk = repodata_lookup_bin_checksum(pool->pos.repo->repodata + pool->pos.repodataid, SOLVID_POS, keyname, typep);
+      return chk ? repodata_chk2str(pool->pos.repo->repodata + pool->pos.repodataid, *typep, chk) : 0;
+    }
+  if (entry <= 0)
+    return 0;
+  return solvable_lookup_checksum(pool->solvables + entry, keyname, typep);
+}
+
 // EOF
index 4766fb0..085f004 100644 (file)
@@ -301,6 +301,13 @@ int pool_calc_installsizechange(Pool *pool, Map *installedmap);
 void pool_trivial_installable(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res);
 void pool_trivial_installable_noobsoletesmap(Pool *pool, Map *installedmap, Queue *pkgs, Queue *res, Map *noobsoletesmap);
 
+const char *pool_lookup_str(Pool *pool, Id entry, Id keyname);
+Id pool_lookup_id(Pool *pool, Id entry, Id keyname);
+unsigned int pool_lookup_num(Pool *pool, Id entry, Id keyname, unsigned int notfound);
+int pool_lookup_void(Pool *pool, Id entry, Id keyname);
+const unsigned char *pool_lookup_bin_checksum(Pool *pool, Id entry, Id keyname, Id *typep);
+const char *pool_lookup_checksum(Pool *pool, Id entry, Id keyname, Id *typep);
+
 
 /* loop over all providers of d */
 #define FOR_PROVIDES(v, vp, d)                                                 \
index be386e4..887da4d 100644 (file)
@@ -1389,10 +1389,11 @@ dataiterator_match(Dataiterator *di, Datamatcher *ma)
 {
   if (!repodata_stringify(di->pool, di->data, di->key, &di->kv, di->flags))
     return 0;
+  if (!ma)
+    return 1;
   return datamatcher_match(ma, di->kv.str);
 }
 
-
 /************************************************************************
  * data modify functions
  */
index f551865..e17205b 100644 (file)
@@ -21,7 +21,6 @@
 #include "bitmap.h"
 #include "pool.h"
 #include "util.h"
-#include "evr.h"
 #include "policy.h"
 #include "solverdebug.h"