Imported Upstream version 0.7.7 upstream/0.7.7
authorDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 27 Nov 2020 05:44:14 +0000 (14:44 +0900)
committerDongHun Kwak <dh0128.kwak@samsung.com>
Fri, 27 Nov 2020 05:44:14 +0000 (14:44 +0900)
17 files changed:
NEWS
VERSION.cmake
ext/testcase.c
package/libsolv.changes
package/libsolv.spec.in
src/order.c
src/policy.c
src/pool.c
src/pool.h
src/repo.h
src/repo_write.c
src/rules.c
src/solver.c
test/testcases/whatprovideswithdisabled/dup.t [new file with mode: 0644]
test/testcases/whatprovideswithdisabled/dup2.t [new file with mode: 0644]
test/testcases/whatprovideswithdisabled/forcebest_in.t [new file with mode: 0644]
test/testcases/whatprovideswithdisabled/forcebest_up.t [new file with mode: 0644]

diff --git a/NEWS b/NEWS
index d0bf75f..19caab7 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,13 @@
 This file contains the major changes between
 libsolv versions:
 
+Version 0.7.7
+- selected bug fixes:
+  * fix updating of too many packages in focusbest mode
+  * fix handling of disabled installed packages in distupgrade
+- new features
+  * new POOL_FLAG_WHATPROVIDESWITHDISABLED pool flag
+
 Version 0.7.6
 - selected bug fixes:
   * fix repository priority handling for multiversion packages
index 0811e42..87c236c 100644 (file)
@@ -49,5 +49,5 @@ SET(LIBSOLVEXT_SOVERSION "1")
 
 SET(LIBSOLV_MAJOR "0")
 SET(LIBSOLV_MINOR "7")
-SET(LIBSOLV_PATCH "6")
+SET(LIBSOLV_PATCH "7")
 
index fcebcfa..bd0643a 100644 (file)
@@ -152,6 +152,7 @@ static struct poolflags2str {
   { POOL_FLAG_NOOBSOLETESMULTIVERSION,      "noobsoletesmultiversion", 0 },
   { POOL_FLAG_ADDFILEPROVIDESFILTERED,      "addfileprovidesfiltered", 0 },
   { POOL_FLAG_NOWHATPROVIDESAUX,            "nowhatprovidesaux", 0 },
+  { POOL_FLAG_WHATPROVIDESWITHDISABLED,     "whatprovideswithdisabled", 0 },
   { 0, 0, 0 }
 };
 
index aee75cd..fbb4a72 100644 (file)
@@ -1,4 +1,12 @@
 -------------------------------------------------------------------
+Fri Oct 18 10:53:54 CEST 2019 - mls@suse.de
+
+- fix updating of too many packages in focusbest mode
+- fix handling of disabled installed packages in distupgrade
+- new POOL_FLAG_WHATPROVIDESWITHDISABLED pool flag
+- bump version to 0.7.7
+
+-------------------------------------------------------------------
 Wed Aug 28 14:49:19 CEST 2019 - mls@suse.de
 
 - Fix repository priority handling for multiversion packages
index b8985d5..cd56c67 100644 (file)
@@ -207,7 +207,7 @@ Perl bindings for libsolv.
 %setup -q
 
 %build
-%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
+%global _lto_cflags %{?_lto_cflags} -ffat-lto-objects
 export CFLAGS="%{optflags}"
 export CXXFLAGS="$CFLAGS"
 
index c45a9a2..b8d4b82 100644 (file)
@@ -598,6 +598,7 @@ breakcycle(struct orderdata *od, Id *cycle)
   POOL_DEBUG(SOLV_DEBUG_STATS, "\n");
 }
 
+#if 0
 static inline void
 dump_tes(struct orderdata *od)
 {
@@ -628,6 +629,7 @@ dump_tes(struct orderdata *od)
        }
     }
 }
+#endif
 
 static void
 reachable(struct orderdata *od, Id i)
index 823a008..10a2c4d 100644 (file)
@@ -1579,6 +1579,8 @@ policy_findupdatepackages(Solver *solv, Solvable *s, Queue *qs, int allow_all)
        continue;
 
       ps = pool->solvables + p;
