Blame SOURCES/0001-Revert-selector-prefer-obsoletes-Related-RhBug-10965.patch

7d8bc5
diff --git a/libdnf/data/tests/hawkey/greedy.repo b/libdnf/data/tests/hawkey/greedy.repo
cc7205
index d450885..64bb85a 100644
cc7205
--- a/libdnf/data/tests/hawkey/greedy.repo
cc7205
+++ b/libdnf/data/tests/hawkey/greedy.repo
cc7205
@@ -5,7 +5,5 @@
cc7205
 =Pkg: B 1 0 noarch
cc7205
 =Rec: C
cc7205
 =Prv: somereq
cc7205
-=Obs: somereq
cc7205
 =Pkg: C 1 0 noarch
cc7205
 =Prv: somereq
cc7205
-=Pkg: somereq 1 0 noarch
7d8bc5
diff --git a/libdnf/libdnf/hy-goal.c b/libdnf/libdnf/hy-goal.c
7d8bc5
index dc05c1c..3ff1ce6 100644
cc7205
--- a/libdnf/libdnf/hy-goal.c
cc7205
+++ b/libdnf/libdnf/hy-goal.c
7d8bc5
@@ -550,34 +550,6 @@ filter_name2job(DnfSack *sack, const struct _Filter *f, Queue *job)
cc7205
     return 0;
cc7205
 }
cc7205
 
cc7205
-/**
cc7205
- * add_preferred_provide:
cc7205
- * when searching by provides the packages that contain the same
cc7205
- * name as provide or contain obsoletes with the same name as their
cc7205
- * provide will be picked first
cc7205
- */
cc7205
-static void
cc7205
-add_preferred_provide(DnfSack *sack, Queue *job, Id id)
cc7205
-{
cc7205
-    Pool *pool = dnf_sack_get_pool(sack);
cc7205
-    const char *name = pool_dep2str(pool, id);
cc7205
-    HyQuery q = hy_query_create(sack);
cc7205
-    hy_query_filter(q, HY_PKG_NAME, HY_NEQ, name);
cc7205
-    DnfPackageSet *pset = hy_query_run_set(q);
cc7205
-    hy_query_filter(q, HY_PKG_PROVIDES, HY_EQ, name);
cc7205
-    hy_query_filter_package_in(q, HY_PKG_OBSOLETES, HY_NEQ, pset);
cc7205
-    DnfPackage *pkg;
7d8bc5
-    g_autoptr(GPtrArray) plist = hy_query_run(q);
cc7205
-    for (guint i = 0; i < plist->len; i++) {
cc7205
-        pkg = g_ptr_array_index(plist, i);
cc7205
-        queue_push2(job, SOLVER_DISFAVOR|SOLVER_SOLVABLE,
cc7205
-                    dnf_package_get_id(pkg));
cc7205
-    }
cc7205
-    queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id);
cc7205
-    hy_query_free(q);
cc7205
-    g_object_unref(pset);
cc7205
-}
cc7205
-
cc7205
 static int
cc7205
 filter_provides2job(DnfSack *sack, const struct _Filter *f, Queue *job)
cc7205
 {
7d8bc5
@@ -593,7 +565,7 @@ filter_provides2job(DnfSack *sack, const struct _Filter *f, Queue *job)
cc7205
     switch (f->cmp_type) {
cc7205
     case HY_EQ:
cc7205
         id = dnf_reldep_get_id (f->matches[0].reldep);
cc7205
-        add_preferred_provide(sack, job, id);
cc7205
+        queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id);
cc7205
         break;
cc7205
     case HY_GLOB:
cc7205
         dataiterator_init(&di, pool, 0, 0, SOLVABLE_PROVIDES, name, SEARCH_GLOB);
7d8bc5
@@ -604,7 +576,7 @@ filter_provides2job(DnfSack *sack, const struct _Filter *f, Queue *job)
cc7205
         assert(di.idp);
cc7205
         id = *di.idp;
cc7205
         if (!job_has(job, SOLVABLE_PROVIDES, id))
cc7205
-            add_preferred_provide(sack, job, id);
cc7205
+            queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id);
cc7205
         dataiterator_free(&di);
cc7205
         break;
cc7205
     default:
7d8bc5
diff --git a/libdnf/tests/hawkey/test_goal.c b/libdnf/tests/hawkey/test_goal.c
7d8bc5
index 7c30097..2a98983 100644
cc7205
--- a/libdnf/tests/hawkey/test_goal.c
cc7205
+++ b/libdnf/tests/hawkey/test_goal.c
7d8bc5
@@ -230,27 +230,6 @@ START_TEST(test_goal_install_selector)
cc7205
 }
cc7205
 END_TEST
cc7205
 
cc7205
-START_TEST(test_goal_install_selector_obsoletes_first)
cc7205
-{
cc7205
-    HySelector sltr;
cc7205
-    HyGoal goal = hy_goal_create(test_globals.sack);
cc7205
-
cc7205
-    sltr = hy_selector_create(test_globals.sack);
cc7205
-    hy_selector_set(sltr, HY_PKG_PROVIDES, HY_EQ, "somereq");
cc7205
-    fail_if(!hy_goal_install_selector(goal, sltr, NULL));
cc7205
-    hy_selector_free(sltr);
cc7205
-
cc7205
-    fail_if(hy_goal_run(goal));
cc7205
-    assert_iueo(goal, 1, 0, 0, 0);
cc7205
-
cc7205
-    GPtrArray *plist = hy_goal_list_installs(goal, NULL);
7d8bc5
-    const char *nvra = dnf_package_get_nevra(g_ptr_array_index(plist, 0));
cc7205
-    ck_assert_str_eq(nvra, "B-1-0.noarch");
cc7205
-    g_ptr_array_unref(plist);
cc7205
-    hy_goal_free(goal);
cc7205
-}
cc7205
-END_TEST
cc7205
-
cc7205
 START_TEST(test_goal_install_selector_err)
cc7205
 {
cc7205
     int rc;
7d8bc5
@@ -1456,7 +1435,6 @@ goal_suite(void)
cc7205
     tc = tcase_create("Greedy");
cc7205
     tcase_add_unchecked_fixture(tc, fixture_greedy_only, teardown);
cc7205
     tcase_add_test(tc, test_goal_run_all);
cc7205
-    tcase_add_test(tc, test_goal_install_selector_obsoletes_first);
cc7205
     tcase_add_test(tc, test_goal_install_weak_deps);
cc7205
     suite_add_tcase(s, tc);
cc7205