import libdnf-0.55.0-6.el8

This commit is contained in:
CentOS Sources 2021-03-30 09:57:22 -04:00 committed by Stepan Oksanichenko
parent 574533247f
commit 8b403f776e
11 changed files with 1658 additions and 250 deletions

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/libdnf-0.48.0.tar.gz
SOURCES/libdnf-0.55.0.tar.gz

View File

@ -1 +1 @@
452c2195741b627bd97b0be11cd4a4dc4118e330 SOURCES/libdnf-0.48.0.tar.gz
5d997c2c7113cd50af986ada5ff10a62853f1943 SOURCES/libdnf-0.55.0.tar.gz

View File

@ -0,0 +1,87 @@
From 2353dfbcb49a16bd37115915517417678fe49b19 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 13 Nov 2020 09:55:23 +0100
Subject: [PATCH] Better msgs if "basecachedir" or "proxy_password" isn't set
(RhBug:1888946)
Generates more specific error messages:
- repo '%s': 'basecachedir' is not set
- repo '%s': 'proxy_username' is set but not 'proxy_password'
- 'proxy_username' is set but not 'proxy_password'
instead of generic "GetValue(): Value not set"
---
libdnf/repo/Repo.cpp | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index d7c137d75..34539e1ee 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -484,8 +484,12 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitLocal()
handleSetOpt(h.get(), LRO_LOCAL, 1L);
#ifdef LRO_SUPPORTS_CACHEDIR
/* If zchunk is enabled, set librepo cache dir */
- if (conf->getMasterConfig().zchunk().getValue())
+ if (conf->getMasterConfig().zchunk().getValue()) {
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
handleSetOpt(h.get(), LRO_CACHEDIR, conf->basecachedir().getValue().c_str());
+ }
#endif
return h;
}
@@ -526,6 +530,9 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitRemote(const char *destdir)
handleSetOpt(h.get(), LRO_METALINKURL, tmp.c_str());
}
handleSetOpt(h.get(), LRO_FASTESTMIRROR, conf->fastestmirror().getValue() ? 1L : 0L);
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
auto fastestMirrorCacheDir = conf->basecachedir().getValue();
if (fastestMirrorCacheDir.back() != '/')
fastestMirrorCacheDir.push_back('/');
@@ -569,8 +576,12 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitRemote(const char *destdir)
#ifdef LRO_SUPPORTS_CACHEDIR
/* If zchunk is enabled, set librepo cache dir */
- if (conf->getMasterConfig().zchunk().getValue())
+ if (conf->getMasterConfig().zchunk().getValue()) {
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
handleSetOpt(h.get(), LRO_CACHEDIR, conf->basecachedir().getValue().c_str());
+ }
#endif
auto minrate = conf->minrate().getValue();
@@ -610,6 +621,9 @@ std::unique_ptr<LrHandle> Repo::Impl::lrHandleInitRemote(const char *destdir)
if (!conf->proxy_username().empty()) {
userpwd = conf->proxy_username().getValue();
if (!userpwd.empty()) {
+ if (conf->proxy_password().empty()) {
+ throw RepoError(tfm::format(_("repo '%s': 'proxy_username' is set but not 'proxy_password'"), id));
+ }
userpwd = formatUserPassString(userpwd, conf->proxy_password().getValue(), true);
handleSetOpt(h.get(), LRO_PROXYUSERPWD, userpwd.c_str());
}
@@ -1346,6 +1360,9 @@ std::string Repo::Impl::getHash() const
std::string Repo::Impl::getCachedir() const
{
+ if (conf->basecachedir().empty()) {
+ throw Exception(tfm::format(_("repo '%s': 'basecachedir' is not set"), id));
+ }
auto repodir(conf->basecachedir().getValue());
if (repodir.back() != '/')
repodir.push_back('/');
@@ -1690,6 +1707,9 @@ static LrHandle * newHandle(ConfigMain * conf)
if (!conf->proxy_username().empty()) {
auto userpwd = conf->proxy_username().getValue();
if (!userpwd.empty()) {
+ if (conf->proxy_password().empty()) {
+ throw RepoError(_("'proxy_username' is set but not 'proxy_password'"));
+ }
userpwd = formatUserPassString(userpwd, conf->proxy_password().getValue(), true);
handleSetOpt(h, LRO_PROXYUSERPWD, userpwd.c_str());
}

View File

@ -1,244 +0,0 @@
From a96d701f7f55ff475e11ac9cda63b81c31c54e7a Mon Sep 17 00:00:00 2001
From: Daniel Mach <dmach@redhat.com>
Date: Wed, 6 May 2020 08:34:46 +0200
Subject: [PATCH] history: Fix dnf history rollback when a package was removed
(RhBug:1683134)
---
libdnf/transaction/MergedTransaction.cpp | 25 +++-
.../transaction/MergedTransactionTest.cpp | 120 ++++++++++++++++--
.../transaction/MergedTransactionTest.hpp | 6 +-
3 files changed, 137 insertions(+), 14 deletions(-)
diff --git a/libdnf/transaction/MergedTransaction.cpp b/libdnf/transaction/MergedTransaction.cpp
index a7c06ffa9..a8d878cb5 100644
--- a/libdnf/transaction/MergedTransaction.cpp
+++ b/libdnf/transaction/MergedTransaction.cpp
@@ -19,6 +19,7 @@
*/
#include "MergedTransaction.hpp"
+#include <algorithm>
#include <vector>
namespace libdnf {
@@ -171,6 +172,21 @@ MergedTransaction::getConsoleOutput()
return output;
}
+
+static bool transaction_item_sort_function(const std::shared_ptr<TransactionItemBase> lhs, const std::shared_ptr<TransactionItemBase> rhs) {
+ if (lhs->isForwardAction() && rhs->isForwardAction()) {
+ return false;
+ }
+ if (lhs->isBackwardAction() && rhs->isBackwardAction()) {
+ return false;
+ }
+ if (lhs->isBackwardAction()) {
+ return true;
+ }
+ return false;
+}
+
+
/**
* Get list of transaction items involved in the merged transaction
* Actions are merged using following rules:
@@ -203,6 +219,9 @@ MergedTransaction::getItems()
// iterate over transaction
for (auto t : transactions) {
auto transItems = t->getItems();
+ // sort transaction items by their action type - forward/backward
+ // this fixes behavior of the merging algorithm in several edge cases
+ std::sort(transItems.begin(), transItems.end(), transaction_item_sort_function);
// iterate over transaction items
for (auto transItem : transItems) {
// get item and its type
@@ -383,10 +402,6 @@ MergedTransaction::mergeItem(ItemPairMap &itemPairMap, TransactionItemBasePtr mT
auto firstState = previousItemPair.first->getAction();
auto newState = mTransItem->getAction();
- if (firstState == TransactionItemAction::INSTALL && mTransItem->isBackwardAction()) {
- return;
- }
-
switch (firstState) {
case TransactionItemAction::REMOVE:
case TransactionItemAction::OBSOLETED:
@@ -399,6 +414,8 @@ MergedTransaction::mergeItem(ItemPairMap &itemPairMap, TransactionItemBasePtr mT
// Install -> Remove = (nothing)
itemPairMap.erase(name);
break;
+ } else if (mTransItem->isBackwardAction()) {
+ break;
}
// altered -> transfer install to the altered package
mTransItem->setAction(TransactionItemAction::INSTALL);
diff --git a/tests/libdnf/transaction/MergedTransactionTest.cpp b/tests/libdnf/transaction/MergedTransactionTest.cpp
index 90ad182cf..52507700b 100644
--- a/tests/libdnf/transaction/MergedTransactionTest.cpp
+++ b/tests/libdnf/transaction/MergedTransactionTest.cpp
@@ -700,7 +700,7 @@ MergedTransactionTest::test_downgrade()
}
void
-MergedTransactionTest::test_install_downgrade()
+MergedTransactionTest::test_install_downgrade_upgrade_remove()
{
auto trans1 = std::make_shared< libdnf::swdb_private::Transaction >(conn);
trans1->addItem(
@@ -724,19 +724,123 @@ MergedTransactionTest::test_install_downgrade()
TransactionItemReason::USER
);
+ auto trans3 = std::make_shared< libdnf::swdb_private::Transaction >(conn);
+ trans3->addItem(
+ nevraToRPMItem(conn, "tour-0:4.6-1.noarch"),
+ "repo2",
+ TransactionItemAction::UPGRADED,
+ TransactionItemReason::USER
+ );
+ trans3->addItem(
+ nevraToRPMItem(conn, "tour-0:4.8-1.noarch"),
+ "repo1",
+ TransactionItemAction::UPGRADE,
+ TransactionItemReason::USER
+ );
+
+ auto trans4 = std::make_shared< libdnf::swdb_private::Transaction >(conn);
+ trans4->addItem(
+ nevraToRPMItem(conn, "tour-0:4.8-1.noarch"),
+ "repo1",
+ TransactionItemAction::REMOVE,
+ TransactionItemReason::USER
+ );
+
MergedTransaction merged(trans1);
+
+ // test merging trans1, trans2
merged.merge(trans2);
+ auto items2 = merged.getItems();
+ CPPUNIT_ASSERT_EQUAL(1, (int)items2.size());
+ auto item2 = items2.at(0);
+ CPPUNIT_ASSERT_EQUAL(std::string("tour-4.6-1.noarch"), item2->getItem()->toStr());
+ CPPUNIT_ASSERT_EQUAL(std::string("repo2"), item2->getRepoid());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemAction::INSTALL, item2->getAction());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item2->getReason());
- auto items = merged.getItems();
- CPPUNIT_ASSERT_EQUAL(1, (int)items.size());
+ // test merging trans1, trans2, trans3
+ merged.merge(trans3);
+ auto items3 = merged.getItems();
+ CPPUNIT_ASSERT_EQUAL(1, (int)items3.size());
+ auto item3 = items3.at(0);
+ CPPUNIT_ASSERT_EQUAL(std::string("tour-4.8-1.noarch"), item3->getItem()->toStr());
+ CPPUNIT_ASSERT_EQUAL(std::string("repo1"), item3->getRepoid());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemAction::INSTALL, item3->getAction());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item3->getReason());
- auto item = items.at(0);
- CPPUNIT_ASSERT_EQUAL(std::string("tour-4.6-1.noarch"), item->getItem()->toStr());
- CPPUNIT_ASSERT_EQUAL(std::string("repo2"), item->getRepoid());
- CPPUNIT_ASSERT_EQUAL(TransactionItemAction::INSTALL, item->getAction());
- CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item->getReason());
+ // test merging trans1, trans2, trans3, trans4
+ merged.merge(trans4);
+ auto items4 = merged.getItems();
+ CPPUNIT_ASSERT_EQUAL(0, (int)items4.size());
+ // trans4 removes the package, empty output is expected
}
+
+void
+MergedTransactionTest::test_downgrade_upgrade_remove()
+{
+ auto trans1 = std::make_shared< libdnf::swdb_private::Transaction >(conn);
+ trans1->addItem(
+ nevraToRPMItem(conn, "tour-0:4.6-1.noarch"),
+ "repo2",
+ TransactionItemAction::DOWNGRADE,
+ TransactionItemReason::USER
+ );
+ trans1->addItem(
+ nevraToRPMItem(conn, "tour-0:4.8-1.noarch"),
+ "repo1",
+ TransactionItemAction::DOWNGRADED,
+ TransactionItemReason::USER
+ );
+
+ // items are in reversed order than in test_install_downgrade_upgrade_remove()
+ // fixing this required ordering transaction items by forward/backward action
+ auto trans2 = std::make_shared< libdnf::swdb_private::Transaction >(conn);
+ trans2->addItem(
+ nevraToRPMItem(conn, "tour-0:4.8-1.noarch"),
+ "repo1",
+ TransactionItemAction::UPGRADE,
+ TransactionItemReason::USER
+ );
+ trans2->addItem(
+ nevraToRPMItem(conn, "tour-0:4.6-1.noarch"),
+ "repo2",
+ TransactionItemAction::UPGRADED,
+ TransactionItemReason::USER
+ );
+
+ auto trans3 = std::make_shared< libdnf::swdb_private::Transaction >(conn);
+ trans3->addItem(
+ nevraToRPMItem(conn, "tour-0:4.8-1.noarch"),
+ "repo1",
+ TransactionItemAction::REMOVE,
+ TransactionItemReason::USER
+ );
+
+ MergedTransaction merged(trans1);
+
+ // test merging trans1, trans2
+ merged.merge(trans2);
+ auto items2 = merged.getItems();
+ CPPUNIT_ASSERT_EQUAL(1, (int)items2.size());
+ auto item2 = items2.at(0);
+ CPPUNIT_ASSERT_EQUAL(std::string("tour-4.8-1.noarch"), item2->getItem()->toStr());
+ CPPUNIT_ASSERT_EQUAL(std::string("repo1"), item2->getRepoid());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemAction::REINSTALL, item2->getAction());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item2->getReason());
+
+ // test merging trans1, trans2, trans3
+ merged.merge(trans3);
+ auto items3 = merged.getItems();
+ CPPUNIT_ASSERT_EQUAL(1, (int)items3.size());
+ auto item3 = items3.at(0);
+ CPPUNIT_ASSERT_EQUAL(std::string("tour-4.8-1.noarch"), item3->getItem()->toStr());
+ CPPUNIT_ASSERT_EQUAL(std::string("repo1"), item3->getRepoid());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemAction::REMOVE, item3->getAction());
+ CPPUNIT_ASSERT_EQUAL(TransactionItemReason::USER, item3->getReason());
+}
+
+
void
MergedTransactionTest::test_multilib_identity()
{
diff --git a/tests/libdnf/transaction/MergedTransactionTest.hpp b/tests/libdnf/transaction/MergedTransactionTest.hpp
index 9f1ed660a..77585e865 100644
--- a/tests/libdnf/transaction/MergedTransactionTest.hpp
+++ b/tests/libdnf/transaction/MergedTransactionTest.hpp
@@ -26,7 +26,8 @@ class MergedTransactionTest : public CppUnit::TestCase {
CPPUNIT_TEST(test_add_obsoleted_obsoleted);
CPPUNIT_TEST(test_downgrade);
- CPPUNIT_TEST(test_install_downgrade);
+ CPPUNIT_TEST(test_install_downgrade_upgrade_remove);
+ CPPUNIT_TEST(test_downgrade_upgrade_remove);
CPPUNIT_TEST(test_multilib_identity);
@@ -56,7 +57,8 @@ class MergedTransactionTest : public CppUnit::TestCase {
// END: tests ported from DNF unit tests
void test_downgrade();
- void test_install_downgrade();
+ void test_install_downgrade_upgrade_remove();
+ void test_downgrade_upgrade_remove();
void test_multilib_identity();
private:

View File

@ -0,0 +1,73 @@
From 71db968178e5d8cd4c01ed36fa940c2a95f3e494 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 9 Nov 2020 18:10:37 +0100
Subject: [PATCH] [modules] Add special handling for src artifacts
(RhBug:1809314)
Source packages are special because they cannot be installed and provide
nothing, therefore they should be handled by a different way than binary
packages. Source rpm should not trigger a removal of binary packages.
---
libdnf/dnf-sack.cpp | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 9fd2c72d1..d44e1d86d 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -2335,20 +2335,29 @@ setModuleExcludes(DnfSack *sack, const char ** hotfixRepos,
{
dnf_sack_set_module_excludes(sack, nullptr);
std::vector<std::string> names;
+ std::vector<std::string> srcNames;
libdnf::DependencyContainer nameDependencies{sack};
libdnf::Nevra nevra;
for (const auto &rpm : includeNEVRAs) {
if (nevra.parse(rpm.c_str(), HY_FORM_NEVRA)) {
- names.push_back(nevra.getName());
- nameDependencies.addReldep(nevra.getName().c_str());
+ auto arch = nevra.getArch();
+ // source packages do not provide anything and must not cause excluding binary packages
+ if (arch == "src" || arch == "nosrc") {
+ srcNames.push_back(nevra.getName());
+ } else {
+ names.push_back(nevra.getName());
+ nameDependencies.addReldep(nevra.getName().c_str());
+ }
}
}
std::vector<const char *> namesCString(names.size() + 1);
+ std::vector<const char *> srcNamesCString(srcNames.size() + 1);
std::vector<const char *> excludeNEVRAsCString(excludeNEVRAs.size() + 1);
std::vector<const char *> includeNEVRAsCString(includeNEVRAs.size() + 1);
transform(names.begin(), names.end(), namesCString.begin(), std::mem_fn(&std::string::c_str));
+ transform(srcNames.begin(), srcNames.end(), srcNamesCString.begin(), std::mem_fn(&std::string::c_str));
transform(excludeNEVRAs.begin(), excludeNEVRAs.end(), excludeNEVRAsCString.begin(),
std::mem_fn(&std::string::c_str));
transform(includeNEVRAs.begin(), includeNEVRAs.end(), includeNEVRAsCString.begin(),
@@ -2363,6 +2372,7 @@ setModuleExcludes(DnfSack *sack, const char ** hotfixRepos,
libdnf::Query excludeQuery{keepPackages};
libdnf::Query excludeProvidesQuery{keepPackages};
libdnf::Query excludeNamesQuery(keepPackages);
+ libdnf::Query excludeSrcNamesQuery(keepPackages);
includeQuery.addFilter(HY_PKG_NEVRA_STRICT, HY_EQ, includeNEVRAsCString.data());
excludeQuery.addFilter(HY_PKG_NEVRA_STRICT, HY_EQ, excludeNEVRAsCString.data());
@@ -2372,8 +2382,14 @@ setModuleExcludes(DnfSack *sack, const char ** hotfixRepos,
excludeProvidesQuery.addFilter(HY_PKG_PROVIDES, &nameDependencies);
excludeProvidesQuery.queryDifference(includeQuery);
- // Requred to filtrate out source packages and packages with incompatible architectures
+ // Search for source packages with same names as included source artifacts
+ excludeSrcNamesQuery.addFilter(HY_PKG_NAME, HY_EQ, srcNamesCString.data());
+ const char * srcArchs[] = {"src", "nosrc", nullptr};
+ excludeSrcNamesQuery.addFilter(HY_PKG_ARCH, HY_EQ, srcArchs);
+
+ // Required to filtrate out source packages and packages with incompatible architectures
excludeNamesQuery.addFilter(HY_PKG_NAME, HY_EQ, namesCString.data());
+ excludeNamesQuery.queryUnion(excludeSrcNamesQuery);
excludeNamesQuery.queryDifference(includeQuery);
dnf_sack_set_module_excludes(sack, excludeQuery.getResultPset());

View File

@ -0,0 +1,101 @@
From 3f6adc99506f065d0858e4d9d46055be9d070634 Mon Sep 17 00:00:00 2001
From: Nicola Sella <nsella@redhat.com>
Date: Fri, 22 Jan 2021 16:07:37 +0100
Subject: [PATCH] Avoid multilib file conflict in config.h (RhBug:1918818)
=changelog=
msg: Avoid multilib file conflicts in config.h
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1918818
---
.gitignore | 2 +-
libdnf/CMakeLists.txt | 8 ++++++-
libdnf/{config.h.in => config-64.h.in} | 6 +++---
libdnf/config.h | 29 ++++++++++++++++++++++++++
4 files changed, 40 insertions(+), 5 deletions(-)
rename libdnf/{config.h.in => config-64.h.in} (87%)
create mode 100644 libdnf/config.h
diff --git a/.gitignore b/.gitignore
index e17a9b9bb..0a63bdae7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,4 +5,4 @@
build
*.pyc
data/tests/modules/yum.repos.d/test.repo
-libdnf/config.h
+libdnf/config-64.h
diff --git a/libdnf/CMakeLists.txt b/libdnf/CMakeLists.txt
index e82aac11e..25f33d7b0 100644
--- a/libdnf/CMakeLists.txt
+++ b/libdnf/CMakeLists.txt
@@ -35,7 +35,13 @@ set(LIBDNF_SRCS
include_directories(transaction)
add_subdirectory("transaction")
-configure_file("config.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(MULTILIB_ARCH "64")
+ configure_file("config-64.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/config-64.h)
+elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
+ set(MULTILIB_ARCH "32")
+ configure_file("config-64.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/config-32.h)
+endif()
configure_file("dnf-version.h.in" ${CMAKE_CURRENT_SOURCE_DIR}/dnf-version.h)
configure_file("libdnf.pc.in" ${CMAKE_CURRENT_BINARY_DIR}/libdnf.pc @ONLY)
diff --git a/libdnf/config.h.in b/libdnf/config-64.h.in
similarity index 87%
rename from libdnf/config.h.in
rename to libdnf/config-64.h.in
index 77974f757..e2329fe71 100644
--- a/libdnf/config.h.in
+++ b/libdnf/config-64.h.in
@@ -18,9 +18,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#ifndef _LIBDNF_CONFIG_H_
-#define _LIBDNF_CONFIG_H_
+#ifndef _LIBDNF_CONFIG_@MULTILIB_ARCH@_H_
+#define _LIBDNF_CONFIG_@MULTILIB_ARCH@_H_
#define DEFAULT_PLUGINS_DIRECTORY "@CMAKE_INSTALL_FULL_LIBDIR@/libdnf/plugins/"
-#endif // _LIBDNF_CONFIG_H_
+#endif // _LIBDNF_CONFIG_@MULTILIB_ARCH@_H_
diff --git a/libdnf/config.h b/libdnf/config.h
new file mode 100644
index 000000000..16121f6f5
--- /dev/null
+++ b/libdnf/config.h
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2018 Red Hat, Inc.
+ *
+ * Licensed under the GNU Lesser General Public License Version 2.1
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <bits/wordsize.h>
+
+#if __WORDSIZE == 32
+#include "config-32.h"
+#elif __WORDSIZE == 64
+#include "config-64.h"
+#else
+#error "Unknown word size"
+#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,134 @@
From 816d18d826dc7134e553eae28f4aaca9a27e2307 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Mon, 2 Nov 2020 11:43:19 +0100
Subject: [PATCH 1/2] Allow loading ext metadata even if only cache (solv) is
present
If we have a valid (checksum matches with repomd) solv file for
requested type of metadata allow using it even if we no longer have the
original xml metadata.
---
libdnf/dnf-sack.cpp | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 6a43f01e3..608103d18 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -371,20 +371,9 @@ load_ext(DnfSack *sack, HyRepo hrepo, _hy_repo_repodata which_repodata,
auto repoImpl = libdnf::repoGetImpl(hrepo);
Repo *repo = repoImpl->libsolvRepo;
const char *name = repo->name;
- auto fn = hrepo->getMetadataPath(which_filename);
FILE *fp;
gboolean done = FALSE;
- /* nothing set */
- if (fn.empty()) {
- g_set_error (error,
- DNF_ERROR,
- DNF_ERROR_NO_CAPABILITY,
- _("no %1$s string for %2$s"),
- which_filename, name);
- return FALSE;
- }
-
char *fn_cache = dnf_sack_give_cache_fn(sack, name, suffix);
fp = fopen(fn_cache, "r");
assert(libdnf::repoGetImpl(hrepo)->checksum);
@@ -416,6 +405,17 @@ load_ext(DnfSack *sack, HyRepo hrepo, _hy_repo_repodata which_repodata,
if (done)
return TRUE;
+ auto fn = hrepo->getMetadataPath(which_filename);
+ /* nothing set */
+ if (fn.empty()) {
+ g_set_error (error,
+ DNF_ERROR,
+ DNF_ERROR_NO_CAPABILITY,
+ _("no %1$s string for %2$s"),
+ which_filename, name);
+ return FALSE;
+ }
+
fp = solv_xfopen(fn.c_str(), "r");
if (fp == NULL) {
g_set_error (error,
From aa2a372158f1b264708f960f387218deea17ef2a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Thu, 10 Dec 2020 14:21:03 +0100
Subject: [PATCH 2/2] Extend repo loadCache method with ignoreMissing parameter
This allows loading even incomplete cache of xml files, only repomd.xml
is requried.
= changelog =
msg: Extend repo loadCache method with ignoreMissing parameter to allow
loading incomplete xml cache (repomd.xml is required).
type: enhancement
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1865803
---
VERSION.cmake | 2 +-
libdnf.spec | 2 +-
libdnf/repo/Repo-private.hpp | 2 +-
libdnf/repo/Repo.cpp | 8 ++++++--
libdnf/repo/Repo.hpp | 2 +-
5 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/libdnf/repo/Repo-private.hpp b/libdnf/repo/Repo-private.hpp
index 1e4ea4d20..c2ce369dc 100644
--- a/libdnf/repo/Repo-private.hpp
+++ b/libdnf/repo/Repo-private.hpp
@@ -111,7 +111,7 @@ class Repo::Impl {
~Impl();
bool load();
- bool loadCache(bool throwExcept);
+ bool loadCache(bool throwExcept, bool ignoreMissing=false);
void downloadMetadata(const std::string & destdir);
bool isInSync();
void fetch(const std::string & destdir, std::unique_ptr<LrHandle> && h);
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 34539e1ee..84702c294 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -379,7 +379,7 @@ std::string Repo::getLocalBaseurl() const
}
bool Repo::load() { return pImpl->load(); }
-bool Repo::loadCache(bool throwExcept) { return pImpl->loadCache(throwExcept); }
+bool Repo::loadCache(bool throwExcept, bool ignoreMissing) { return pImpl->loadCache(throwExcept, ignoreMissing); }
void Repo::downloadMetadata(const std::string & destdir) { pImpl->downloadMetadata(destdir); }
bool Repo::getUseIncludes() const { return pImpl->useIncludes; }
void Repo::setUseIncludes(bool enabled) { pImpl->useIncludes = enabled; }
@@ -963,11 +963,15 @@ std::unique_ptr<LrResult> Repo::Impl::lrHandlePerform(LrHandle * handle, const s
return result;
}
-bool Repo::Impl::loadCache(bool throwExcept)
+bool Repo::Impl::loadCache(bool throwExcept, bool ignoreMissing)
{
std::unique_ptr<LrHandle> h(lrHandleInitLocal());
std::unique_ptr<LrResult> r;
+ if (ignoreMissing) {
+ handleSetOpt(h.get(), LRO_IGNOREMISSING, 1L);
+ }
+
// Fetch data
try {
r = lrHandlePerform(h.get(), getCachedir(), conf->repo_gpgcheck().getValue());
diff --git a/libdnf/repo/Repo.hpp b/libdnf/repo/Repo.hpp
index eeec651c3..be376f60c 100644
--- a/libdnf/repo/Repo.hpp
+++ b/libdnf/repo/Repo.hpp
@@ -167,7 +167,7 @@ struct Repo {
* @return true if fresh metadata were downloaded, false otherwise.
*/
bool load();
- bool loadCache(bool throwExcept);
+ bool loadCache(bool throwExcept, bool ignoreMissing=false);
void downloadMetadata(const std::string & destdir);
bool getUseIncludes() const;
void setUseIncludes(bool enabled);

View File

@ -0,0 +1,53 @@
From a1c96ecae6f2052407345a66293710109323de3a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Tue, 21 Jul 2020 15:37:05 +0200
Subject: [PATCH] Add new option module_stream_switch
= changelog =
msg: Add new options module_stream_switch
type: enhancement
---
libdnf/conf/ConfigMain.cpp | 3 +++
libdnf/conf/ConfigMain.hpp | 1 +
2 files changed, 4 insertions(+)
diff --git a/libdnf/conf/ConfigMain.cpp b/libdnf/conf/ConfigMain.cpp
index 1ffd3b336..abfc2082b 100644
--- a/libdnf/conf/ConfigMain.cpp
+++ b/libdnf/conf/ConfigMain.cpp
@@ -278,6 +278,7 @@ class ConfigMain::Impl {
OptionBool downloadonly{false}; // runtime only option
OptionBool ignorearch{false};
OptionString module_platform_id{nullptr};
+ OptionBool module_stream_switch{false};
OptionString user_agent{getUserAgent()};
OptionBool countme{false};
@@ -434,6 +435,7 @@ ConfigMain::Impl::Impl(Config & owner)
owner.optBinds().add("comment", comment);
owner.optBinds().add("ignorearch", ignorearch);
owner.optBinds().add("module_platform_id", module_platform_id);
+ owner.optBinds().add("module_stream_switch", module_stream_switch);
owner.optBinds().add("user_agent", user_agent);
owner.optBinds().add("countme", countme);
owner.optBinds().add("protect_running_kernel", protect_running_kernel);
@@ -569,6 +571,7 @@ OptionBool & ConfigMain::downloadonly() { return pImpl->downloadonly; }
OptionBool & ConfigMain::ignorearch() { return pImpl->ignorearch; }
OptionString & ConfigMain::module_platform_id() { return pImpl->module_platform_id; }
+OptionBool & ConfigMain::module_stream_switch() { return pImpl->module_stream_switch; }
OptionString & ConfigMain::user_agent() { return pImpl->user_agent; }
OptionBool & ConfigMain::countme() { return pImpl->countme; }
OptionBool & ConfigMain::protect_running_kernel() {return pImpl->protect_running_kernel; }
diff --git a/libdnf/conf/ConfigMain.hpp b/libdnf/conf/ConfigMain.hpp
index 226c74d50..835e1fc65 100644
--- a/libdnf/conf/ConfigMain.hpp
+++ b/libdnf/conf/ConfigMain.hpp
@@ -125,6 +125,7 @@ class ConfigMain : public Config {
OptionBool & ignorearch();
OptionString & module_platform_id();
+ OptionBool & module_stream_switch();
OptionString & user_agent();
OptionBool & countme();
OptionBool & protect_running_kernel();

View File

@ -0,0 +1,23 @@
From 831d023c3c6fb4a28903cb3170efdd9f85645e1a Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Fri, 20 Nov 2020 16:30:17 +0100
Subject: [PATCH] Fix removal step during modular enable in context part
It resolves `free(): double free detected in tcache 2`
---
libdnf/dnf-context.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 069267119..bc4a15b68 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -3087,7 +3087,7 @@ static std::vector<std::tuple<libdnf::ModulePackageContainer::ModuleErrorType, s
}
for (auto iter = stream_dict.begin(); iter != stream_dict.end(); ) {
if (iter->first != enabledOrDefaultStream) {
- stream_dict.erase(iter);
+ stream_dict.erase(iter++);
} else {
++iter;
}

View File

@ -1,12 +1,14 @@
%global libsolv_version 0.7.7
%global libmodulemd_version 2.5.0
%global librepo_version 1.12.0
%global dnf_conflict 4.2.23
%global dnf_conflict 4.3.0
%global swig_version 3.0.12
%global libdnf_major_version 0
%global libdnf_minor_version 48
%global libdnf_minor_version 55
%global libdnf_micro_version 0
%define __cmake_in_source_build 1
# set sphinx package name according to distro
%global requires_python2_sphinx python2-sphinx
%global requires_python3_sphinx python3-sphinx
@ -54,12 +56,19 @@
Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 2%{?dist}
Release: 6%{?dist}
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
Patch1: 0001-history-Fix-dnf-history-rollback-when-a-package-was-removed-RhBug1683134.patch
Patch0: 0001-Better-msgs-if-basecachedir-or-proxy-password-isn-t-set-RhBug-1888946.patch
Patch1: 0002-modules-Add-special-handling-for-src-artifacts-RhBug-1809314.patch
Patch2: 0003-Avoid-multilib-file-conflict-in-config.h-RhBug-1918818.patch
Patch3: 0004-context-improve-retrieving-repository-configuration.patch
Patch4: 0005-Allow-loading-incomplete-cache-and-loading-ext-solv-files-without-its-repodata.patch
Patch5: 0006-Add-new-option-module-stream-switch.patch
Patch6: 0007-Fix-removal-step-during-modular-enable-in-context-part.patch
BuildRequires: cmake
BuildRequires: gcc
@ -307,6 +316,42 @@ popd
%endif
%changelog
* Fri Feb 12 2021 Nicola Sella <nsella@redhat.com> - 0.55.0-6
- Fix removal step during modular enable in context part
* Thu Feb 11 2021 Nicola Sella <nsella@redhat.com> - 0.55.0-5
- Add new option module_stream_switch
* Mon Feb 08 2021 Nicola Sella <nsella@redhat.com> - 0.55.0-4
- [context] improve retrieving repository configuration
- Allow loading incomplete cache and loading ext solv files without its repodata
* Fri Jan 29 2021 Nicola Sella <nsella@redhat.com> - 0.55.0-3
- Avoid multilib file conflict in config.h (RhBug:1918818)
- [modules] Add special handling for src artifacts (RhBug:1809314)
* Fri Jan 15 2021 Nicola Sella <nsella@redhat.com> - 0.55.0-2
- Better msgs if "basecachedir" or "proxy_password" isn't set (RhBug:1888946)
* Mon Nov 09 2020 Nicola Sella <nsella@redhat.com> - 0.55.0-1
- Add vendor to dnf API (RhBug:1876561)
- Add formatting function for solver error
- Add error types in ModulePackageContainer
- Implement module enable for context part
- Improve string formatting for translation
- Remove redundant printf and change logging info to notice (RhBug:1827424)
- Add allow_vendor_change option (RhBug:1788371) (RhBug:1788371)
* Thu Aug 20 2020 Nicola Sella <nsella@redhat.com> - 0.48.0-5
- [covscan] Handle exception in a python binding by the proper function (RhBug:1870492)
* Tue Jul 28 2020 Marek Blaha <mblaha@redhat.com> - 0.48.0-4
- Update translations (RhBug:1820548)
* Fri Jul 17 2020 Nicola Sella <nsella@redhat.com> - 0.48.0-3
- Add log file level main config option (RhBug:1802074)
- Accept '==' as an operator in reldeps (RhBug:1847946)
* Wed Jun 10 2020 Ales Matej <amatej@redhat.com> - 0.48.0-2
- [history] Fix dnf history rollback when a package was removed (RhBug:1683134)