diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bc80d5d --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/libdnf-0.7.4.tar.gz diff --git a/.libdnf.metadata b/.libdnf.metadata new file mode 100644 index 0000000..729d2ab --- /dev/null +++ b/.libdnf.metadata @@ -0,0 +1 @@ +141e651b301c64c619e3f0d7ecefe690621d5009 SOURCES/libdnf-0.7.4.tar.gz diff --git a/README.md b/README.md deleted file mode 100644 index 98f42b4..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -The master branch has no content - -Look at the c7 branch if you are working with CentOS-7, or the c4/c5/c6 branch for CentOS-4, 5 or 6 -If you find this file in a distro specific branch, it means that no content has been checked in yet diff --git a/SOURCES/0001-Revert-selector-prefer-obsoletes-Related-RhBug-10965.patch b/SOURCES/0001-Revert-selector-prefer-obsoletes-Related-RhBug-10965.patch new file mode 100644 index 0000000..db13357 --- /dev/null +++ b/SOURCES/0001-Revert-selector-prefer-obsoletes-Related-RhBug-10965.patch @@ -0,0 +1,128 @@ +From 13bfe81a226d0bde8d2b58d53c566e4c34069cea Mon Sep 17 00:00:00 2001 +From: Igor Gnatenko +Date: Thu, 5 Jan 2017 12:04:17 +0100 +Subject: [PATCH] Revert "selector: prefer obsoletes (Related:RhBug:1096506)" + +This reverts commit 94ac2e5b980f9095faa372568a8e381e8a4523bc. + +Conflicts: + libdnf/hy-goal.c + tests/hawkey/test_goal.c +--- + data/tests/hawkey/greedy.repo | 2 -- + libdnf/hy-goal.c | 32 ++------------------------------ + tests/hawkey/test_goal.c | 22 ---------------------- + 3 files changed, 2 insertions(+), 54 deletions(-) + +diff --git a/data/tests/hawkey/greedy.repo b/data/tests/hawkey/greedy.repo +index d450885..64bb85a 100644 +--- a/data/tests/hawkey/greedy.repo ++++ b/data/tests/hawkey/greedy.repo +@@ -5,7 +5,5 @@ + =Pkg: B 1 0 noarch + =Rec: C + =Prv: somereq +-=Obs: somereq + =Pkg: C 1 0 noarch + =Prv: somereq +-=Pkg: somereq 1 0 noarch +diff --git a/libdnf/hy-goal.c b/libdnf/hy-goal.c +index dc05c1c..3ff1ce6 100644 +--- a/libdnf/hy-goal.c ++++ b/libdnf/hy-goal.c +@@ -550,34 +550,6 @@ filter_name2job(DnfSack *sack, const struct _Filter *f, Queue *job) + return 0; + } + +-/** +- * add_preferred_provide: +- * when searching by provides the packages that contain the same +- * name as provide or contain obsoletes with the same name as their +- * provide will be picked first +- */ +-static void +-add_preferred_provide(DnfSack *sack, Queue *job, Id id) +-{ +- Pool *pool = dnf_sack_get_pool(sack); +- const char *name = pool_dep2str(pool, id); +- HyQuery q = hy_query_create(sack); +- hy_query_filter(q, HY_PKG_NAME, HY_NEQ, name); +- DnfPackageSet *pset = hy_query_run_set(q); +- hy_query_filter(q, HY_PKG_PROVIDES, HY_EQ, name); +- hy_query_filter_package_in(q, HY_PKG_OBSOLETES, HY_NEQ, pset); +- DnfPackage *pkg; +- g_autoptr(GPtrArray) plist = hy_query_run(q); +- for (guint i = 0; i < plist->len; i++) { +- pkg = g_ptr_array_index(plist, i); +- queue_push2(job, SOLVER_DISFAVOR|SOLVER_SOLVABLE, +- dnf_package_get_id(pkg)); +- } +- queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id); +- hy_query_free(q); +- g_object_unref(pset); +-} +- + static int + filter_provides2job(DnfSack *sack, const struct _Filter *f, Queue *job) + { +@@ -593,7 +565,7 @@ filter_provides2job(DnfSack *sack, const struct _Filter *f, Queue *job) + switch (f->cmp_type) { + case HY_EQ: + id = dnf_reldep_get_id (f->matches[0].reldep); +- add_preferred_provide(sack, job, id); ++ queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id); + break; + case HY_GLOB: + dataiterator_init(&di, pool, 0, 0, SOLVABLE_PROVIDES, name, SEARCH_GLOB); +@@ -604,7 +576,7 @@ filter_provides2job(DnfSack *sack, const struct _Filter *f, Queue *job) + assert(di.idp); + id = *di.idp; + if (!job_has(job, SOLVABLE_PROVIDES, id)) +- add_preferred_provide(sack, job, id); ++ queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id); + dataiterator_free(&di); + break; + default: +diff --git a/tests/hawkey/test_goal.c b/tests/hawkey/test_goal.c +index 7c30097..2a98983 100644 +--- a/tests/hawkey/test_goal.c ++++ b/tests/hawkey/test_goal.c +@@ -230,27 +230,6 @@ START_TEST(test_goal_install_selector) + } + END_TEST + +-START_TEST(test_goal_install_selector_obsoletes_first) +-{ +- HySelector sltr; +- HyGoal goal = hy_goal_create(test_globals.sack); +- +- sltr = hy_selector_create(test_globals.sack); +- hy_selector_set(sltr, HY_PKG_PROVIDES, HY_EQ, "somereq"); +- fail_if(!hy_goal_install_selector(goal, sltr, NULL)); +- hy_selector_free(sltr); +- +- fail_if(hy_goal_run(goal)); +- assert_iueo(goal, 1, 0, 0, 0); +- +- GPtrArray *plist = hy_goal_list_installs(goal, NULL); +- const char *nvra = dnf_package_get_nevra(g_ptr_array_index(plist, 0)); +- ck_assert_str_eq(nvra, "B-1-0.noarch"); +- g_ptr_array_unref(plist); +- hy_goal_free(goal); +-} +-END_TEST +- + START_TEST(test_goal_install_selector_err) + { + int rc; +@@ -1456,7 +1435,6 @@ goal_suite(void) + tc = tcase_create("Greedy"); + tcase_add_unchecked_fixture(tc, fixture_greedy_only, teardown); + tcase_add_test(tc, test_goal_run_all); +- tcase_add_test(tc, test_goal_install_selector_obsoletes_first); + tcase_add_test(tc, test_goal_install_weak_deps); + suite_add_tcase(s, tc); + +-- +1.8.3.1 + diff --git a/SPECS/libdnf.spec b/SPECS/libdnf.spec new file mode 100644 index 0000000..d1e8e70 --- /dev/null +++ b/SPECS/libdnf.spec @@ -0,0 +1,123 @@ +%global libsolv_version 0.6.20-1 +%global dnf_conflict 2.0.0-0.rc2.4 + +%bcond_with valgrind + +%if 0%{?rhel} +%bcond_without rhsm +%else +%bcond_with rhsm +%endif + +%global _cmake_opts \\\ + -DENABLE_RHSM_SUPPORT=%{?with_rhsm:ON}%{!?with_rhsm:OFF} \\\ + %{nil} + +Name: libdnf +Version: 0.7.4 +Release: 2%{?dist}.el +Summary: Library providing simplified C and Python API to libsolv +License: LGPLv2+ +URL: https://github.com/rpm-software-management/libdnf +Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz + +Patch0: 0001-Revert-selector-prefer-obsoletes-Related-RhBug-10965.patch + +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: libsolv-devel >= %{libsolv_version} +BuildRequires: pkgconfig(librepo) +BuildRequires: pkgconfig(check) +%if %{with valgrind} +BuildRequires: valgrind +%endif +BuildRequires: pkgconfig(gio-unix-2.0) >= 2.44.0 +BuildRequires: pkgconfig(gtk-doc) +BuildRequires: pkgconfig(gobject-introspection-1.0) +BuildRequires: rpm-devel >= 4.11.0 +%if %{with rhsm} +BuildRequires: pkgconfig(librhsm) +%endif + +Requires: libsolv%{?_isa} >= %{libsolv_version} + +%description +A Library providing simplified C and Python API to libsolv. + +%package devel +Summary: Development files for %{name} +Requires: %{name}%{?_isa} = %{version}-%{release} +Requires: libsolv-devel%{?_isa} >= %{libsolv_version} + +%description devel +Development files for %{name}. + +%prep +%autosetup -p1 +sed -i -e "/python/d" -e "/docs\/hawkey/d" CMakeLists.txt + +%build +mkdir %{_target_platform} +pushd %{_target_platform} + %cmake -DWITH_MAN=OFF ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts} + %make_build +popd + +%check +if [ "$(id -u)" == "0" ] ; then + cat <&2 +Package tests cannot be run under superuser account. +Please build the package as non-root user. +ERROR + exit 1 +fi +pushd %{_target_platform} + make ARGS="-V" test +popd + +%install +%make_install -C %{_target_platform} + +%post -p /sbin/ldconfig +%postun -p /sbin/ldconfig + +%files +%license COPYING +%doc README.md AUTHORS NEWS +%{_libdir}/%{name}.so.* +%{_libdir}/girepository-1.0/Dnf-*.typelib + +%files devel +%doc %{_datadir}/gtk-doc/html/%{name}/ +%{_libdir}/%{name}.so +%{_libdir}/pkgconfig/%{name}.pc +%{_includedir}/%{name}/ +%{_datadir}/gir-1.0/Dnf-*.gir + +%changelog +* Mon Feb 20 2017 Jan Silhan - 0.7.4-2 +- 0.7.4 + +* Fri Jan 06 2017 Igor Gnatenko - 0.7.1-1 +- 0.7.1 + +* Wed Dec 21 2016 Peter Robinson 0.7.0-0.7gitf9b798c +- Rebuild for Python 3.6 + +* Mon Dec 19 2016 Igor Gnatenko - 0.7.0-0.6gitf9b798c +- Use new upstream URL + +* Tue Dec 13 2016 Stratakis Charalampos - 0.7.0-0.5gitf9b798c +- Rebuild for Python 3.6 + +* Tue Dec 06 2016 Martin Hatina - 0.7.0-0.4gitf9b798c +- Increase conflict version of dnf + +* Thu Dec 01 2016 Igor Gnatenko - 0.7.0-0.3gitf9b798c +- Update to latest snapshot + +* Fri Nov 04 2016 Igor Gnatenko - 0.7.0-0.2git8bd77f8 +- Update to latest snapshot + +* Thu Sep 29 2016 Igor Gnatenko - 0.7.0-0.1git179c0a6 +- Initial package