diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 6268026..0000000 --- a/.gitignore +++ /dev/null @@ -1,66 +0,0 @@ -/hawkey-042738b.tar.xz -/hawkey-76a5b8c.tar.xz -/hawkey-ea88ad5.tar.xz -/hawkey-41b39ba.tar.xz -/hawkey-e6734fb.tar.xz -/hawkey-8599c55.tar.xz -/hawkey-a198dea.tar.xz -/hawkey-545a461.tar.xz -/hawkey-0245875.tar.xz -/hawkey-687ceab.tar.xz -/hawkey-69b12a4.tar.xz -/hawkey-7fa7aa9.tar.xz -/hawkey-afa7717.tar.xz -/hawkey-6f9df85.tar.xz -/hawkey-e883549.tar.xz -/hawkey-4e41b7f.tar.xz -/hawkey-b3fcf21.tar.xz -/hawkey-f981c48.tar.xz -/hawkey-c8365fa.tar.xz -/hawkey-a53a6b1.tar.xz -/hawkey-dd10ac7.tar.xz -/hawkey-046ab1c.tar.xz -/hawkey-c0c16c0.tar.xz -/hawkey-1d51b83.tar.xz -/hawkey-ffe0dac.tar.xz -/hawkey-60cc1cc.tar.xz -/hawkey-2a04c71.tar.xz -/hawkey-15db39f.tar.xz -/hawkey-78b3aa0.tar.xz -/hawkey-996cd40.tar.xz -/hawkey-4e79abc.tar.xz -/hawkey-1e5a593.tar.xz -/hawkey-0e5506a.tar.xz -/hawkey-6f35513.tar.xz -/hawkey-4c51f65.tar.xz -/hawkey-dcfbe87.tar.xz -/hawkey-513440a.tar.xz -/hawkey-9ed6fca.tar.xz -/hawkey-6df2dad.tar.xz -/hawkey-e9a7b79.tar.xz -/hawkey-7890cf9.tar.xz -/hawkey-20392bc.tar.xz -/hawkey-8d6af87.tar.xz -/hawkey-fc24328.tar.xz -/hawkey-f5edea1.tar.xz -/hawkey-a0fafad.tar.xz -/hawkey-52f8596.tar.xz -/hawkey-428a977.tar.xz -/hawkey-a56916e.tar.xz -/hawkey-eafbe0a.tar.xz -/hawkey-4f4bf92.tar.xz -/hawkey-9b92ebd.tar.xz -/hawkey-d4995bb.tar.xz -/hawkey-ef6ffd4.tar.xz -/hawkey-c3207af.tar.xz -/hawkey-029fd67.tar.xz -/hawkey-a687e3f580ae67d4a88b5f5fd0d8da101f031475.tar.gz -/hawkey-0.5.4.tar.gz -/hawkey-0.5.5.tar.gz -/hawkey-0.5.6.tar.gz -/hawkey-0.5.7.tar.gz -/hawkey-0.5.9.tar.gz -/hawkey-0.6.0.tar.gz -/hawkey-0.6.1.tar.gz -/hawkey-0.6.2.tar.gz -/hawkey-0.6.3.tar.gz diff --git a/0001-build-don-t-set-default-build-type-and-define-_GNU_S.patch b/0001-build-don-t-set-default-build-type-and-define-_GNU_S.patch deleted file mode 100644 index 5554d34..0000000 --- a/0001-build-don-t-set-default-build-type-and-define-_GNU_S.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 486ea724ef94ada14b876f07e28ebd73b9ae63b9 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Wed, 31 Aug 2016 17:30:56 +0200 -Subject: [PATCH] build: don't set default build type and define _GNU_SOURCE - -We will let CMake handle default build type. Also remove all custom -CFLAGS and use system ones. - -References: https://bugzilla.redhat.com/show_bug.cgi?id=1332067 -Signed-off-by: Igor Gnatenko ---- - CMakeLists.txt | 12 +++++++----- - 1 file changed, 7 insertions(+), 5 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 06432d3..4d9ef5b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -5,11 +5,13 @@ CMAKE_POLICY (SET CMP0005 OLD) - INCLUDE (${CMAKE_SOURCE_DIR}/VERSION.cmake) - SET (VERSION "${HAWKEY_MAJOR}.${HAWKEY_MINOR}.${HAWKEY_PATCH}") - --set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -Werror=implicit-function-declaration -Wall -Wl,--as-needed") --set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -ggdb -O0") --IF(NOT CMAKE_BUILD_TYPE) -- set (CMAKE_BUILD_TYPE DEBUG) --ENDIF(NOT CMAKE_BUILD_TYPE) -+include (CheckSymbolExists) -+list (APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) -+check_symbol_exists (FNM_CASEFOLD "fnmatch.h" HAS_FNM_CASEFOLD) -+if (NOT HAS_FNM_CASEFOLD) -+ message (SEND_ERROR "FNM_CASEFOLD is not available") -+endif () -+add_definitions (-D_GNU_SOURCE) - - INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}) - --- -2.9.3 - diff --git a/0001-hy-package-add-support-for-Requires-pre-Related-RhBu.patch b/0001-hy-package-add-support-for-Requires-pre-Related-RhBu.patch deleted file mode 100644 index 0d57824..0000000 --- a/0001-hy-package-add-support-for-Requires-pre-Related-RhBu.patch +++ /dev/null @@ -1,86 +0,0 @@ -From 0f7f66f5731ef04948794329f1a1ed6597015589 Mon Sep 17 00:00:00 2001 -From: Michal Luscon -Date: Mon, 14 Mar 2016 17:29:20 +0100 -Subject: [PATCH 1/3] hy-package: add support for Requires(pre) - (Related:RhBug:1303117) - -Closes: #95 - -Reviewed-by: Igor Gnatenko ---- - src/package.c | 16 +++++++++++++++- - src/package.h | 1 + - src/python/package-py.c | 2 ++ - 3 files changed, 18 insertions(+), 1 deletion(-) - -diff --git a/src/package.c b/src/package.c -index 3c47d24..1bd5fb3 100644 ---- a/src/package.c -+++ b/src/package.c -@@ -25,6 +25,7 @@ - #include - #include - #include -+#include - #include - - // hawkey -@@ -65,9 +66,16 @@ reldeps_for(HyPackage pkg, Id type) - Solvable *s = get_solvable(pkg); - HyReldepList reldeplist; - Queue q; -+ Id marker = -1; -+ Id solv_type = type; - -+ if (type == SOLVABLE_PREREQMARKER) { -+ solv_type = SOLVABLE_REQUIRES; -+ marker = 1; -+ } - queue_init(&q); -- solvable_lookup_deparray(s, type, &q, -1); -+ solvable_lookup_deparray(s, solv_type, &q, marker); -+ - reldeplist = reldeplist_from_queue(pool, q); - - queue_free(&q); -@@ -425,6 +433,12 @@ hy_package_get_requires(HyPackage pkg) - } - - HyReldepList -+hy_package_get_requires_pre(HyPackage pkg) -+{ -+ return reldeps_for(pkg, SOLVABLE_PREREQMARKER); -+} -+ -+HyReldepList - hy_package_get_suggests(HyPackage pkg) - { - return reldeps_for(pkg, SOLVABLE_SUGGESTS); -diff --git a/src/package.h b/src/package.h -index 742f0f6..43f335b 100644 ---- a/src/package.h -+++ b/src/package.h -@@ -83,6 +83,7 @@ HyReldepList hy_package_get_obsoletes(HyPackage pkg); - HyReldepList hy_package_get_provides(HyPackage pkg); - HyReldepList hy_package_get_recommends(HyPackage pkg); - HyReldepList hy_package_get_requires(HyPackage pkg); -+HyReldepList hy_package_get_requires_pre(HyPackage pkg); - HyReldepList hy_package_get_suggests(HyPackage pkg); - HyReldepList hy_package_get_supplements(HyPackage pkg); - HyStringArray hy_package_get_files(HyPackage pkg); -diff --git a/src/python/package-py.c b/src/python/package-py.c -index 7087cf9..cd41e15 100644 ---- a/src/python/package-py.c -+++ b/src/python/package-py.c -@@ -332,6 +332,8 @@ static PyGetSetDef package_getsetters[] = { - (void *)hy_package_get_recommends}, - {"requires", (getter)get_reldep, NULL, NULL, - (void *)hy_package_get_requires}, -+ {"requires_pre", (getter)get_reldep, NULL, NULL, -+ (void *)hy_package_get_requires_pre}, - {"suggests", (getter)get_reldep, NULL, NULL, - (void *)hy_package_get_suggests}, - {"supplements", (getter)get_reldep, NULL, NULL, --- -2.11.1 - diff --git a/0001-sack-don-t-raise-error-when-non-existing-arch-is-use.patch b/0001-sack-don-t-raise-error-when-non-existing-arch-is-use.patch deleted file mode 100644 index b04ae7e..0000000 --- a/0001-sack-don-t-raise-error-when-non-existing-arch-is-use.patch +++ /dev/null @@ -1,37 +0,0 @@ -From dc3b7e79198f99c58b385a496bb6ae2e73113990 Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Tue, 17 May 2016 17:05:17 +0200 -Subject: [PATCH 1/2] sack: don't raise error when non-existing arch is used - -Reference: https://github.com/rpm-software-management/libhif/commit/611a86afaa47ce2c84207a602d167eb851a4d19a -Signed-off-by: Igor Gnatenko ---- - src/sack.c | 5 ++++- - 1 file changed, 4 insertions(+), 1 deletion(-) - -diff --git a/src/sack.c b/src/sack.c -index 5bcdb39..e77c5eb 100644 ---- a/src/sack.c -+++ b/src/sack.c -@@ -165,6 +165,9 @@ setarch(HySack sack, const char *req_arch) - - HY_LOG_INFO("Architecture is: %s", arch); - pool_setarch(pool, arch); -+ /* Since one of commits after 0.6.20 libsolv allowes custom arches -+ * which means it will be 'newcoolarch' ad 'noarch' always. */ -+#if LIBSOLV_VERSION <= 620 - if (!strcmp(arch, "noarch")) - // noarch never fails - goto done; -@@ -178,7 +181,7 @@ setarch(HySack sack, const char *req_arch) - count++; - if (count < 2) - ret = HY_E_FAILED; -- -+#endif - done: - solv_free(detected); - return ret; --- -2.9.2 - diff --git a/0001-selector-prefer-obsoletes-Related-RhBug-1096506.patch b/0001-selector-prefer-obsoletes-Related-RhBug-1096506.patch deleted file mode 100644 index 1397a0d..0000000 --- a/0001-selector-prefer-obsoletes-Related-RhBug-1096506.patch +++ /dev/null @@ -1,136 +0,0 @@ -From ed90521f38374017874a86ce146eef8782fade47 Mon Sep 17 00:00:00 2001 -From: Jan Silhan -Date: Tue, 14 Jun 2016 11:25:48 +0200 -Subject: [PATCH 1/2] selector: prefer obsoletes (Related:RhBug:1096506) - -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 - -Closes: #189 -Approved by: j-mracek ---- - src/goal.c | 33 +++++++++++++++++++++++++++++++-- - tests/repos/greedy.repo | 2 ++ - tests/test_goal.c | 23 +++++++++++++++++++++++ - 3 files changed, 56 insertions(+), 2 deletions(-) - -diff --git a/src/goal.c b/src/goal.c -index 442bc4a..480e738 100644 ---- a/src/goal.c -+++ b/src/goal.c -@@ -39,6 +39,7 @@ - #include "goal_internal.h" - #include "iutil.h" - #include "package_internal.h" -+#include "packageset.h" - #include "query_internal.h" - #include "reldep_internal.h" - #include "repo_internal.h" -@@ -353,6 +354,34 @@ job_has(Queue *job, Id what, Id id) - 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(HySack sack, Queue *job, Id id) -+{ -+ Pool *pool = sack_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); -+ HyPackageSet 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); -+ HyPackageList plist = hy_query_run(q); -+ for (int i = 0; i < hy_packagelist_count(plist); i++) { -+ HyPackage pkg = hy_packagelist_get(plist, i); -+ queue_push2(job, SOLVER_DISFAVOR|SOLVER_SOLVABLE, -+ package_id(pkg)); -+ } -+ queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id); -+ hy_query_free(q); -+ hy_packageset_free(pset); -+ hy_packagelist_free(plist); -+} -+ - static int - filter_arch2job(HySack sack, const struct _Filter *f, Queue *job) - { -@@ -472,7 +501,7 @@ filter_provides2job(HySack sack, const struct _Filter *f, Queue *job) - switch (f->cmp_type) { - case HY_EQ: - id = reldep_id(f->matches[0].reldep); -- queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id); -+ add_preferred_provide(sack, job, id); - break; - case HY_GLOB: - dataiterator_init(&di, pool, 0, 0, SOLVABLE_PROVIDES, name, SEARCH_GLOB); -@@ -483,7 +512,7 @@ filter_provides2job(HySack sack, const struct _Filter *f, Queue *job) - assert(di.idp); - id = *di.idp; - if (!job_has(job, SOLVABLE_PROVIDES, id)) -- queue_push2(job, SOLVER_SOLVABLE_PROVIDES, id); -+ add_preferred_provide(sack, job, id); - dataiterator_free(&di); - break; - default: -diff --git a/tests/repos/greedy.repo b/tests/repos/greedy.repo -index 64bb85a..d450885 100644 ---- a/tests/repos/greedy.repo -+++ b/tests/repos/greedy.repo -@@ -5,5 +5,7 @@ - =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/tests/test_goal.c b/tests/test_goal.c -index dc7dcec..6dba956 100644 ---- a/tests/test_goal.c -+++ b/tests/test_goal.c -@@ -224,6 +224,28 @@ 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)); -+ hy_selector_free(sltr); -+ -+ fail_if(hy_goal_run(goal)); -+ assert_iueo(goal, 1, 0, 0, 0); -+ -+ HyPackageList plist = hy_goal_list_installs(goal); -+ char *nvra = hy_package_get_nevra(hy_packagelist_get(plist, 0)); -+ ck_assert_str_eq(nvra, "B-1-0.noarch"); -+ hy_free(nvra); -+ hy_packagelist_free(plist); -+ hy_goal_free(goal); -+} -+END_TEST -+ - START_TEST(test_goal_install_selector_err) - { - // Test that using the hy_goal_*_selector() methods returns an error for -@@ -1309,6 +1331,7 @@ 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); - --- -2.11.0 - diff --git a/0001-util-detect-armv7hnl-properly.patch b/0001-util-detect-armv7hnl-properly.patch deleted file mode 100644 index 708315d..0000000 --- a/0001-util-detect-armv7hnl-properly.patch +++ /dev/null @@ -1,33 +0,0 @@ -From d74dbb4a6f6531bfb3b354ac2545882d7558a55a Mon Sep 17 00:00:00 2001 -From: Igor Gnatenko -Date: Thu, 25 Aug 2016 21:49:55 +0200 -Subject: [PATCH] util: detect armv7hnl properly - -Signed-off-by: Igor Gnatenko ---- - src/util.c | 9 +++++---- - 1 file changed, 5 insertions(+), 4 deletions(-) - -diff --git a/src/util.c b/src/util.c -index 0e9352c..8e41226 100644 ---- a/src/util.c -+++ b/src/util.c -@@ -136,10 +136,11 @@ hy_detect_arch(char **arch) - int ret = parse_cpu_flags(&flags, "Features"); - if (ret) - return ret; -- if (flags & (ARM_NEON | ARM_VFP3)) -- strcpy(un.machine, "armv7hnl"); -- else if (flags & ARM_VFP3) -- strcpy(un.machine, "armv7hl"); -+ if (flags & ARM_VFP3) -+ if (flags & ARM_NEON) -+ strcpy(un.machine, "armv7hnl"); -+ else -+ strcpy(un.machine, "armv7hl"); - } - #ifdef __MIPSEL__ - if (!strcmp(un.machine, "mips")) --- -2.9.3 - diff --git a/0002-Fixes-for-building-with-libsolv-0.6.21-117.patch b/0002-Fixes-for-building-with-libsolv-0.6.21-117.patch deleted file mode 100644 index de5d03a..0000000 --- a/0002-Fixes-for-building-with-libsolv-0.6.21-117.patch +++ /dev/null @@ -1,103 +0,0 @@ -From 43119cffd65c09e492ffac0b8dd56232c3bd8571 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?= - =?UTF-8?q?=E3=82=B4=E3=83=B3=E3=83=91=29?= -Date: Wed, 29 Jun 2016 06:36:26 -0700 -Subject: [PATCH 2/2] Fixes for building with libsolv-0.6.21 (#117) - -* tests/sack: do not raise exceptions on empty/unknown arches - -libsolv 0.6.21 now permits handling custom architectures, -which completely breaks these tests. - -* Add build option to enable urpmreorder solver flag - -This optionally enables the urpm-style solution reordering -required to ensure the proper subset of locale and kernel packages -were being installed. - -Reference: https://bugs.mageia.org/show_bug.cgi?id=18315 - -* spec: bump required libsolv to 0.6.21 ---- - CMakeLists.txt | 7 +++++++ - hawkey.spec | 2 +- - src/goal.c | 5 +++++ - tests/python/tests/test_sack.py | 2 -- - tests/test_sack.c | 4 ---- - 5 files changed, 13 insertions(+), 7 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f638bb9..06432d3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -12,6 +12,13 @@ IF(NOT CMAKE_BUILD_TYPE) - ENDIF(NOT CMAKE_BUILD_TYPE) - - INCLUDE_DIRECTORIES (${CMAKE_SOURCE_DIR}) -+ -+OPTION (ENABLE_SOLV_URPMREORDER "Build with support for URPM-like solution reordering?" OFF) -+ -+IF (ENABLE_SOLV_URPMREORDER) -+ ADD_DEFINITIONS(-DLIBSOLV_FLAG_URPMREORDER=1) -+ENDIF() -+ - if (LIBSOLV_PATH) - INCLUDE_DIRECTORIES (${LIBSOLV_PATH}/build/) - FIND_LIBRARY (SOLV_LIBRARY NAMES solv PATHS ${LIBSOLV_PATH}/build/src NO_DEFAULT_PATH) -diff --git a/hawkey.spec b/hawkey.spec -index 05c2b45..18c56b4 100644 ---- a/hawkey.spec -+++ b/hawkey.spec -@@ -1,4 +1,4 @@ --%global libsolv_version 0.6.4-1 -+%global libsolv_version 0.6.21-1 - - %if 0%{?rhel} && 0%{?rhel} <= 7 - %bcond_with python3 -diff --git a/src/goal.c b/src/goal.c -index 1a2198d..442bc4a 100644 ---- a/src/goal.c -+++ b/src/goal.c -@@ -221,6 +221,11 @@ init_solver(HyGoal goal, int flags) - /* support package splits via obsoletes */ - solver_set_flag(solv, SOLVER_FLAG_YUM_OBSOLETES, 1); - -+#if defined(LIBSOLV_FLAG_URPMREORDER) -+ /* support urpm-like solution reordering */ -+ solver_set_flag(solv, SOLVER_FLAG_URPM_REORDER, 1); -+#endif -+ - return solv; - } - -diff --git a/tests/python/tests/test_sack.py b/tests/python/tests/test_sack.py -index 6661caa..cb0449c 100644 ---- a/tests/python/tests/test_sack.py -+++ b/tests/python/tests/test_sack.py -@@ -55,8 +55,6 @@ class BasicTest(unittest.TestCase): - def test_creation(self): - hawkey.Sack(arch="noarch") - hawkey.Sack(arch="x86_64") -- self.assertRaises(hawkey.ArchException, hawkey.Sack, arch="") -- self.assertRaises(hawkey.ValueException, hawkey.Sack, arch="play") - - def test_deepcopy(self): - sack = hawkey.Sack() -diff --git a/tests/test_sack.c b/tests/test_sack.c -index 9c97f4e..a179d2d 100644 ---- a/tests/test_sack.c -+++ b/tests/test_sack.c -@@ -55,10 +55,6 @@ START_TEST(test_sack_create) - fail_if(sack_pool(sack) == NULL, NULL); - hy_sack_free(sack); - -- sack = hy_sack_create(test_globals.tmpdir, "", NULL, NULL, -- HY_MAKE_CACHE_DIR); -- fail_unless(sack == NULL); -- fail_unless(hy_get_errno() == HY_E_ARCH); - } - END_TEST - --- -2.9.2 - diff --git a/0002-hy-query-implemented-set-operations-union-intersecti.patch b/0002-hy-query-implemented-set-operations-union-intersecti.patch deleted file mode 100644 index e5b36b1..0000000 --- a/0002-hy-query-implemented-set-operations-union-intersecti.patch +++ /dev/null @@ -1,248 +0,0 @@ -From e4fc14cf80a6613fa8a51d15d81652152e7bf2f6 Mon Sep 17 00:00:00 2001 -From: Michael Mraka -Date: Mon, 21 Mar 2016 11:55:20 +0100 -Subject: [PATCH 2/3] hy-query: implemented set operations (union, - intersection, difference) - ---- - src/python/__init__.py | 12 +++++++++ - src/python/query-py.c | 36 ++++++++++++++++++++++++++ - src/query.c | 24 ++++++++++++++++++ - src/query.h | 3 +++ - tests/python/tests/test_query.py | 27 ++++++++++++++++++++ - tests/test_query.c | 55 ++++++++++++++++++++++++++++++++++++++++ - 6 files changed, 157 insertions(+) - -diff --git a/src/python/__init__.py b/src/python/__init__.py -index d92edbc..aef959f 100644 ---- a/src/python/__init__.py -+++ b/src/python/__init__.py -@@ -334,6 +334,18 @@ class Query(_hawkey.Query): - raise NotImplementedError( - "hawkey.Query.provides is not implemented yet") - -+ def difference(self, other): -+ new_query = type(self)(query=self) -+ return super(Query, new_query).difference(other) -+ -+ def intersection(self, other): -+ new_query = type(self)(query=self) -+ return super(Query, new_query).intersection(other) -+ -+ def union(self, other): -+ new_query = type(self)(query=self) -+ return super(Query, new_query).union(other) -+ - - class Selector(_hawkey.Selector): - -diff --git a/src/python/query-py.c b/src/python/query-py.c -index 37a0bbd..c4410be 100644 ---- a/src/python/query-py.c -+++ b/src/python/query-py.c -@@ -324,6 +324,36 @@ apply(PyObject *self, PyObject *unused) - return self; - } - -+static PyObject * -+q_union(PyObject *self, PyObject *other) -+{ -+ HyQuery self_q = ((_QueryObject *) self)->query; -+ HyQuery other_q = ((_QueryObject *) other)->query; -+ hy_query_union(self_q, other_q); -+ Py_INCREF(self); -+ return self; -+} -+ -+static PyObject * -+q_intersection(PyObject *self, PyObject *other) -+{ -+ HyQuery self_q = ((_QueryObject *) self)->query; -+ HyQuery other_q = ((_QueryObject *) other)->query; -+ hy_query_intersection(self_q, other_q); -+ Py_INCREF(self); -+ return self; -+} -+ -+static PyObject * -+q_difference(PyObject *self, PyObject *other) -+{ -+ HyQuery self_q = ((_QueryObject *) self)->query; -+ HyQuery other_q = ((_QueryObject *) other)->query; -+ hy_query_difference(self_q, other_q); -+ Py_INCREF(self); -+ return self; -+} -+ - static struct PyMethodDef query_methods[] = { - {"clear", (PyCFunction)clear, METH_NOARGS, - NULL}, -@@ -333,6 +363,12 @@ static struct PyMethodDef query_methods[] = { - NULL}, - {"apply", (PyCFunction)apply, METH_NOARGS, - NULL}, -+ {"union", (PyCFunction)q_union, METH_O, -+ NULL}, -+ {"intersection", (PyCFunction)q_intersection, METH_O, -+ NULL}, -+ {"difference", (PyCFunction)q_difference, METH_O, -+ NULL}, - {NULL} /* sentinel */ - }; - -diff --git a/src/query.c b/src/query.c -index 9a320d6..becb8dd 100644 ---- a/src/query.c -+++ b/src/query.c -@@ -1274,3 +1274,27 @@ hy_query_run_set(HyQuery q) - hy_query_apply(q); - return packageset_from_bitmap(q->sack, q->result); - } -+ -+void -+hy_query_union(HyQuery q, HyQuery other) -+{ -+ hy_query_apply(q); -+ hy_query_apply(other); -+ map_or(q->result, other->result); -+} -+ -+void -+hy_query_intersection(HyQuery q, HyQuery other) -+{ -+ hy_query_apply(q); -+ hy_query_apply(other); -+ map_and(q->result, other->result); -+} -+ -+void -+hy_query_difference(HyQuery q, HyQuery other) -+{ -+ hy_query_apply(q); -+ hy_query_apply(other); -+ map_subtract(q->result, other->result); -+} -diff --git a/src/query.h b/src/query.h -index 8b8ae1d..c3ee006 100644 ---- a/src/query.h -+++ b/src/query.h -@@ -89,6 +89,9 @@ void hy_query_filter_latest(HyQuery q, int val); - HyPackageList hy_query_run(HyQuery q); - HyPackageSet hy_query_run_set(HyQuery q); - -+void hy_query_union(HyQuery q, HyQuery other); -+void hy_query_intersection(HyQuery q, HyQuery other); -+void hy_query_difference(HyQuery q, HyQuery other); - - #ifdef __cplusplus - } -diff --git a/tests/python/tests/test_query.py b/tests/python/tests/test_query.py -index 85f73b7..cb03f66 100644 ---- a/tests/python/tests/test_query.py -+++ b/tests/python/tests/test_query.py -@@ -380,3 +380,30 @@ class TestQuerySubclass(base.TestCase): - self.assertIsInstance(q, self.CustomQuery) - q = q.filter(name="pepper") - self.assertIsInstance(q, self.CustomQuery) -+ -+class TestQuerySetOperations(base.TestCase): -+ def setUp(self): -+ self.sack = base.TestSack(repo_dir=self.repo_dir) -+ self.sack.load_system_repo() -+ self.q = hawkey.Query(self.sack) -+ self.q1 = self.q.filter(version='4') -+ self.q2 = self.q.filter(name__glob='p*') -+ -+ def test_difference(self): -+ qi = self.q1.difference(self.q2) -+ difference = [p for p in self.q1 if p not in self.q2] -+ self.assertEqual(qi.run(), difference) -+ -+ def test_intersection(self): -+ qi = self.q1.intersection(self.q2) -+ intersection = self.q.filter(version='4', name__glob='p*') -+ self.assertEqual(qi.run(), intersection.run()) -+ -+ def test_union(self): -+ qu = self.q1.union(self.q2) -+ union = set(self.q1.run() + self.q2.run()) -+ self.assertEqual(set(qu), union) -+ -+ def test_zzz_queries_not_modified(self): -+ self.assertEqual(len(self.q1), 5) -+ self.assertEqual(len(self.q2), 5) -diff --git a/tests/test_query.c b/tests/test_query.c -index 48f2aef..12875f7 100644 ---- a/tests/test_query.c -+++ b/tests/test_query.c -@@ -991,6 +991,54 @@ START_TEST(test_query_apply) - } - END_TEST - -+START_TEST(test_difference) -+{ -+ HyQuery q1 = hy_query_create(test_globals.sack); -+ hy_query_filter(q1, HY_PKG_VERSION, HY_EQ, "4"); -+ HyQuery q2 = hy_query_create(test_globals.sack); -+ hy_query_filter(q2, HY_PKG_NAME, HY_GLOB, "p*"); -+ -+ hy_query_difference(q1, q2); -+ HyPackageList plist = hy_query_run(q1); -+ ck_assert_int_eq(hy_packagelist_count(plist), 2); -+ hy_packagelist_free(plist); -+ hy_query_free(q2); -+ hy_query_free(q1); -+} -+END_TEST -+ -+START_TEST(test_intersection) -+{ -+ HyQuery q1 = hy_query_create(test_globals.sack); -+ hy_query_filter(q1, HY_PKG_VERSION, HY_EQ, "4"); -+ HyQuery q2 = hy_query_create(test_globals.sack); -+ hy_query_filter(q2, HY_PKG_NAME, HY_GLOB, "p*"); -+ -+ hy_query_intersection(q1, q2); -+ HyPackageList plist = hy_query_run(q1); -+ ck_assert_int_eq(hy_packagelist_count(plist), 7); -+ hy_packagelist_free(plist); -+ hy_query_free(q2); -+ hy_query_free(q1); -+} -+END_TEST -+ -+START_TEST(test_union) -+{ -+ HyQuery q1 = hy_query_create(test_globals.sack); -+ hy_query_filter(q1, HY_PKG_VERSION, HY_EQ, "4"); -+ HyQuery q2 = hy_query_create(test_globals.sack); -+ hy_query_filter(q2, HY_PKG_NAME, HY_GLOB, "p*"); -+ -+ hy_query_union(q1, q2); -+ HyPackageList plist = hy_query_run(q1); -+ ck_assert_int_eq(hy_packagelist_count(plist), 11); -+ hy_packagelist_free(plist); -+ hy_query_free(q2); -+ hy_query_free(q1); -+} -+END_TEST -+ - Suite * - query_suite(void) - { -@@ -1075,5 +1123,12 @@ query_suite(void) - tcase_add_test(tc, test_disabled_repo); - suite_add_tcase(s, tc); - -+ tc = tcase_create("Set Operations"); -+ tcase_add_unchecked_fixture(tc, fixture_with_main, teardown); -+ tcase_add_test(tc, test_difference); -+ tcase_add_test(tc, test_intersection); -+ tcase_add_test(tc, test_union); -+ suite_add_tcase(s, tc); -+ - return s; - } --- -2.11.1 - diff --git a/0002-nevra-added-_has_just_name-helper-method.patch b/0002-nevra-added-_has_just_name-helper-method.patch deleted file mode 100644 index f1c4cf8..0000000 --- a/0002-nevra-added-_has_just_name-helper-method.patch +++ /dev/null @@ -1,29 +0,0 @@ -From 527c0cfad2d9b2f9ce6fc4ce829d8ee06b576544 Mon Sep 17 00:00:00 2001 -From: Jan Silhan -Date: Sun, 19 Jun 2016 23:09:18 +0200 -Subject: [PATCH 2/2] nevra: added _has_just_name helper method - -Closes: #189 -Approved by: j-mracek ---- - src/python/__init__.py | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/src/python/__init__.py b/src/python/__init__.py -index 32ac2a7..d92edbc 100644 ---- a/src/python/__init__.py -+++ b/src/python/__init__.py -@@ -169,6 +169,10 @@ class NEVRA(_hawkey.NEVRA): - _hawkey_query = super(NEVRA, self).to_query(sack) - return Query(query=_hawkey_query) - -+ def _has_just_name(self): -+ return self.name and not self.epoch and not self.version and \ -+ not self.release and not self.arch -+ - - class Goal(_hawkey.Goal): - _reserved_kw = set(['package', 'select']) --- -2.11.0 - diff --git a/0003-implement-query.filter-pkg__neq-.-RhBug-1233770.patch b/0003-implement-query.filter-pkg__neq-.-RhBug-1233770.patch deleted file mode 100644 index f610458..0000000 --- a/0003-implement-query.filter-pkg__neq-.-RhBug-1233770.patch +++ /dev/null @@ -1,29 +0,0 @@ -From fb1fb6df6ad4390feaebc432fb318828bd98ab87 Mon Sep 17 00:00:00 2001 -From: Michael Mraka -Date: Thu, 31 Mar 2016 11:00:42 +0200 -Subject: [PATCH 3/3] implement query.filter(pkg__neq=..) (RhBug: 1233770) - -this was easy one :) - -Closes: #94 -Approved by: jsilhan ---- - src/query.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/query.c b/src/query.c -index becb8dd..22a7a8e 100644 ---- a/src/query.c -+++ b/src/query.c -@@ -218,7 +218,7 @@ valid_filter_pkg(int keyname, int cmp_type) - { - if (!match_type_pkg(keyname)) - return 0; -- return cmp_type == HY_EQ; -+ return cmp_type == HY_EQ || cmp_type == HY_NEQ; - } - - static int --- -2.11.1 - diff --git a/dead.package b/dead.package new file mode 100644 index 0000000..b7473ee --- /dev/null +++ b/dead.package @@ -0,0 +1 @@ +hawkey is dead in upstream, switch to libdnf diff --git a/hawkey.spec b/hawkey.spec deleted file mode 100644 index 63068b4..0000000 --- a/hawkey.spec +++ /dev/null @@ -1,118 +0,0 @@ -%global libsolv_version 0.6.4-1 - -Name: hawkey -Version: 0.6.3 -Release: 11%{?dist} -Summary: Library providing simplified C and Python API to libsolv -License: LGPLv2+ -URL: https://github.com/rpm-software-management/%{name} -Source0: %{url}/archive/%{name}-%{version}.tar.gz - -Patch0001: 0001-sack-don-t-raise-error-when-non-existing-arch-is-use.patch -Patch0002: 0002-Fixes-for-building-with-libsolv-0.6.21-117.patch -Patch0003: 0001-util-detect-armv7hnl-properly.patch -Patch0004: 0001-build-don-t-set-default-build-type-and-define-_GNU_S.patch -Patch0005: 0001-selector-prefer-obsoletes-Related-RhBug-1096506.patch -Patch0006: 0002-nevra-added-_has_just_name-helper-method.patch -# https://pagure.io/pungi/pull-request/526#comment-18391 -Patch0007: 0001-hy-package-add-support-for-Requires-pre-Related-RhBu.patch -Patch0008: 0002-hy-query-implemented-set-operations-union-intersecti.patch -Patch0009: 0003-implement-query.filter-pkg__neq-.-RhBug-1233770.patch - -BuildRequires: libsolv-devel >= %{libsolv_version} -BuildRequires: cmake -BuildRequires: gcc -BuildRequires: expat-devel -BuildRequires: rpm-devel -BuildRequires: zlib-devel -BuildRequires: check-devel -%ifnarch riscv64 s390 -BuildRequires: valgrind -%endif -Requires: libsolv%{?_isa} >= %{libsolv_version} - -%description -A Library providing simplified C and Python API to libsolv. - -%package devel -Summary: A Library providing simplified C and Python API to libsolv -Requires: %{name}%{?_isa} = %{version}-%{release} -Requires: libsolv-devel - -%description devel -Development files for hawkey. - -%prep -%autosetup -p1 -sed -i -e "/python/d" -e "/PYTHON/d" {src,tests}/CMakeLists.txt -sed -i -e "/ADD_SUBDIRECTORY (doc)/d" CMakeLists.txt - -%build -mkdir %{_target_platform} -pushd %{_target_platform} - %cmake .. - %make_build - #make doc-man -popd - -%install -pushd %{_target_platform} - %make_install -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} - ctest -VV -popd - -%post -p /sbin/ldconfig -%postun -p /sbin/ldconfig - -%files -%license COPYING -%doc README.rst -%{_libdir}/lib%{name}.so.* - -%files devel -%{_libdir}/lib%{name}.so -%{_libdir}/pkgconfig/%{name}.pc -%{_includedir}/%{name}/ - -%changelog -* Mon Feb 13 2017 Igor Gnatenko - 0.6.3-11 -- Backport patches for rel-eng - -* Fri Feb 10 2017 Fedora Release Engineering - 0.6.3-10 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild - -* Tue Jan 17 2017 Igor Gnatenko - 0.6.3-9 -- Prefer obsoletes (RHBZ #1096506) - -* Thu Jan 05 2017 Igor Gnatenko - 0.6.3-8 -- Stop providing python subpackages - -* Tue Dec 13 2016 Stratakis Charalampos - 0.6.3-7 -- Rebuild for Python 3.6 - -* Thu Sep 01 2016 Igor Gnatenko - 0.6.3-6 -- Build release version - -* Thu Aug 25 2016 Igor Gnatenko - 0.6.3-5 -- Fix armv7hnl detection (RHBZ #1368238) - -* Tue Aug 09 2016 Igor Gnatenko - 0.6.3-4 -- Add %%{?system_python_abi} -- Trim changelog - -* Tue Jul 19 2016 Fedora Release Engineering - 0.6.3-3 -- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages - -* Fri Apr 29 2016 Igor Gnatenko 0.6.3-2 -- spec: Fix packaging to comply packaging guidelines (Igor Gnatenko) diff --git a/sources b/sources deleted file mode 100644 index 0841820..0000000 --- a/sources +++ /dev/null @@ -1 +0,0 @@ -42a836948c53eced7448f590d57f45eb hawkey-0.6.3.tar.gz