+      if (pool->considered && pool->whatprovideswithdisabled && ps->repo != pool->installed && pool_disabled_solvable(pool, ps)) 
+       continue;
       if (s->name == ps->name) /* name match */
        {
          if (pool->implicitobsoleteusescolors && !pool_colormatch(pool, s, ps))
index 4b63727..76636a7 100644 (file)
@@ -202,6 +202,8 @@ pool_get_flag(Pool *pool, int flag)
       return pool->addfileprovidesfiltered;
     case POOL_FLAG_NOWHATPROVIDESAUX:
       return pool->nowhatprovidesaux;
+    case POOL_FLAG_WHATPROVIDESWITHDISABLED:
+      return pool->whatprovideswithdisabled;
     default:
       break;
     }
@@ -247,6 +249,9 @@ pool_set_flag(Pool *pool, int flag, int value)
     case POOL_FLAG_NOWHATPROVIDESAUX:
       pool->nowhatprovidesaux = value;
       break;
+    case POOL_FLAG_WHATPROVIDESWITHDISABLED:
+      pool->whatprovideswithdisabled = value;
+      break;
     default:
       break;
     }
@@ -450,7 +455,6 @@ pool_createwhatprovides(Pool *pool)
   Offset *whatprovides;
   Id *whatprovidesdata, *dp, *whatprovidesauxdata;
   Offset *whatprovidesaux;
-  Repo *installed = pool->installed;
   unsigned int now;
 
   now = solv_timems(0);
@@ -473,9 +477,7 @@ pool_createwhatprovides(Pool *pool)
       s = pool->solvables + i;
       if (!s->provides || !s->repo || s->repo->disabled)
        continue;
-      /* we always need the installed solvable in the whatprovides data,
-         otherwise obsoletes/conflicts on them won't work */
-      if (s->repo != installed && !pool_installable(pool, s))
+      if (!pool_installable_whatprovides(pool, s))
        continue;
       pp = s->repo->idarraydata + s->provides;
       while ((id = *pp++) != 0)
@@ -534,9 +536,8 @@ pool_createwhatprovides(Pool *pool)
       s = pool->solvables + i;
       if (!s->provides || !s->repo || s->repo->disabled)
        continue;
-      if (s->repo != installed && !pool_installable(pool, s))
+      if (!pool_installable_whatprovides(pool, s))
        continue;
-
       /* for all provides of this solvable */
       pp = s->repo->idarraydata + s->provides;
       while ((id = *pp++) != 0)
@@ -963,7 +964,7 @@ pool_addstdproviders(Pool *pool, Id d)
        * and those should not use filelist entries */
       if (s->repo->disabled)
        continue;
-      if (s->repo != pool->installed && !pool_installable(pool, s))
+      if (!pool_installable_whatprovides(pool, s))
        continue;
       queue_push(&q, di.solvid);
     }
