import libdnf-0.35.1-9.el8_1

This commit is contained in:
CentOS Sources 2019-11-05 17:34:52 -05:00 committed by Andrew Lukoshko
commit 2c9dc79ea8
17 changed files with 25485 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
SOURCES/libdnf-0.35.1.tar.gz

1
.libdnf.metadata Normal file
View File

@ -0,0 +1 @@
91fcde5c3c2e716bc3baad1e9be118f51effac13 SOURCES/libdnf-0.35.1.tar.gz

View File

@ -0,0 +1,265 @@
From d267539801ce0a32392d3a86d94e6ea37b6dc2ba Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 12 Jul 2019 06:51:25 +0200
Subject: [PATCH 1/5] [context] Fix: Correctly detach libsolv repo
(RhBug:1727343)
Seting repoImpl->libsolvRepo = nullptr and repoImpl->nrefs = 1 is not sufficient.
The libsolvRepo inernally points back to us. And during destroying
it destroy us too because nrefs was set to 1.
Solution is to do full detach using detachLibsolvRepo().
It fixes https://bugzilla.redhat.com/show_bug.cgi?id=1727343
and probably https://bugzilla.redhat.com/show_bug.cgi?id=1727424
---
libdnf/dnf-repo.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdnf/dnf-repo.cpp b/libdnf/dnf-repo.cpp
index a358356a9..45c6c7e5b 100644
--- a/libdnf/dnf-repo.cpp
+++ b/libdnf/dnf-repo.cpp
@@ -1403,9 +1403,9 @@ dnf_repo_check_internal(DnfRepo *repo,
}
/* init */
- repoImpl->libsolvRepo = nullptr;
+ if (repoImpl->libsolvRepo)
+ repoImpl->detachLibsolvRepo();
repoImpl->needs_internalizing = false;
- repoImpl->nrefs = 1;
repoImpl->state_main = _HY_NEW;
repoImpl->state_filelists = _HY_NEW;
repoImpl->state_presto = _HY_NEW;
From f1e2e534d7d375d051c4eae51431c5bb3649f9f1 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 12 Jul 2019 07:59:15 +0200
Subject: [PATCH 2/5] [Repo] Remove unused delReference
---
libdnf/repo/Repo.cpp | 7 -------
libdnf/repo/Repo.hpp | 2 --
2 files changed, 9 deletions(-)
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 23638839a..fd2415fa5 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -1441,13 +1441,6 @@ std::vector<std::string> Repo::getMirrors() const
return mirrors;
}
-void Repo::delReference()
-{
- if (--pImpl->nrefs > 0)
- return;
- delete this;
-}
-
int PackageTargetCB::end(TransferStatus status, const char * msg) { return 0; }
int PackageTargetCB::progress(double totalToDownload, double downloaded) { return 0; }
int PackageTargetCB::mirrorFailure(const char *msg, const char *url) { return 0; }
diff --git a/libdnf/repo/Repo.hpp b/libdnf/repo/Repo.hpp
index cbf4ed147..785c6e9d5 100644
--- a/libdnf/repo/Repo.hpp
+++ b/libdnf/repo/Repo.hpp
@@ -275,8 +275,6 @@ struct Repo {
~Repo();
- void delReference();
-
class Impl;
private:
friend struct PackageTarget;
From 4c35d135bc79939d58844e99e0d5ed924ba86fd5 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 12 Jul 2019 08:50:54 +0200
Subject: [PATCH 3/5] [Repo] Add locking and asserts
Add locking and asserts into attachLibsolvRepo(), detachLibsolvRepo()
and hy_repo_free()
---
libdnf/dnf-repo.cpp | 3 +--
libdnf/repo/Repo-private.hpp | 5 +++++
libdnf/repo/Repo.cpp | 34 ++++++++++++++++++++++++++--------
3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/libdnf/dnf-repo.cpp b/libdnf/dnf-repo.cpp
index 45c6c7e5b..c30d99d17 100644
--- a/libdnf/dnf-repo.cpp
+++ b/libdnf/dnf-repo.cpp
@@ -1403,8 +1403,7 @@ dnf_repo_check_internal(DnfRepo *repo,
}
/* init */
- if (repoImpl->libsolvRepo)
- repoImpl->detachLibsolvRepo();
+ repoImpl->detachLibsolvRepo();
repoImpl->needs_internalizing = false;
repoImpl->state_main = _HY_NEW;
repoImpl->state_filelists = _HY_NEW;
diff --git a/libdnf/repo/Repo-private.hpp b/libdnf/repo/Repo-private.hpp
index 23acf3622..333eb7bfd 100644
--- a/libdnf/repo/Repo-private.hpp
+++ b/libdnf/repo/Repo-private.hpp
@@ -43,6 +43,7 @@
#include <cctype>
#include <map>
+#include <mutex>
#include <set>
#include <string.h>
@@ -177,6 +178,10 @@ class Repo::Impl {
int main_nrepodata{0};
int main_end{0};
+ // Lock attachLibsolvRepo(), detachLibsolvRepo() and hy_repo_free() to ensure atomic behavior
+ // in threaded environment such as PackageKit.
+ std::mutex attachLibsolvMutex;
+
private:
Repo * owner;
std::unique_ptr<LrResult> lrHandlePerform(LrHandle * handle, const std::string & destDirectory,
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index fd2415fa5..86531fe9b 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -60,7 +60,6 @@
#include <iostream>
#include <list>
#include <map>
-#include <mutex>
#include <set>
#include <sstream>
#include <type_traits>
@@ -1335,8 +1334,10 @@ LrHandle * Repo::Impl::getCachedHandle()
void Repo::Impl::attachLibsolvRepo(LibsolvRepo * libsolvRepo)
{
+ std::lock_guard<std::mutex> guard(attachLibsolvMutex);
+ assert(!this->libsolvRepo);
++nrefs;
- libsolvRepo->appdata = owner;
+ libsolvRepo->appdata = owner; // The libsolvRepo references back to us.
libsolvRepo->subpriority = -owner->getCost();
libsolvRepo->priority = -owner->getPriority();
this->libsolvRepo = libsolvRepo;
@@ -1344,11 +1345,23 @@ void Repo::Impl::attachLibsolvRepo(LibsolvRepo * libsolvRepo)
void Repo::Impl::detachLibsolvRepo()
{
- libsolvRepo->appdata = nullptr;
- if (--nrefs > 0)
- this->libsolvRepo = nullptr;
- else
+ attachLibsolvMutex.lock();
+ if (!libsolvRepo) {
+ // Nothing to do, libsolvRepo is not attached.
+ attachLibsolvMutex.unlock();
+ return;
+ }
+
+ libsolvRepo->appdata = nullptr; // Removes reference to this object from libsolvRepo.
+ this->libsolvRepo = nullptr;
+
+ if (--nrefs <= 0) {
+ // There is no reference to this object, we are going to destroy it.
+ // Mutex is part of this object, we must unlock it before destroying.
+ attachLibsolvMutex.unlock();
delete owner;
+ } else
+ attachLibsolvMutex.unlock();
}
void Repo::setMaxMirrorTries(int maxMirrorTries)
@@ -2057,7 +2070,12 @@ hy_repo_get_string(HyRepo repo, int which)
void
hy_repo_free(HyRepo repo)
{
- if (--libdnf::repoGetImpl(repo)->nrefs > 0)
- return;
+ auto repoImpl = libdnf::repoGetImpl(repo);
+ {
+ std::lock_guard<std::mutex> guard(repoImpl->attachLibsolvMutex);
+ if (--repoImpl->nrefs > 0)
+ return; // There is still a reference to this object. Don't destroy it.
+ }
+ assert(!repoImpl->libsolvRepo);
delete repo;
}
From 3a61d4c590612427bfeb7302236e4429acae90b0 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Fri, 12 Jul 2019 11:21:48 +0200
Subject: [PATCH 4/5] Fix: crash in repo_internalize_trigger() without HyRepo
attached
The repo_internalize_trigger() uses needs_internalizing from HyRepo.
If HyRepo is not attached we will assume needs_internalizing==true.
---
libdnf/repo/Repo.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 86531fe9b..210ecde8f 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -1826,15 +1826,19 @@ repo_internalize_all_trigger(Pool *pool)
void
repo_internalize_trigger(Repo * repo)
{
- if (repo) {
- auto hrepo = static_cast<HyRepo>(repo->appdata);
+ if (!repo)
+ return;
+
+ if (auto hrepo = static_cast<HyRepo>(repo->appdata)) {
+ // HyRepo is attached. The hint needs_internalizing will be used.
auto repoImpl = libdnf::repoGetImpl(hrepo);
assert(repoImpl->libsolvRepo == repo);
if (!repoImpl->needs_internalizing)
return;
repoImpl->needs_internalizing = false;
- repo_internalize(repo);
}
+
+ repo_internalize(repo);
}
void
From e4cabf803e1dbb6283330636d06ccb4a26e89ad4 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Sun, 14 Jul 2019 10:45:27 +0200
Subject: [PATCH 5/5] [Repo] attachLibsolvRepo() can reattach repo to another
libsolvRepo
---
libdnf/repo/Repo.cpp | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 210ecde8f..70c6a7411 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -1335,8 +1335,14 @@ LrHandle * Repo::Impl::getCachedHandle()
void Repo::Impl::attachLibsolvRepo(LibsolvRepo * libsolvRepo)
{
std::lock_guard<std::mutex> guard(attachLibsolvMutex);
- assert(!this->libsolvRepo);
- ++nrefs;
+
+ if (this->libsolvRepo)
+ // A libsolvRepo was attached to this object before. Remove it's reference to this object.
+ this->libsolvRepo->appdata = nullptr;
+ else
+ // The libsolvRepo will reference this object. Increase reference counter.
+ ++nrefs;
+
libsolvRepo->appdata = owner; // The libsolvRepo references back to us.
libsolvRepo->subpriority = -owner->getCost();
libsolvRepo->priority = -owner->getPriority();

View File

@ -0,0 +1,26 @@
From b84fe340840169d201714a5b3a015b9d1142013c Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Wed, 3 Jul 2019 13:48:58 +0200
Subject: [PATCH] Typo in error message (RhBug:1726661)
https://bugzilla.redhat.com/show_bug.cgi?id=1726661
---
libdnf/module/ModulePackageContainer.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/module/ModulePackageContainer.cpp b/libdnf/module/ModulePackageContainer.cpp
index ddef174..1c8e0d5 100644
--- a/libdnf/module/ModulePackageContainer.cpp
+++ b/libdnf/module/ModulePackageContainer.cpp
@@ -1637,7 +1637,7 @@ void ModulePackageContainer::updateFailSafeData()
if (!updateFile(filePath, modulePackage->getYaml().c_str())) {
auto logger(Log::getLogger());
logger->debug(tfm::format(
- _("Unable to safe a modular Fail Safe data to '%s'"), filePath));
+ _("Unable to save a modular Fail Safe data to '%s'"), filePath));
}
}
--
libgit2 0.28.2

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,45 @@
From 5923a9cc15b9fe541e71a9ef4bb550b6ddc481fc Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Wed, 12 Jun 2019 13:22:31 +0200
Subject: [PATCH] [context] Fix: Don't disable nonexistent but required repositories (RhBug:1689331)
The nonexistent local/media repositories were automatically disabled
during check (in function dnf_repo_check_internal). So application
(the Packagekit daemon) that reuses the deactivated repository object
then silently skip the repository as disabled.
We should not to disable repositories which are required
(skip_if_unavailable=0).
Fix for https://bugzilla.redhat.com/show_bug.cgi?id=1689331
---
libdnf/dnf-repo.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/libdnf/dnf-repo.cpp b/libdnf/dnf-repo.cpp
index d49c306..a358356 100644
--- a/libdnf/dnf-repo.cpp
+++ b/libdnf/dnf-repo.cpp
@@ -1312,7 +1312,8 @@ dnf_repo_check_internal(DnfRepo *repo,
/* has the media repo vanished? */
if (priv->kind == DNF_REPO_KIND_MEDIA &&
!g_file_test(priv->location, G_FILE_TEST_EXISTS)) {
- priv->enabled = DNF_REPO_ENABLED_NONE;
+ if (!dnf_repo_get_required(repo))
+ priv->enabled = DNF_REPO_ENABLED_NONE;
g_set_error(error,
DNF_ERROR,
DNF_ERROR_REPO_NOT_AVAILABLE,
@@ -1323,7 +1324,8 @@ dnf_repo_check_internal(DnfRepo *repo,
/* has the local repo vanished? */
if (priv->kind == DNF_REPO_KIND_LOCAL &&
!g_file_test(priv->location, G_FILE_TEST_EXISTS)) {
- priv->enabled = DNF_REPO_ENABLED_NONE;
+ if (!dnf_repo_get_required(repo))
+ priv->enabled = DNF_REPO_ENABLED_NONE;
g_set_error(error,
DNF_ERROR,
DNF_ERROR_REPO_NOT_AVAILABLE,
--
libgit2 0.28.2

View File

@ -0,0 +1,35 @@
From 9e670738044166cdd0bf566325bf610bfb802821 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Mon, 24 Jun 2019 16:34:47 +0200
Subject: [PATCH] [config] ignore trailing blank lines of multiline value (RhBug:1722493)
Parser supports multiline values. Example:
key = value first line
value second line
If a line starts with whitespaces and it is not a section name,
it is treated as continuation of previous key=value line.
This commit ignores trailing blank lines. So newline characters
are trimmed out from the end of line.
---
libdnf/utils/iniparser/iniparser.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/libdnf/utils/iniparser/iniparser.cpp b/libdnf/utils/iniparser/iniparser.cpp
index c77c5ca..14fef74 100644
--- a/libdnf/utils/iniparser/iniparser.cpp
+++ b/libdnf/utils/iniparser/iniparser.cpp
@@ -81,6 +81,9 @@ IniParser::IniParser(std::unique_ptr<std::istream> && inputStream)
}
void IniParser::trimValue() noexcept {
+ auto end = value.find_last_not_of(DELIMITER);
+ if (end != value.npos)
+ value.resize(end + 1);
if (value.length() > 1 &&
value.front() == value.back() &&
(value.front() == '\"' || value.front() == '\'')) {
--
libgit2 0.28.2

View File

@ -0,0 +1,27 @@
From f1cf6f12157da3cf555e49d1b5f0af5c81d0c101 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Fri, 28 Jun 2019 18:47:19 +0200
Subject: [PATCH] Re-size includes map before re-computation (RhBug:1725213)
It resolves problems with incorrect reads.
https://bugzilla.redhat.com/show_bug.cgi?id=1725213
---
libdnf/dnf-sack.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/libdnf/dnf-sack.cpp b/libdnf/dnf-sack.cpp
index 33fbe4a..c0c1cc5 100644
--- a/libdnf/dnf-sack.cpp
+++ b/libdnf/dnf-sack.cpp
@@ -356,6 +356,7 @@ dnf_sack_recompute_considered(DnfSack *sack)
if (priv->module_excludes)
map_subtract(pool->considered, priv->module_excludes);
if (priv->pkg_includes) {
+ map_grow(priv->pkg_includes, pool->nsolvables);
Map pkg_includes_tmp;
map_init_clone(&pkg_includes_tmp, priv->pkg_includes);
--
libgit2 0.28.2

View File

@ -0,0 +1,142 @@
From 12acb4b30c9a88b9082f7dcbda0257b47bed9c87 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Sat, 13 Apr 2019 18:46:28 +0200
Subject: [PATCH 1/3] Add HY_PKG_CONFLICTS for conversion into reldep
Sequence of HY_PKG_CONFLICTS requires conversion into reldep.
---
python/hawkey/query-py.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/python/hawkey/query-py.cpp b/python/hawkey/query-py.cpp
index d90f9c95..5bc8d123 100644
--- a/python/hawkey/query-py.cpp
+++ b/python/hawkey/query-py.cpp
@@ -350,6 +350,7 @@ filter_add(HyQuery query, key_t keyname, int cmp_type, PyObject *match)
break;
}
+ case HY_PKG_CONFLICTS:
case HY_PKG_PROVIDES:
case HY_PKG_REQUIRES:
case HY_PKG_ENHANCES:
--
2.21.0
From db4118aeab5d8ed0006d7fe8b924304c7f52d34d Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Sat, 13 Apr 2019 19:38:29 +0200
Subject: [PATCH 2/3] Add support of PY string sequence for HY_PKG_OBSOLETES
---
python/hawkey/query-py.cpp | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/python/hawkey/query-py.cpp b/python/hawkey/query-py.cpp
index 5bc8d123..e9d220b6 100644
--- a/python/hawkey/query-py.cpp
+++ b/python/hawkey/query-py.cpp
@@ -340,10 +340,26 @@ filter_add(HyQuery query, key_t keyname, int cmp_type, PyObject *match)
switch (keyname) {
case HY_PKG:
case HY_PKG_OBSOLETES: {
+ // It could be a sequence of packages or reldep/strings. Lets try packages first.
auto pset = pyseq_to_packageset(match, query->getSack());
-
- if (!pset)
+ if (!pset) {
+ if (auto PyError = PyErr_Occurred()) {
+ // It was not a sequence of packages.
+ if (PyErr_GivenExceptionMatches(PyError, PyExc_TypeError)) {
+ PyErr_Clear();
+ auto reldeplist = pyseq_to_reldeplist(match, query->getSack(), cmp_type);
+ if (reldeplist == NULL)
+ return 1;
+
+ int ret = query->addFilter(keyname, reldeplist.get());
+ if (ret) {
+ return raise_bad_filter();
+ }
+ break;
+ }
+ }
return 1;
+ }
int ret = query->addFilter(keyname, cmp_type, pset.get());
if (ret)
return raise_bad_filter();
--
2.21.0
From 247f05ef7c3083953e02948ba629cc9ef4184e05 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 15 Apr 2019 09:54:12 +0200
Subject: [PATCH 3/3] Add conversion for sequence to reldep in c/c++ interface
This conversion is supported from Python, but was not implemented in
c/c++ code.
When sequence that requires conversion was used, it failed on assertion.
---
libdnf.spec | 2 +-
libdnf/sack/query.cpp | 29 ++++++++++++++++++++++++++++-
2 files changed, 29 insertions(+), 2 deletions(-)
diff --git a/libdnf.spec b/libdnf.spec
index d7b3270a..5f0b6529 100644
--- a/libdnf.spec
+++ b/libdnf.spec
@@ -37,7 +37,7 @@
%{nil}
Name: libdnf
-Version: 0.35.1
+Version: 0.35.2
Release: 1%{?dist}
Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+
diff --git a/libdnf/sack/query.cpp b/libdnf/sack/query.cpp
index d5b29a66..949b5ab9 100644
--- a/libdnf/sack/query.cpp
+++ b/libdnf/sack/query.cpp
@@ -882,7 +882,34 @@ Query::addFilter(int keyname, int cmp_type, const char **matches)
if (!valid_filter_str(keyname, cmp_type))
return DNF_ERROR_BAD_QUERY;
pImpl->applied = false;
- pImpl->filters.push_back(Filter(keyname, cmp_type, matches));
+ switch (keyname) {
+ case HY_PKG_CONFLICTS:
+ case HY_PKG_ENHANCES:
+ case HY_PKG_OBSOLETES:
+ case HY_PKG_PROVIDES:
+ case HY_PKG_RECOMMENDS:
+ case HY_PKG_REQUIRES:
+ case HY_PKG_SUGGESTS:
+ case HY_PKG_SUPPLEMENTS: {
+ DnfSack *sack = pImpl->sack;
+ const unsigned nmatches = g_strv_length((gchar**)matches);
+ DependencyContainer reldeplist(sack);
+ if (cmp_type == HY_GLOB) {
+ for (unsigned int i = 0; i < nmatches; ++i) {
+ reldeplist.addReldepWithGlob(matches[i]);
+ }
+ } else {
+ for (unsigned int i = 0; i < nmatches; ++i) {
+ reldeplist.addReldep(matches[i]);
+ }
+ }
+ return addFilter(keyname, &reldeplist);
+ }
+ default: {
+ pImpl->filters.push_back(Filter(keyname, cmp_type, matches));
+ return 0;
+ }
+ }
return 0;
}
--
2.21.0

View File

@ -0,0 +1,160 @@
From d66dfc2815153b315f5b3fd9d3f93be670def26a Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Tue, 3 Sep 2019 12:55:51 +0200
Subject: [PATCH 09/10] Added dnf_move_recursive()
Moves a directory and its contents. If native move operations are
supported then this is used, otherwise a copy + delete fallback is used.
---
libdnf/hy-iutil-private.hpp | 1 +
libdnf/hy-iutil.cpp | 95 +++++++++++++++++++++++++++++++++++--
2 files changed, 93 insertions(+), 3 deletions(-)
diff --git a/libdnf/hy-iutil-private.hpp b/libdnf/hy-iutil-private.hpp
index 8b2b06d5..4920ad39 100644
--- a/libdnf/hy-iutil-private.hpp
+++ b/libdnf/hy-iutil-private.hpp
@@ -41,6 +41,7 @@ char *abspath(const char *path);
int is_readable_rpm(const char *fn);
int mkcachedir(char *path);
gboolean mv(const char *old_path, const char *new_path, GError **error);
+gboolean dnf_move_recursive(const gchar *src_dir, const gchar *dst_dir, GError **error);
char *this_username(void);
/* misc utils */
diff --git a/libdnf/hy-iutil.cpp b/libdnf/hy-iutil.cpp
index 2c5af481..d3b57c79 100644
--- a/libdnf/hy-iutil.cpp
+++ b/libdnf/hy-iutil.cpp
@@ -20,12 +20,14 @@
#include <assert.h>
#include <errno.h>
+#include <dirent.h>
#include <fcntl.h>
#include <linux/limits.h>
#include <pwd.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/utsname.h>
@@ -41,9 +43,6 @@ extern "C" {
#include <solv/pool_parserpmrichdep.h>
}
-// glib
-#include <glib.h>
-
// hawkey
#include "dnf-advisory-private.hpp"
#include "dnf-types.h"
@@ -58,6 +57,12 @@ extern "C" {
#include "utils/bgettext/bgettext-lib.h"
#include "sack/packageset.hpp"
+// glib
+#include <glib.h>
+#include <gio/gio.h>
+
+#include <string>
+
#define BUF_BLOCK 4096
#define CHKSUM_TYPE REPOKEY_TYPE_SHA256
#define CHKSUM_IDENT "H000"
@@ -328,6 +333,90 @@ mv(const char* old_path, const char* new_path, GError** error)
return TRUE;
}
+static gboolean
+copyFile(const std::string & srcPath, const std::string & dstPath, GError ** error)
+{
+ g_autoptr(GFile) src = g_file_new_for_path(srcPath.c_str());
+ g_autoptr(GFile) dest = g_file_new_for_path(dstPath.c_str());
+ return g_file_copy(src, dest,
+ static_cast<GFileCopyFlags>(G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA)
+ , NULL, NULL, NULL, error);
+}
+
+static gboolean
+copyRecursive(const std::string & srcPath, const std::string & dstPath, GError ** error)
+{
+ struct stat info;
+ if (!stat(srcPath.c_str(), &info)) {
+ if (S_ISDIR(info.st_mode)) {
+ if (mkdir(dstPath.c_str(), info.st_mode) == -1) {
+ auto err = errno;
+ g_set_error(error,
+ DNF_ERROR,
+ DNF_ERROR_INTERNAL_ERROR,
+ _("cannot create directory %1$s: %2$s"),
+ dstPath.c_str(), strerror(err));
+ return FALSE;
+ }
+ if (auto fd = opendir(srcPath.c_str())) {
+ int ret = TRUE;
+ while (auto dent = readdir(fd)) {
+ auto name = dent->d_name;
+ if (name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))
+ continue;
+ std::string srcItem = srcPath + "/" + name;
+ std::string dstItem = dstPath + "/" + name;
+ ret = copyRecursive(srcItem, dstItem, error);
+ if (!ret)
+ break;
+ }
+ closedir(fd);
+ return ret;
+ } else {
+ auto err = errno;
+ g_set_error(error,
+ DNF_ERROR,
+ DNF_ERROR_INTERNAL_ERROR,
+ _("cannot open directory %1$s: %2$s"),
+ srcPath.c_str(), strerror(err));
+ return FALSE;
+ }
+ } else {
+ return copyFile(srcPath, dstPath, error);
+ }
+ } else {
+ auto err = errno;
+ g_set_error(error,
+ DNF_ERROR,
+ DNF_ERROR_INTERNAL_ERROR,
+ _("cannot stat path %1$s: %2$s"),
+ srcPath.c_str(), strerror(err));
+ return FALSE;
+ }
+}
+
+/**
+ * dnf_move_recursive:
+ * @src_dir: A source directory path
+ * @dst_dir: A destination directory path
+ * @error: A #GError, or %NULL
+ *
+ * Moves a directory and its contents. Native move is preferred,
+ * if not supported copy and delete fallback is used.
+ *
+ * Returns: %TRUE on successful move, %FALSE otherwise
+ **/
+gboolean
+dnf_move_recursive(const char * srcDir, const char * dstDir, GError ** error)
+{
+ if (rename(srcDir, dstDir) == -1) {
+ if (!copyRecursive(srcDir, dstDir, error))
+ return FALSE;
+ return dnf_remove_recursive(srcDir, error);
+ }
+ return TRUE;
+}
+
char *
this_username(void)
{
--
2.21.0

View File

@ -0,0 +1,100 @@
From 99d35011a057a112957c6e878f4ac0b7ab0d0e7a Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Tue, 3 Sep 2019 13:13:31 +0200
Subject: [PATCH 10/10] Use copy+delete fallback if moving of directory failed
(RhBug:1700341)
Uses dnf_move_recursive() instead of g_rename()/rename() for
move a directories.
The dnf_move_recursive() uses copy+delete fallback if native moving
of directory failed (eg. moving between filesystems, overlayfs).
https://bugzilla.redhat.com/show_bug.cgi?id=1700341
---
libdnf/dnf-repo.cpp | 19 +++++++++----------
libdnf/repo/Repo.cpp | 12 ++++++++----
2 files changed, 17 insertions(+), 14 deletions(-)
diff --git a/libdnf/dnf-repo.cpp b/libdnf/dnf-repo.cpp
index a358356a..568e4262 100644
--- a/libdnf/dnf-repo.cpp
+++ b/libdnf/dnf-repo.cpp
@@ -36,6 +36,7 @@
#include "conf/OptionBool.hpp"
#include "hy-repo-private.hpp"
+#include "hy-iutil-private.hpp"
#include <strings.h>
#include <fcntl.h>
@@ -1826,14 +1827,13 @@ dnf_repo_update(DnfRepo *repo,
/* move the packages directory from the old cache to the new cache */
if (g_file_test(priv->packages, G_FILE_TEST_EXISTS)) {
- rc = g_rename(priv->packages, priv->packages_tmp);
- if (rc != 0) {
- ret = FALSE;
+ ret = dnf_move_recursive(priv->packages, priv->packages_tmp, &error_local);
+ if (!ret) {
g_set_error(error,
DNF_ERROR,
DNF_ERROR_CANNOT_FETCH_SOURCE,
- "cannot move %s to %s",
- priv->packages, priv->packages_tmp);
+ "cannot move %s to %s: %s",
+ priv->packages, priv->packages_tmp, error_local->message);
goto out;
}
}
@@ -1844,14 +1844,13 @@ dnf_repo_update(DnfRepo *repo,
goto out;
/* rename .tmp actual name */
- rc = g_rename(priv->location_tmp, priv->location);
- if (rc != 0) {
- ret = FALSE;
+ ret = dnf_move_recursive(priv->location_tmp, priv->location, &error_local);
+ if (!ret) {
g_set_error(error,
DNF_ERROR,
DNF_ERROR_CANNOT_FETCH_SOURCE,
- "cannot move %s to %s",
- priv->location_tmp, priv->location);
+ "cannot move %s to %s: %s",
+ priv->location_tmp, priv->location, error_local->message);
goto out;
}
ret = lr_handle_setopt(priv->repo_handle, error,
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 23638839..0dbeed8b 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -31,6 +31,7 @@
#include "../hy-iutil.h"
#include "../hy-repo-private.hpp"
#include "../hy-util-private.hpp"
+#include "../hy-iutil-private.hpp"
#include "../hy-types.h"
#include "libdnf/conf/ConfigParser.hpp"
#include "libdnf/utils/File.hpp"
@@ -1155,10 +1156,13 @@ void Repo::Impl::fetch(const std::string & destdir, std::unique_ptr<LrHandle> &&
}
}
auto tempElement = tmpdir + "/" + elName;
- if (rename(tempElement.c_str(), targetElement.c_str()) == -1) {
- const char * errTxt = strerror(errno);
- throw std::runtime_error(tfm::format(
- _("Cannot rename directory \"%s\" to \"%s\": %s"), tempElement, targetElement, errTxt));
+ GError * error = NULL;
+ if (!dnf_move_recursive(tempElement.c_str(), targetElement.c_str(), &error)) {
+ std::string errTxt = tfm::format(
+ _("Cannot rename directory \"%s\" to \"%s\": %s"),
+ tempElement, targetElement, error->message);
+ g_error_free(error);
+ throw std::runtime_error(errTxt);
}
}
}
--
2.21.0

View File

@ -0,0 +1,100 @@
From 865b0b958c044af966f89520ed97fad9b987f006 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Thu, 5 Sep 2019 09:20:20 +0200
Subject: [PATCH 11/13] Expose dnf_copy_file and dnf_copy_recursive in private
hpp
Renaming:
copyFile -> dnf_copy_file
copyRecursive -> dnf_copy_recursice
Exposes newnames in private hpp to be possible use it internally
in libdnf.
Closes: #789
Approved by: m-blaha
---
libdnf/hy-iutil-private.hpp | 2 ++
libdnf/hy-iutil.cpp | 20 ++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/libdnf/hy-iutil-private.hpp b/libdnf/hy-iutil-private.hpp
index 4920ad39..2d84cc21 100644
--- a/libdnf/hy-iutil-private.hpp
+++ b/libdnf/hy-iutil-private.hpp
@@ -41,6 +41,8 @@ char *abspath(const char *path);
int is_readable_rpm(const char *fn);
int mkcachedir(char *path);
gboolean mv(const char *old_path, const char *new_path, GError **error);
+gboolean dnf_copy_file(const std::string & srcPath, const std::string & dstPath, GError ** error);
+gboolean dnf_copy_recursive(const std::string & srcPath, const std::string & dstPath, GError ** error);
gboolean dnf_move_recursive(const gchar *src_dir, const gchar *dst_dir, GError **error);
char *this_username(void);
diff --git a/libdnf/hy-iutil.cpp b/libdnf/hy-iutil.cpp
index d3b57c79..5401a9cf 100644
--- a/libdnf/hy-iutil.cpp
+++ b/libdnf/hy-iutil.cpp
@@ -333,18 +333,18 @@ mv(const char* old_path, const char* new_path, GError** error)
return TRUE;
}
-static gboolean
-copyFile(const std::string & srcPath, const std::string & dstPath, GError ** error)
+gboolean
+dnf_copy_file(const std::string & srcPath, const std::string & dstPath, GError ** error)
{
g_autoptr(GFile) src = g_file_new_for_path(srcPath.c_str());
g_autoptr(GFile) dest = g_file_new_for_path(dstPath.c_str());
return g_file_copy(src, dest,
- static_cast<GFileCopyFlags>(G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA)
- , NULL, NULL, NULL, error);
+ static_cast<GFileCopyFlags>(G_FILE_COPY_NOFOLLOW_SYMLINKS | G_FILE_COPY_ALL_METADATA),
+ NULL, NULL, NULL, error);
}
-static gboolean
-copyRecursive(const std::string & srcPath, const std::string & dstPath, GError ** error)
+gboolean
+dnf_copy_recursive(const std::string & srcPath, const std::string & dstPath, GError ** error)
{
struct stat info;
if (!stat(srcPath.c_str(), &info)) {
@@ -359,14 +359,14 @@ copyRecursive(const std::string & srcPath, const std::string & dstPath, GError *
return FALSE;
}
if (auto fd = opendir(srcPath.c_str())) {
- int ret = TRUE;
+ gboolean ret = TRUE;
while (auto dent = readdir(fd)) {
auto name = dent->d_name;
if (name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0')))
continue;
std::string srcItem = srcPath + "/" + name;
std::string dstItem = dstPath + "/" + name;
- ret = copyRecursive(srcItem, dstItem, error);
+ ret = dnf_copy_recursive(srcItem, dstItem, error);
if (!ret)
break;
}
@@ -382,7 +382,7 @@ copyRecursive(const std::string & srcPath, const std::string & dstPath, GError *
return FALSE;
}
} else {
- return copyFile(srcPath, dstPath, error);
+ return dnf_copy_file(srcPath, dstPath, error);
}
} else {
auto err = errno;
@@ -410,7 +410,7 @@ gboolean
dnf_move_recursive(const char * srcDir, const char * dstDir, GError ** error)
{
if (rename(srcDir, dstDir) == -1) {
- if (!copyRecursive(srcDir, dstDir, error))
+ if (!dnf_copy_recursive(srcDir, dstDir, error))
return FALSE;
return dnf_remove_recursive(srcDir, error);
}
--
2.21.0

View File

@ -0,0 +1,60 @@
From 842c0057f82a587f8dd2649d920420b7d888fddf Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Thu, 5 Sep 2019 13:55:00 +0200
Subject: [PATCH 12/13] Add dnf_remove_recursive_v2() that support unlink of
file
The dnf_remove_recursive() accepts only directory as argument.
The new function supports unlink of files.
Closes: #789
Approved by: m-blaha
---
libdnf/hy-iutil-private.hpp | 1 +
libdnf/hy-iutil.cpp | 18 ++++++++++++++++++
2 files changed, 19 insertions(+)
diff --git a/libdnf/hy-iutil-private.hpp b/libdnf/hy-iutil-private.hpp
index 2d84cc21..bf1714e9 100644
--- a/libdnf/hy-iutil-private.hpp
+++ b/libdnf/hy-iutil-private.hpp
@@ -41,6 +41,7 @@ char *abspath(const char *path);
int is_readable_rpm(const char *fn);
int mkcachedir(char *path);
gboolean mv(const char *old_path, const char *new_path, GError **error);
+gboolean dnf_remove_recursive_v2(const gchar *path, GError **error);
gboolean dnf_copy_file(const std::string & srcPath, const std::string & dstPath, GError ** error);
gboolean dnf_copy_recursive(const std::string & srcPath, const std::string & dstPath, GError ** error);
gboolean dnf_move_recursive(const gchar *src_dir, const gchar *dst_dir, GError **error);
diff --git a/libdnf/hy-iutil.cpp b/libdnf/hy-iutil.cpp
index 5401a9cf..e1a1906a 100644
--- a/libdnf/hy-iutil.cpp
+++ b/libdnf/hy-iutil.cpp
@@ -333,6 +333,24 @@ mv(const char* old_path, const char* new_path, GError** error)
return TRUE;
}
+/**
+ * dnf_remove_recursive_v2:
+ * @directory: A directory path
+ * @error: A #GError, or %NULL
+ *
+ * Removes a file or a directory and its contents.
+ *
+ * Returns: %FALSE if an error was set
+ **/
+gboolean
+dnf_remove_recursive_v2(const gchar *path, GError **error)
+{
+ if (g_file_test(path, G_FILE_TEST_IS_DIR))
+ return dnf_remove_recursive(path, error);
+ else
+ return dnf_ensure_file_unlinked(path, error);
+}
+
gboolean
dnf_copy_file(const std::string & srcPath, const std::string & dstPath, GError ** error)
{
--
2.21.0

View File

@ -0,0 +1,42 @@
From dab2ade3727dbf61dbcfd58d7a2a3fdbbb36116e Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Thu, 5 Sep 2019 14:01:26 +0200
Subject: [PATCH 13/13] Fix: dnf_move_recursive() for file in fallback mode
The dnf_move_recursive() had problem with moving a file in the fallback
mode. The file was copied but removing of its source failed.
The dnf_remove_recursive_v2() is used now to resolve the issue.
Related to https://bugzilla.redhat.com/show_bug.cgi?id=1700341
Closes: #789
Approved by: m-blaha
---
libdnf/hy-iutil.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/libdnf/hy-iutil.cpp b/libdnf/hy-iutil.cpp
index e1a1906a..0bd0e245 100644
--- a/libdnf/hy-iutil.cpp
+++ b/libdnf/hy-iutil.cpp
@@ -419,7 +419,7 @@ dnf_copy_recursive(const std::string & srcPath, const std::string & dstPath, GEr
* @dst_dir: A destination directory path
* @error: A #GError, or %NULL
*
- * Moves a directory and its contents. Native move is preferred,
+ * Moves a file or a directory and its contents. Native move is preferred,
* if not supported copy and delete fallback is used.
*
* Returns: %TRUE on successful move, %FALSE otherwise
@@ -430,7 +430,7 @@ dnf_move_recursive(const char * srcDir, const char * dstDir, GError ** error)
if (rename(srcDir, dstDir) == -1) {
if (!dnf_copy_recursive(srcDir, dstDir, error))
return FALSE;
- return dnf_remove_recursive(srcDir, error);
+ return dnf_remove_recursive_v2(srcDir, error);
}
return TRUE;
}
--
2.21.0

View File

@ -0,0 +1,46 @@
From a9e281087d075f798ac64dad657d34816d533d2a Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Tue, 3 Sep 2019 11:01:23 +0200
Subject: [PATCH] Mark job goal.upgrade with sltr as targeted
It allows to keep installed packages in upgrade set.
It also prevents from reinstalling of modified packages with same NEVRA.
---
libdnf/goal/Goal.cpp | 2 +-
libdnf/goal/Goal.hpp | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
index b69be19..a38cbb4 100644
--- a/libdnf/goal/Goal.cpp
+++ b/libdnf/goal/Goal.cpp
@@ -767,7 +767,7 @@ void
Goal::upgrade(HySelector sltr)
{
pImpl->actions = static_cast<DnfGoalActions>(pImpl->actions | DNF_UPGRADE);
- sltrToJob(sltr, &pImpl->staging, SOLVER_UPDATE);
+ sltrToJob(sltr, &pImpl->staging, SOLVER_UPDATE|SOLVER_TARGETED);
}
void
diff --git a/libdnf/goal/Goal.hpp b/libdnf/goal/Goal.hpp
index f33dfa2..d701317 100644
--- a/libdnf/goal/Goal.hpp
+++ b/libdnf/goal/Goal.hpp
@@ -86,8 +86,10 @@ public:
/**
* @brief If selector ill formed, it rises std::runtime_error()
*
- * @param sltr p_sltr: It should contain only upgrades with obsoletes otherwise it can try to
- * reinstall installonly packages.
+ * @param sltr p_sltr: It contains upgrade-to packages and obsoletes. The presence of installed
+ * packages prevents reinstalling packages with the same NEVRA but changed contant. To honor repo
+ * priority all relevant packages must be present. To upgrade package foo from priority repo, all
+ * installed and available packages of the foo must be in selector plus obsoletes of foo.
*/
void upgrade(HySelector sltr);
void userInstalled(DnfPackage *pkg);
--
libgit2 0.28.2

View File

@ -0,0 +1,34 @@
From c235dae84d1b45911f6de1c5d31fedf4856c0d42 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Wed, 11 Sep 2019 13:26:43 +0200
Subject: [PATCH] Apply targeted upgrade only for selector with packages
It resolves problem when selector with name filter is used. Then
targeted transaction ignores obsoletes.
Closes: #793
Approved by: jrohel
---
libdnf/goal/Goal.cpp | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
index a38cbb4..88e7b8c 100644
--- a/libdnf/goal/Goal.cpp
+++ b/libdnf/goal/Goal.cpp
@@ -767,7 +767,11 @@ void
Goal::upgrade(HySelector sltr)
{
pImpl->actions = static_cast<DnfGoalActions>(pImpl->actions | DNF_UPGRADE);
- sltrToJob(sltr, &pImpl->staging, SOLVER_UPDATE|SOLVER_TARGETED);
+ auto flags = SOLVER_UPDATE;
+ if (sltr->getPkgs()) {
+ flags |= SOLVER_TARGETED;
+ }
+ sltrToJob(sltr, &pImpl->staging, flags);
}
void
--
libgit2 0.28.2

572
SPECS/libdnf.spec Normal file
View File

@ -0,0 +1,572 @@
%global libsolv_version 0.7.4-1
%global libmodulemd_version 1.6.1
%global librepo_version 1.10.0
%global dnf_conflict 4.2.7-7
%global swig_version 3.0.12
%bcond_with valgrind
# Do not build bindings for python3 for RHEL <= 7
%if 0%{?rhel} && 0%{?rhel} <= 7
%bcond_with python3
%else
%bcond_without python3
%endif
%if 0%{?rhel}
%global rpm_version 4.14.2
%else
%global rpm_version 4.14.2.1-4
%endif
%if 0%{?rhel} > 7 || 0%{?fedora} > 29
# Disable python2 build by default
%bcond_with python2
%else
%bcond_without python2
%endif
%if 0%{?rhel} && ! 0%{?centos}
%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.35.1
Release: 9%{?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
# Temporary patch to not fail on modular RPMs without modular metadata
# until the infrastructure is ready
Patch2: 0002-Fix-attaching-and-detaching-of-libsolvRepo.patch
Patch3: 0003-Typo-in-error-message-RhBug1726661.patch
Patch4: 0004-Update-localizations-from-zanata-RhBug1689991.patch
Patch5: 0005-context-Fix-Dont-disable-nonexistent-but-required-repositories-RhBug1689331.patch
Patch6: 0006-config-ignore-trailing-blank-lines-of-multiline-value-RhBug1722493.patch
Patch7: 0007-Re-size-includes-map-before-re-computation-RhBug1725213.patch
Patch8: 0008-Add-suport-for-query-sequence-conversions.patch
Patch9: 0009-Added-dnf_move_recursive.patch
Patch10: 0010-Use-copy-delete-fallback-if-moving-of-directory-fail.patch
Patch11: 0011-Expose-dnf_copy_file-and-dnf_copy_recursive-in-priva.patch
Patch12: 0012-Add-dnf_remove_recursive_v2-that-support-unlink-of-f.patch
Patch13: 0013-Fix-dnf_move_recursive-for-file-in-fallback-mode.patch
Patch14: 0014-Mark-job-goalupgrade-with-sltr-as-targeted.patch
Patch15: 0015-Apply-targeted-upgrade-only-for-selector-with-packages.patch
BuildRequires: cmake
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: libsolv-devel >= %{libsolv_version}
BuildRequires: pkgconfig(librepo) >= %{librepo_version}
BuildRequires: pkgconfig(check)
%if %{with valgrind}
BuildRequires: valgrind
%endif
BuildRequires: pkgconfig(gio-unix-2.0) >= 2.46.0
BuildRequires: pkgconfig(gtk-doc)
BuildRequires: rpm-devel >= %{rpm_version}
%if %{with rhsm}
BuildRequires: pkgconfig(librhsm) >= 0.0.3
%endif
BuildRequires: pkgconfig(sqlite3)
BuildRequires: pkgconfig(json-c)
BuildRequires: pkgconfig(cppunit)
BuildRequires: pkgconfig(libcrypto)
BuildRequires: pkgconfig(modulemd) >= %{libmodulemd_version}
BuildRequires: pkgconfig(smartcols)
BuildRequires: gettext
BuildRequires: gpgme-devel
Requires: libmodulemd%{?_isa} >= %{libmodulemd_version}
Requires: libsolv%{?_isa} >= %{libsolv_version}
Requires: librepo%{?_isa} >= %{librepo_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}.
%if %{with python2}
%package -n python2-%{name}
%{?python_provide:%python_provide python2-%{name}}
Summary: Python 2 bindings for the libdnf library.
Requires: %{name}%{?_isa} = %{version}-%{release}
BuildRequires: python2-devel
%if 0%{?rhel} == 7
BuildRequires: python-sphinx
BuildRequires: swig3 >= %{swig_version}
%else
BuildRequires: python2-sphinx
BuildRequires: swig >= %{swig_version}
%endif
%description -n python2-%{name}
Python 2 bindings for the libdnf library.
%endif # with python2
%if %{with python3}
%package -n python3-%{name}
%{?python_provide:%python_provide python3-%{name}}
Summary: Python 3 bindings for the libdnf library.
Requires: %{name}%{?_isa} = %{version}-%{release}
BuildRequires: python3-devel
BuildRequires: python3-sphinx
BuildRequires: swig >= %{swig_version}
%description -n python3-%{name}
Python 3 bindings for the libdnf library.
%endif
%if %{with python2}
%package -n python2-hawkey
Summary: Python 2 bindings for the hawkey library
%{?python_provide:%python_provide python2-hawkey}
BuildRequires: python2-devel
%if 0%{?rhel} && 0%{?rhel} <= 7
BuildRequires: python-nose
%else
BuildRequires: python2-nose
%endif
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python2-%{name} = %{version}-%{release}
# Fix problem with hawkey - dnf version incompatibility
# Can be deleted for distros where only python2-dnf >= 2.0.0
Conflicts: python2-dnf < %{dnf_conflict}
Conflicts: python-dnf < %{dnf_conflict}
%description -n python2-hawkey
Python 2 bindings for the hawkey library.
%endif # with python2
%if %{with python3}
%package -n python3-hawkey
Summary: Python 3 bindings for the hawkey library
%{?python_provide:%python_provide python3-hawkey}
BuildRequires: python3-devel
BuildRequires: python3-nose
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-%{name} = %{version}-%{release}
# Fix problem with hawkey - dnf version incompatibility
# Can be deleted for distros where only python3-dnf >= 2.0.0
Conflicts: python3-dnf < %{dnf_conflict}
# Obsoletes F27 packages
Obsoletes: platform-python-hawkey < %{version}-%{release}
%description -n python3-hawkey
Python 3 bindings for the hawkey library.
%endif
%prep
%autosetup -p1
%if %{with python2}
mkdir build-py2
%endif # with python2
%if %{with python3}
mkdir build-py3
%endif
%build
%if %{with python2}
pushd build-py2
%cmake -DPYTHON_DESIRED:FILEPATH=%{__python2} -DWITH_MAN=OFF ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
%make_build
popd
%endif # with python2
%if %{with python3}
pushd build-py3
%cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DWITH_GIR=0 -DWITH_MAN=0 -Dgtkdoc=0 ../ %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
%make_build
popd
%endif
%check
if [ "$(id -u)" == "0" ] ; then
cat <<ERROR 1>&2
Package tests cannot be run under superuser account.
Please build the package as non-root user.
ERROR
exit 1
fi
%if %{with python2}
pushd build-py2
make ARGS="-V" test
popd
%endif # with python2
%if %{with python3}
# Run just the Python tests, not all of them, since
# we have coverage of the core from the first build
pushd build-py3/python/hawkey/tests
make ARGS="-V" test
popd
%endif
%install
%if %{with python2}
pushd build-py2
%make_install
popd
%endif # with python2
%if %{with python3}
pushd build-py3
%make_install
popd
%endif
%find_lang %{name}
%if 0%{?rhel} && 0%{?rhel} <= 7
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%else
%ldconfig_scriptlets
%endif
%files -f %{name}.lang
%license COPYING
%doc README.md AUTHORS
%{_libdir}/%{name}.so.*
%dir %{_libdir}/libdnf/
%dir %{_libdir}/libdnf/plugins/
%{_libdir}/libdnf/plugins/README
%files devel
%doc %{_datadir}/gtk-doc/html/%{name}/
%{_libdir}/%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}/
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/%{name}/
%endif # with python2
%if %{with python3}
%files -n python3-%{name}
%{python3_sitearch}/%{name}/
%endif
%if %{with python2}
%files -n python2-hawkey
%{python2_sitearch}/hawkey/
%endif # with python2
%if %{with python3}
%files -n python3-hawkey
%{python3_sitearch}/hawkey/
%endif
%changelog
* Wed Oct 16 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.35.1-9
- Prevent reinstalling modified packages with same NEVRA (RhBug:1728252,1644241,1760825)
* Fri Sep 06 2019 Marek Blaha <mblaha@redhat.com> - 0.35.1-8
- Enhanced fix of moving directories in minimal container (RhBug:1700341)
* Thu Sep 05 2019 Jaroslav Mracek <jmracek@redhat.com> - 0.35.1-7
- Remove patch to not fail when installing modular RPMs without modular metadata
* Thu Sep 05 2019 Marek Blaha <mblaha@redhat.com> - 0.35.1-6
- Fix moving directories in minimal container (RhBug:1700341)
* Tue Aug 06 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.35.1-5
- Add suport for query sequence conversions
* Thu Aug 01 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.35.1-4
- Fix typo in error message (RhBug:1726661)
- Update localizations from zanata (RhBug:1689991)
- Don't disable nonexistent but required repositories (RhBug:1689331)
- Ignore trailing blank lines of multiline value (RhBug:1722493)
- Re-size includes map before re-computation (RhBug:1725213)
* Tue Jul 16 2019 Marek Blaha <mblaha@redhat.com> - 0.35.1-3
- Fix attaching and detaching of libsolvRepo and repo_internalize_trigger()
(RhBug:1730224)
* Thu Jul 04 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.35.1-2
- Add patch to not fail when installing modular RPMs without modular metadata
* Tue Jun 11 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.35.1-1
- Update to 0.35.1
- Skip invalid key files in "/etc/pki/rpm-gpg" with warning (RhBug:1644040)
- Enable timestamp preserving for downloaded data (RhBug:1688537)
- Fix 'database is locked' error (RhBug:1631533)
- Replace the 'Failed to synchronize cache' message (RhBug:1712055)
- Fix 'no such table: main.trans_cmdline' error (RhBug:1596540)
- Fix: skip_if_unavailable=true for local repositories (RhBug:1716313)
- Add support of modular FailSafe (RhBug:1623128)
- Add support of DNF main config file in context; used by PackageKit and
microdnf (RhBug:1689331)
- Exit gpg-agent after repokey import (RhBug:1650266)
* Mon May 13 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.33.0-1
- Update to 0.33.0
- Enhance sorting for module list (RhBug:1590358)
- [DnfRepo] Add methods for alternative repository metadata type and download (RhBug:1656314)
- Remove installed profile on module enable or disable (RhBug:1653623)
- Enhance modular solver to handle enabled and default module streams differently (RhBug:1648839)
- Add support of wild cards for modules (RhBug:1644588)
- Exclude module pkgs that have conflict
- Enhance config parser to preserve order of data, and keep comments and format
- Improve ARM detection
- Add support for SHA-384
- Return empty query if incorrect reldep (RhBug:1687135)
- ConfigParser: Improve compatibility with Python ConfigParser and dnf-plugin-spacewalk (RhBug:1692044)
- ConfigParser: Unify default set of string represenation of boolean values
- Fix segfault when interrupting dnf process (RhBug:1610456)
- Installroot now requires absolute path
- Support "_none_" value for repo option "proxy" (RhBug:1680272)
- Add support for Module advisories
- Add support for xml:base attribute from primary.xml (RhBug:1691315)
- Improve detection of Platform ID (RhBug:1688462)
* Fri Apr 26 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.22.5-6
- Rebuild for libsolv soname bump (in libsolve update to 0.7.4)
* Wed Apr 03 2019 Jaroslav Mracek <jmracek@redhat.com> - 0.22.5-5
- Backport patches to set default to skip_if_unavailable to false (RhBug:1692452)
* Tue Feb 12 2019 Jaroslav Mracek <jmracek@redhat.com> - 0.22.5-4
- Backport patch to exclude module pkgs that have conflict (RhBug:1670496)
* Fri Feb 08 2019 Jaroslav Mracek <jmracek@redhat.com> - 0.22.5-3
- Backport patches to add support for modular updateinfoxml applicability
* Wed Feb 06 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.22.5-2
- Add patch: Add best as default behavior (RhBug1670776)
* Mon Dec 17 2018 Daniel Mach <dmach@redhat.com> - 0.22.4-1
- Enhance LIBDNF plugins support
- [repo] Check whether metadata cache is expired (RhBug:1539620,1648274)
- [sack] Implement dnf_sack_get_rpmdb_version()
* Fri Nov 23 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.22.3-1
- Permanently disable Python2 build for Fedora 30+
- Update to 0.22.3
- Modify solver_describe_decision to report cleaned (RhBug:1486749)
- [swdb] create persistent WAL files (RhBug:1640235)
- Relocate ModuleContainer save hook (RhBug:1632518)
- [transaction] Fix transaction item lookup for obsoleted packages (RhBug: 1642796)
- Fix memory leaks and memory allocations
- [repo] Possibility to extend downloaded repository metadata
* Wed Oct 24 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.22.0-2
- Add patch Modify-solver_describe_decision-to-report-cleaned-RhBug1486749
- Add patch swdb-create-persistent-WAL-files-RhBug1640235
- Add patch Relocate-ModuleContainer-save-hook-RhBug1632518
- Add patch Test-if-sack-is-present-and-run-save-module-persistor-RhBug1632518
* Mon Oct 15 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.22.0-1
- Fix segfault in repo_internalize_trigger (RhBug:1375895)
- Change sorting of installonly packages (RhBug:1627685)
- [swdb] Fixed pattern searching in history db (RhBug:1635542)
- Check correctly gpg for repomd when refresh is used (RhBug:1636743)
- [conf] Provide additional VectorString methods for compatibility with Python list.
- [plugins] add plugin loading and hooks into libdnf
* Tue Sep 25 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.20.0-1
- [module] Report module solver errors
- [module] Enhance module commands and errors
- [transaction] Fixed several problems with SWDB
- Remove unneeded regex URL tests (RhBug:1598336)
- Allow quoted values in ini files (RhBug:1624056)
- Filter out not unique set of solver problems (RhBug:1564369)
- Resolves: rhbz#1614531 - dnf 3.2 does not depsolve correctly
- Resolves: rhbz#1614346 - dnf rollback doesn't work after install/downgrade/upgrade
- bug 1605274 - DNF crashes on * in installation repository URL
- Resolves: rhbz#1623383 - dnf.exceptions.ConfigError: Error parsing ...
* Mon Sep 10 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.19.1-1
- Fix compilation errors on gcc-4.8.5
- [module] Allow module queries on disabled modules (RhBug:1627081)
* Fri Sep 07 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.19.0-1
- [query] Reldeps can contain a space char (RhBug:1612462)
- [transaction] Avoid adding duplicates via Transaction::addItem()
- Fix compilation errors on gcc-4.8.5
- [module] Make available ModuleProfile using SWIG
- [module] Redesign module disable and reset
* Fri Aug 31 2018 Daniel Mach <dmach@redhat.com> - 0.18.0-1
- [repo] Implement GPG key import
- [repo] Introduce Repo class replacing dnf.repo.Repo
- [context] Fix memory corruption in dnf_context
- [rhsm] Fix: RHSM don't write .repo file with same content (RhBug:1600452)
- [module] Create /etc/dnf/modules.d if it doesn't exist.
- [module] Forward C++ exceptions to bindings.
* Thu Aug 16 2018 Daniel Mach <dmach@redhat.com> - 0.17.2-2
- [module] Create /etc/dnf/modules.d if it doesn't exist.
- [module] Forward C++ exceptions to bindings.
* Mon Aug 13 2018 Daniel Mach <dmach@redhat.com> - 0.17.2-1
- [sqlite3] Change db locking mode to DEFAULT.
- [doc] Add libsmartcols-devel to devel deps.
* Mon Aug 13 2018 Daniel Mach <dmach@redhat.com> - 0.17.1-1
- [module] Solve a problem in python constructor of NSVCAP if no version.
- [translations] Update translations from zanata.
- [transaction] Fix crash after using dnf.comps.CompsQuery and forking the process in Anaconda.
- [module] Support for resetting module state.
- [output] Introduce wrapper for smartcols.
* Tue Aug 07 2018 Daniel Mach <dmach@redhat.com> - 0.17.0-1
- [conf] Add module_platform_id option.
- [module] Add ModulePackageContainer class.
- [module] Add ModulePersistor class.
- [sack] Module filtering made available in python API
- [sack] Module auto-enabling according to installed packages
* Fri Jul 27 2018 Daniel Mach <dmach@redhat.com> - 0.16.1-1
- [module] Implement 'module_hotfixes' conf option to skip filtering RPMs from hotfix repos.
- [goal] Fix distupgrade filter, allow downgrades.
- [context] Allow to set module platform in context.
- [module] Introduce proper modular dependency solving.
- [module] Platform pseudo-module based on /etc/os-release.
- [goal] Add Goal::listSuggested().
- [l10n] Support for translations, add gettext build dependency.
* Sun Jul 22 2018 Daniel Mach <dmach@redhat.com> - 0.16.0-1
- Fix RHSM plugin
- Add support for logging
- Bump minimal libmodulemd version to 1.6.1
* Mon Jul 09 2018 Igor Gnatenko <ignatenko@redhat.com> - 0.15.2-2
- Fix librhsm support logic
* Fri Jun 29 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.15.2-1
- Update to 0.15.1
- Resolves: rhbz#1595487
* Fri Jun 29 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.15.1-2
- Restore proper ldconfig_scriptlets
* Tue Jun 26 2018 Jaroslav Mracek <jmracek@redhat.com> - 0.15.1-1
- Update to 0.15.1
* Fri Jun 15 2018 Miro Hrončok <mhroncok@redhat.com> - 0.11.1-6
- Rebuilt for Python 3.7
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.11.1-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Tue Jan 30 2018 Igor Gnatenko <ignatenko@redhat.com> - 0.11.1-4
- Switch to %%ldconfig_scriptlets
* Tue Nov 07 2017 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.11.1-3
- Use better Obsoletes for platform-python
* Fri Nov 03 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.11.1-2
- Remove platform-python subpackage
* Mon Oct 16 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.11.1-1
- Rerelease of 0.11.1-1
- Improvement query performance
- Run file query in hy_subject_get_best_solution only for files (arguments that start with ``/`` or
``*/``)
- Resolves: rhbz#1498207 - DNF crash during upgrade installation F26 -> F27
* Tue Oct 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.11.0-1
- Update to 0.11.0
* Mon Oct 02 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.10.1-2
- Rerelease of 0.10.1-1
* Wed Sep 27 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.10.1-1
- Update to 0.10.1
- It improves query performance with name and arch filters. Also nevra filter will now
handle string with or without epoch.
- Additionally for python bindings it renames NEVRA._has_just_name() to NEVRA.has_just_name() due
to movement of code into c part of library.
- Resolves: rhbz#1260242 - --exclude does not affect dnf remove's removal of requirements
- Resolves: rhbz#1485881 - DNF claims it cannot install package, which have been already installed
- Resolves: rhbz#1361187 - [abrt] python-ipython-console: filter_updown(): python3.5 killed by SIGABRT
* Fri Sep 15 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.3-8
- Disable platform python on old releases
* Tue Aug 15 2017 Lumír Balhar <lbalhar@redhat.com> - 0.9.3-7
- Add platform-python subpackage
* Fri Aug 11 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.3-6
- Rebuilt after RPM update (№ 3)
* Thu Aug 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.3-5
- Rebuilt for RPM soname bump
* Thu Aug 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.3-4
- Rebuilt for RPM soname bump
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Mon Jul 24 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.9.3-1
- Update to 0.9.3
* Sat Jul 01 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.9.2-1
- Update to 0.9.2
* Mon Jun 12 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.9.1-1
- Update to 0.9.1
* Mon May 22 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.9.0-1
- Update to 0.9.0
* Tue May 02 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.8.2-1
- Update to 0.8.2
* Fri Mar 24 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.8.1-1
- Update to 0.8.1
* Tue Mar 21 2017 Jaroslav Mracek <jmracek@redhat.com> - 0.8.0-1
- Update to 0.8.0
* Mon Feb 20 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7.4-1
- Update to 0.7.4
* Fri Feb 10 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7.3-1
- Update to 0.7.3
* Wed Feb 08 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7.2-1
- 0.7.2
* Fri Jan 06 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.7.1-1
- 0.7.1
* Wed Dec 21 2016 Peter Robinson <pbrobinson@fedoraproject.org> 0.7.0-0.7gitf9b798c
- Rebuild for Python 3.6
* Mon Dec 19 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.7.0-0.6gitf9b798c
- Use new upstream URL
* Tue Dec 13 2016 Stratakis Charalampos <cstratak@redhat.com> - 0.7.0-0.5gitf9b798c
- Rebuild for Python 3.6
* Tue Dec 06 2016 Martin Hatina <mhatina@redhat.com> - 0.7.0-0.4gitf9b798c
- Increase conflict version of dnf
* Thu Dec 01 2016 Igor Gnatenko <i.gnatenko.brain@gmail.com> - 0.7.0-0.3gitf9b798c
- Update to latest snapshot
* Fri Nov 04 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.7.0-0.2git8bd77f8
- Update to latest snapshot
* Thu Sep 29 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.7.0-0.1git179c0a6
- Initial package