From e19aa8dfdafceccfec4b341b8efb64ac38cd6e3f Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Tue, 29 Sep 2020 18:30:16 +0200 Subject: [PATCH] [PATCH] Set the default disttype to RPM. On "foreign" systems, including Debian, libsolv tries to be smart and default to the native packaging system type. We need to explicitly override it to use RPM for dnf to work. Gbp-Pq: Name 0003-Set-the-default-disttype-to-RPM.patch --- libdnf/dnf-sack.cpp | 2 ++ tests/hawkey/test_iutil.cpp | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp index e95009f..f2f51be 100644 --- a/libdnf/dnf-sack.cpp +++ b/libdnf/dnf-sack.cpp @@ -186,6 +186,8 @@ dnf_sack_init(DnfSack *sack) priv->pool = pool_create(); pool_set_flag(priv->pool, POOL_FLAG_WHATPROVIDESWITHDISABLED, 1); + pool_setdisttype(priv->pool, DISTTYPE_RPM); + // Configures the pool_addfileprovides_queue() method to only add files from primary.xml. // This ensures the method works correctly even if filelist.xml metadata are not loaded. // At the same time when filelist.xml are loaded libsolv is able to search them for required diff --git a/tests/hawkey/test_iutil.cpp b/tests/hawkey/test_iutil.cpp index 38cab0d..62d0191 100644 --- a/tests/hawkey/test_iutil.cpp +++ b/tests/hawkey/test_iutil.cpp @@ -162,6 +162,13 @@ END_TEST START_TEST(test_version_split) { Pool *pool = pool_create(); + + /* + * On "foreign" systems, the disttype will + * not default to RPM. Set this explicitly. + */ + fail_if(-1 == pool_setdisttype(pool, DISTTYPE_RPM)); + char evr[] = "1:5.9.3-8"; char *epoch, *version, *release; -- 2.30.2