@@ -1243,7 +1244,7 @@ pool_addrelproviders(Pool *pool, Id d)
              FOR_POOL_SOLVABLES(p)
                {
                  Solvable *s = pool->solvables + p;
-                 if (s->repo != pool->installed && !pool_installable(pool, s))
+                 if (!pool_installable_whatprovides(pool, s))
                    continue;
                  if (s->arch == evr)
                    queue_push(&plist, p);
index c90c29a..aa173ea 100644 (file)
@@ -166,6 +166,7 @@ struct s_Pool {
   Id *whatprovidesauxdata;
   Offset whatprovidesauxdataoff;
 
+  int whatprovideswithdisabled;
 #endif
 };
 
@@ -204,6 +205,7 @@ struct s_Pool {
 #define POOL_FLAG_ADDFILEPROVIDESFILTERED              9
 #define POOL_FLAG_IMPLICITOBSOLETEUSESCOLORS           10
 #define POOL_FLAG_NOWHATPROVIDESAUX                    11
+#define POOL_FLAG_WHATPROVIDESWITHDISABLED             12
 
 /* ----------------------------------------------- */
 
index 58704f1..9a5e981 100644 (file)
@@ -123,6 +123,26 @@ static inline int pool_installable(const Pool *pool, Solvable *s)
   return 1;
 }
 
+#ifdef LIBSOLV_INTERNAL
+static inline int pool_installable_whatprovides(const Pool *pool, Solvable *s)
+{
+  /* we always need the installed solvable in the whatprovides data,
+     otherwise obsoletes/conflicts on them won't work */
+  if (s->repo != pool->installed)
+    {
+      if (s->arch == ARCH_SRC || s->arch == ARCH_NOSRC || pool_badarch_solvable(pool, s))
+       return 0;
+      if (pool->considered && !pool->whatprovideswithdisabled)
+       {
+         Id id = s - pool->solvables;
+         if (!MAPTST(pool->considered, id))
+           return 0;
+       }
+    }
+  return 1;
+}
+#endif
+
 /* not in solvable.h because we need the repo definition */
 static inline Solvable *solvable_free(Solvable *s, int reuseids)
 {
index d3b8a83..2a03e58 100644 (file)
@@ -187,16 +187,6 @@ write_id(Repodata *data, Id x)
 }
 
 static inline void
-write_id_eof(Repodata *data, Id x, int eof)
-{
-  if (x >= 64)
-    x = (x & 63) | ((x & ~63) << 1);
-  write_id(data, x | (eof ? 0 : 64));
-}
-
-
-
-static inline void
 write_str(Repodata *data, const char *str)
 {
   if (data->error)
index 3aef6ee..57895c0 100644 (file)
@@ -1373,6 +1373,14 @@ solver_addupdaterule(Solver *solv, Solvable *s)
   int dupinvolved = 0;
 
   p = s - pool->solvables;
+
+  if (pool->considered && pool_disabled_solvable(pool, s))
+    {
+      /* disabled installed solvables must stay installed */
+      solver_addrule(solv, p, 0, 0);
+      return;
+    }
+
   /* Orphan detection. We cheat by looking at the feature rule, which
    * we already calculated */
   r = solv->rules + solv->featurerules + (p - solv->installed->start);
@@ -2003,6 +2011,8 @@ solver_addduprules(Solver *solv, Map *addedmap)
            continue;
          if (installed && ps->repo == installed)
            {
+             if (pool->considered && pool_disabled_solvable(pool, ps))
+               continue;               /* always keep disabled installed packages */
              if (!MAPTST(&solv->dupmap, p))
                {
                  Id ip, ipp;
@@ -3323,6 +3333,21 @@ prune_best_update(Solver *solv, Id p, Queue *q)
   policy_filter_unwanted(solv, q, POLICY_MODE_RECOMMEND);
 }
 
+static void
+prune_disabled(Pool *pool, Queue *q)
+{
+  int i, j;
+  for (i = j = 0; i < q->count; i++)
+    {
+      Id p = q->elements[i];
+      Solvable *s = pool->solvables + p;
+      if (s->repo && s->repo != pool->installed && !MAPTST(pool->considered, p))
+       continue;
+      q->elements[j++] = p;
+    }
+  queue_truncate(q, j);
+}
+
 void
 solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
 {
@@ -3377,6 +3402,8 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
                      else if (p2 < 0)
                        queue_push(&q2, p2);
                    }
+                 if (pool->considered && pool->whatprovideswithdisabled)
+                   prune_disabled(pool, &q);
                  if (!q.count)
                    continue;   /* orphaned */
                  /* select best packages, just look at prio and version */
@@ -3386,6 +3413,8 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
                    continue;   /* nothing filtered */
                  if (lockedmap)
                    {
+                     queue_insertn(&q, 0, q2.count, q2.elements);
+                     queue_empty(&q2);
                      FOR_RULELITERALS(p2, pp2, r)
                        {
                          if (p2 <= 0)
@@ -3399,9 +3428,12 @@ solver_addbestrules(Solver *solv, int havebestinstalljobs, int haslockjob)
                            continue;
                          queue_push(&q2, p2);
                        }
+                     if (pool->considered && pool->whatprovideswithdisabled)
+                       prune_disabled(pool, &q2);
                      policy_filter_unwanted(solv, &q2, POLICY_MODE_RECOMMEND);
                      for (k = 0; k < q2.count; k++)
                        queue_pushunique(&q, q2.elements[k]);
+                     queue_empty(&q2);
                    }
                  if (q2.count)
                    queue_insertn(&q, 0, q2.count, q2.elements);
index 5453b39..45f9dbf 100644 (file)
@@ -1910,6 +1910,8 @@ resolve_dependencies(Solver *solv, int level, int disablerules, Queue *dq)
   Rule *r;
   int origlevel = level;
   Id p, *dp;
+  int focusbest = solv->focus_best && solv->do_extra_reordering;
+  Repo *installed = solv->installed;
 
   /*
    * decide
@@ -1928,7 +1930,7 @@ resolve_dependencies(Solver *solv, int level, int disablerules, Queue *dq)
        }
       if (i == solv->nrules)
        i = 1;
-      if (solv->focus_best && solv->do_extra_reordering && i >= solv->featurerules)
+      if (focusbest && i >= solv->featurerules)
        continue;
       r = solv->rules + i;
       if (r->d < 0)            /* ignore disabled rules */
@@ -1938,6 +1940,19 @@ resolve_dependencies(Solver *solv, int level, int disablerules, Queue *dq)
          if (r->d == 0 || solv->decisionmap[-r->p] <= 0)
            continue;
        }
+      if (focusbest && r->d != 0 && installed)
+       {
+         /* make sure at least one negative literal is from a new package */
+         if (!(r->p < 0 && pool->solvables[-r->p].repo != installed))
+           {
+             dp = pool->whatprovidesdata + r->d;
+             while ((p = *dp++) != 0)
+               if (p < 0 && solv->decisionmap[-p] > 0 && pool->solvables[-p].repo != installed)
+                 break;
+             if (!p)
+               continue;               /* sorry */
+           }
+       }
       if (dq->count)
        queue_empty(dq);
       if (r->d == 0)
diff --git a/test/testcases/whatprovideswithdisabled/dup.t b/test/testcases/whatprovideswithdisabled/dup.t
new file mode 100644 (file)
index 0000000..825a0c4
--- /dev/null
@@ -0,0 +1,14 @@
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Vnd: foo
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+system i686 rpm system
+poolflags whatprovideswithdisabled
+
+disable pkg A-2-1.noarch@available
+
+job distupgrade all packages
+result transaction,problems <inline>
+
diff --git a/test/testcases/whatprovideswithdisabled/dup2.t b/test/testcases/whatprovideswithdisabled/dup2.t
new file mode 100644 (file)
index 0000000..40fe69e
--- /dev/null
@@ -0,0 +1,14 @@
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Vnd: foo
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+system i686 rpm system
+poolflags whatprovideswithdisabled
+
+disable pkg A-1-1.noarch@system
+
+job distupgrade all packages
+result transaction,problems <inline>
+
diff --git a/test/testcases/whatprovideswithdisabled/forcebest_in.t b/test/testcases/whatprovideswithdisabled/forcebest_in.t
new file mode 100644 (file)
index 0000000..da5a440
--- /dev/null
@@ -0,0 +1,19 @@
+repo system 0 testtags <inline>
+#>=Pkg: D 1 1 noarch
+#>=Vnd: foo
+#>=Con: A = 3-1
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+#>=Pkg: A 3 1 noarch
+#>=Vnd: bar
+system i686 rpm system
+
+poolflags whatprovideswithdisabled
+disable pkg A-3-1.noarch@available
+
+job install name A [forcebest]
+result transaction,problems <inline>
+#>install A-2-1.noarch@available
+
+
diff --git a/test/testcases/whatprovideswithdisabled/forcebest_up.t b/test/testcases/whatprovideswithdisabled/forcebest_up.t
new file mode 100644 (file)
index 0000000..f6f5379
--- /dev/null
@@ -0,0 +1,20 @@
+repo system 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Vnd: foo
+#>=Pkg: D 1 1 noarch
+#>=Vnd: foo
+#>=Con: A = 3-1
+repo available 0 testtags <inline>
+#>=Pkg: A 2 1 noarch
+#>=Vnd: foo
+#>=Pkg: A 3 1 noarch
+#>=Vnd: bar
+system i686 rpm system
+
+poolflags whatprovideswithdisabled
+disable pkg A-3-1.noarch@available
+
+job install name A [forcebest]
+result transaction,problems <inline>
+#>upgrade A-1-1.noarch@system A-2-1.noarch@available
+