]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
policy.c: Fix solver_prune_to_highest_prio_per_name 221/head
authorEric Yu <eric.yu@ni.com>
Tue, 22 Aug 2017 17:18:38 +0000 (12:18 -0500)
committerEric Yu <eric.yu@ni.com>
Tue, 22 Aug 2017 17:45:52 +0000 (12:45 -0500)
- Fixed logic so that all packages with the same name are pushed to the queue
  of packages to be pruned instead of just the first package with that name.
- This fixes a bug where the best version of recommended and suggested packages
  were not being returned.
- Added tests to check that this does fix the problem with recommended and
  suggested packages mentioned above.

src/policy.c
test/testcases/recommendations/recommended_conflicts.t [new file with mode: 0644]
test/testcases/recommendations/recommended_multirepo.t [new file with mode: 0644]
test/testcases/recommendations/recommended_oldversion.t [new file with mode: 0644]
test/testcases/recommendations/recommended_targeted.t [new file with mode: 0644]
test/testcases/recommendations/recommended_version.t [new file with mode: 0644]
test/testcases/recommendations/suggested_conflicts.t [new file with mode: 0644]
test/testcases/recommendations/suggested_multirepo.t [new file with mode: 0644]
test/testcases/recommendations/suggested_oldversion.t [new file with mode: 0644]
test/testcases/recommendations/suggested_targeted.t [new file with mode: 0644]
test/testcases/recommendations/suggested_version.t [new file with mode: 0644]

index a6d34415fe73fd59928ff2948d42e023accbb4a7..185561ed33fda563c678ca38d81b1557752b0f23 100644 (file)
@@ -210,6 +210,8 @@ solver_prune_to_highest_prio_per_name(Solver *solv, Queue *plist)
          queue_push(&pq, plist->elements[i]);
          name = pool->solvables[pq.elements[0]].name;
        }
+      else
+         queue_push(&pq, plist->elements[i]);
     }
   if (pq.count > 2)
     solver_prune_to_highest_prio(solv, &pq);
diff --git a/test/testcases/recommendations/recommended_conflicts.t b/test/testcases/recommendations/recommended_conflicts.t
new file mode 100644 (file)
index 0000000..2e28871
--- /dev/null
@@ -0,0 +1,16 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Rec: B
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Con: A
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>recommended B-2-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/recommended_multirepo.t b/test/testcases/recommendations/recommended_multirepo.t
new file mode 100644 (file)
index 0000000..9fc60d0
--- /dev/null
@@ -0,0 +1,19 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Rec: B
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+repo other 0 testtags <inline>
+#>=Pkg: B 4 1 noarch
+#>=Pkg: B 6 1 noarch
+#>=Pkg: B 5 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>recommended B-6-1.noarch@other
\ No newline at end of file
diff --git a/test/testcases/recommendations/recommended_oldversion.t b/test/testcases/recommendations/recommended_oldversion.t
new file mode 100644 (file)
index 0000000..f7a1a62
--- /dev/null
@@ -0,0 +1,15 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Rec: B < 3
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>recommended B-2-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/recommended_targeted.t b/test/testcases/recommendations/recommended_targeted.t
new file mode 100644 (file)
index 0000000..d5a0b15
--- /dev/null
@@ -0,0 +1,15 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Rec: B = 2-1
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>recommended B-2-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/recommended_version.t b/test/testcases/recommendations/recommended_version.t
new file mode 100644 (file)
index 0000000..3a87513
--- /dev/null
@@ -0,0 +1,15 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Rec: B
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>recommended B-3-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/suggested_conflicts.t b/test/testcases/recommendations/suggested_conflicts.t
new file mode 100644 (file)
index 0000000..fa83413
--- /dev/null
@@ -0,0 +1,16 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Sug: B
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Con: A
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>suggested B-2-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/suggested_multirepo.t b/test/testcases/recommendations/suggested_multirepo.t
new file mode 100644 (file)
index 0000000..db3ab4b
--- /dev/null
@@ -0,0 +1,19 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Sug: B
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+repo other 0 testtags <inline>
+#>=Pkg: B 4 1 noarch
+#>=Pkg: B 6 1 noarch
+#>=Pkg: B 5 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>suggested B-6-1.noarch@other
\ No newline at end of file
diff --git a/test/testcases/recommendations/suggested_oldversion.t b/test/testcases/recommendations/suggested_oldversion.t
new file mode 100644 (file)
index 0000000..ad08be1
--- /dev/null
@@ -0,0 +1,15 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Sug: B < 3
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>suggested B-2-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/suggested_targeted.t b/test/testcases/recommendations/suggested_targeted.t
new file mode 100644 (file)
index 0000000..5a9f1aa
--- /dev/null
@@ -0,0 +1,15 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Sug: B = 2-1
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>suggested B-2-1.noarch@available
\ No newline at end of file
diff --git a/test/testcases/recommendations/suggested_version.t b/test/testcases/recommendations/suggested_version.t
new file mode 100644 (file)
index 0000000..27a3b53
--- /dev/null
@@ -0,0 +1,15 @@
+repo system 0 empty
+repo available 0 testtags <inline>
+#>=Pkg: A 1 1 noarch
+#>=Sug: B
+#>=Pkg: B 1 1 noarch
+#>=Pkg: B 3 1 noarch
+#>=Pkg: B 2 1 noarch
+system i686 rpm system
+
+solverflags ignorerecommended
+job install name A
+
+result transaction,recommended,problems <inline>
+#>install A-1-1.noarch@available
+#>suggested B-3-1.noarch@available
\ No newline at end of file