!1 update to 0.37.2

Merge pull request !1 from Anonymous_Z/anonymous_z
This commit is contained in:
openeuler-ci-bot 2020-01-09 20:30:20 +08:00 committed by Gitee
commit 5c34efd73c
11 changed files with 100 additions and 520 deletions

View File

@ -1,40 +0,0 @@
From 83a0b5f289fd9461b68b1afab525c0f4ca6015b1 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Mon, 15 Oct 2018 21:27:15 +0200
Subject: [PATCH] Modify solver_describe_decision to report cleaned (RhBug:1486749)
---
libdnf/goal/Goal.cpp | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/libdnf/goal/Goal.cpp b/libdnf/goal/Goal.cpp
index 50fef5c..7d17a49 100644
--- a/libdnf/goal/Goal.cpp
+++ b/libdnf/goal/Goal.cpp
@@ -647,7 +647,8 @@ Goal::getReason(DnfPackage *pkg)
if (!pImpl->solv)
return HY_REASON_USER;
Id info;
- int reason = solver_describe_decision(pImpl->solv, dnf_package_get_id(pkg), &info);
+ const Id pkgID = dnf_package_get_id(pkg);
+ int reason = solver_describe_decision(pImpl->solv, pkgID, &info);
if ((reason == SOLVER_REASON_UNIT_RULE ||
reason == SOLVER_REASON_RESOLVE_JOB) &&
@@ -658,6 +659,13 @@ Goal::getReason(DnfPackage *pkg)
return HY_REASON_CLEAN;
if (reason == SOLVER_REASON_WEAKDEP)
return HY_REASON_WEAKDEP;
+ IdQueue cleanDepsQueue;
+ solver_get_cleandeps(pImpl->solv, cleanDepsQueue.getQueue());
+ for (int i = 0; i < cleanDepsQueue.size(); ++i) {
+ if (cleanDepsQueue[i] == pkgID) {
+ return HY_REASON_CLEAN;
+ }
+ }
return HY_REASON_DEP;
}
--
libgit2 0.26.6

View File

@ -1,25 +0,0 @@
From cc7776ba7e33770ad5744a67d32b03aaece992f8 Mon Sep 17 00:00:00 2001
From: Daniel Mach <dmach@redhat.com>
Date: Wed, 17 Oct 2018 12:12:18 +0200
Subject: [PATCH] [history] Fix crash in TransactionItem::addReplacedBy().
---
libdnf/transaction/TransactionItem.hpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libdnf/transaction/TransactionItem.hpp b/libdnf/transaction/TransactionItem.hpp
index dc4e2c8..72684f7 100644
--- a/libdnf/transaction/TransactionItem.hpp
+++ b/libdnf/transaction/TransactionItem.hpp
@@ -110,7 +110,7 @@ public:
// int64_t getTransactionId() const noexcept { return trans.getId(); }
const std::vector< TransactionItemPtr > &getReplacedBy() const noexcept { return replacedBy; }
- void addReplacedBy(TransactionItemPtr value) { replacedBy.push_back(value); }
+ void addReplacedBy(TransactionItemPtr value) { if (value) replacedBy.push_back(value); }
void save();
void saveReplacedBy();
--
libgit2 0.26.6

View File

@ -1,37 +0,0 @@
From dbe553c3846061f022dae906276b77a8430cce6a Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Thu, 18 Oct 2018 16:06:55 +0200
Subject: [PATCH] [swdb] create persistent WAL files (RhBug:1640235)
---
libdnf/utils/sqlite3/Sqlite3.cpp | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/libdnf/utils/sqlite3/Sqlite3.cpp b/libdnf/utils/sqlite3/Sqlite3.cpp
index 021b5d2..27fed56 100644
--- a/libdnf/utils/sqlite3/Sqlite3.cpp
+++ b/libdnf/utils/sqlite3/Sqlite3.cpp
@@ -30,9 +30,17 @@ SQLite3::open()
sqlite3_close(db);
throw LibException(result, "Open failed");
}
- // sqlite doesn't behave correctly in chroots without following line:
- // turn foreign key checking on
- exec("PRAGMA locking_mode = NORMAL; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;");
+#if SQLITE_VERSION_NUMBER >= 3022000
+ int enabled = 1;
+ sqlite3_file_control(db, "main", SQLITE_FCNTL_PERSIST_WAL, &enabled);
+ if (sqlite3_db_readonly(db, "main") == 1)
+ exec("PRAGMA locking_mode = NORMAL; PRAGMA foreign_keys = ON;");
+ else
+ exec("PRAGMA locking_mode = NORMAL; PRAGMA journal_mode = WAL; PRAGMA foreign_keys = ON;");
+#else
+ // Journal mode WAL in readonly mode is supported from sqlite version 3.22.0
+ exec("PRAGMA locking_mode = NORMAL; PRAGMA journal_mode = TRUNCATE; PRAGMA foreign_keys = ON;");
+#endif
sqlite3_busy_timeout(db, 10000);
}
}
--
libgit2 0.26.7

View File

@ -1,58 +0,0 @@
From 744a95e49b6f29aa65bc5b28e0e821c38c481581 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Fri, 19 Oct 2018 15:44:39 +0200
Subject: [PATCH] Relocate ModuleContainer save hook (RhBug:1632518)
---
libdnf/dnf-context.cpp | 5 +----
libdnf/dnf-transaction.cpp | 5 +++++
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 141af3a..db1741c 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -1879,10 +1879,7 @@ dnf_context_run(DnfContext *context, GCancellable *cancellable, GError **error)
error);
if (!ret)
return FALSE;
- auto moduleContainer = dnf_sack_get_module_container(priv->sack);
- if (moduleContainer) {
- moduleContainer->save();
- }
+
/* this sack is no longer valid */
g_object_unref(priv->sack);
priv->sack = NULL;
diff --git a/libdnf/dnf-transaction.cpp b/libdnf/dnf-transaction.cpp
index 5c078a0..0d948d7 100644
--- a/libdnf/dnf-transaction.cpp
+++ b/libdnf/dnf-transaction.cpp
@@ -38,12 +38,14 @@
#include "dnf-package.h"
#include "dnf-rpmts.h"
#include "dnf-sack.h"
+#include "dnf-sack-private.hpp"
#include "dnf-transaction.h"
#include "dnf-types.h"
#include "dnf-utils.h"
#include "hy-query.h"
#include "hy-util-private.hpp"
+#include "module/ModulePackageContainer.hpp"
#include "transaction/Swdb.hpp"
#include "transaction/Transformer.hpp"
#include "utils/bgettext/bgettext-lib.h"
@@ -1435,6 +1437,9 @@ dnf_transaction_commit(DnfTransaction *transaction, HyGoal goal, DnfState *state
goto out;
}
+ if (auto moduleContainer = dnf_sack_get_module_container(dnf_context_get_sack(priv->context)))
+ moduleContainer->save();
+
/* all sacks are invalid now */
dnf_context_invalidate_full(priv->context,
"transaction performed",
--
libgit2 0.26.7

View File

@ -1,30 +0,0 @@
From 1e7118d01d9ba92f759cd9669f9d0dd5af0619d6 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Sat, 20 Oct 2018 01:13:49 +0200
Subject: [PATCH] Test if sack is present and run save module persistor (RhBug:1632518)
---
libdnf/dnf-transaction.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libdnf/dnf-transaction.cpp b/libdnf/dnf-transaction.cpp
index 0d948d7..b89eace 100644
--- a/libdnf/dnf-transaction.cpp
+++ b/libdnf/dnf-transaction.cpp
@@ -1437,8 +1437,11 @@ dnf_transaction_commit(DnfTransaction *transaction, HyGoal goal, DnfState *state
goto out;
}
- if (auto moduleContainer = dnf_sack_get_module_container(dnf_context_get_sack(priv->context)))
- moduleContainer->save();
+ if (DnfSack * sack = hy_goal_get_sack(goal)) {
+ if (auto moduleContainer = dnf_sack_get_module_container(sack)) {
+ moduleContainer->save();
+ }
+ }
/* all sacks are invalid now */
dnf_context_invalidate_full(priv->context,
--
libgit2 0.26.7

View File

@ -1,69 +0,0 @@
From 19d44b7ddf8266aabc04b18a0a6eb4716d08f9d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Wed, 27 Mar 2019 15:08:59 +0100
Subject: [PATCH 2/3] Add a debug argument to Librepolog::addHandler
When set to false (default), only logs messages from INFO up, when true,
logs all messages, including DEBUG.
The argument having a default means the change is compatible with older
consumers of the API, but the bahaviour will be changed, the debug
messages will not be logged anymore.
https://bugzilla.redhat.com/show_bug.cgi?id=1580022
https://bugzilla.redhat.com/show_bug.cgi?id=1678598
https://bugzilla.redhat.com/show_bug.cgi?id=1355764
https://bugzilla.redhat.com/show_bug.cgi?id=1695720
backport from:
https://github.com/rpm-software-management/libdnf/pull/707/commits/daa9d69f98c96de54966905e80c4caa95f50d587
---
libdnf/repo/Repo.cpp | 11 +++++++++--
libdnf/repo/Repo.hpp | 2 +-
2 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp
index 2844bfe..2c28541 100644
--- a/libdnf/repo/Repo.cpp
+++ b/libdnf/repo/Repo.cpp
@@ -1740,7 +1740,7 @@ static void librepoLogCB(G_GNUC_UNUSED const gchar *log_domain, GLogLevelFlags l
}
}
-long LibrepoLog::addHandler(const std::string & filePath)
+long LibrepoLog::addHandler(const std::string & filePath, bool debug)
{
static long uid = 0;
@@ -1755,7 +1755,14 @@ long LibrepoLog::addHandler(const std::string & filePath)
data->fd = fd;
// Set handler
- data->handlerId = g_log_set_handler(LR_LOGDOMAIN, G_LOG_LEVEL_MASK, librepoLogCB, data.get());
+ GLogLevelFlags log_mask = debug ? G_LOG_LEVEL_MASK : static_cast<GLogLevelFlags>(
+ G_LOG_LEVEL_INFO |
+ G_LOG_LEVEL_MESSAGE |
+ G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_ERROR);
+
+ data->handlerId = g_log_set_handler(LR_LOGDOMAIN, log_mask, librepoLogCB, data.get());
data->used = true;
// Save user data (in a thread safe way)
diff --git a/libdnf/repo/Repo.hpp b/libdnf/repo/Repo.hpp
index 06e94f6..d5bef20 100644
--- a/libdnf/repo/Repo.hpp
+++ b/libdnf/repo/Repo.hpp
@@ -296,7 +296,7 @@ private:
struct LibrepoLog {
public:
- static long addHandler(const std::string & filePath);
+ static long addHandler(const std::string & filePath, bool debug = false);
static void removeHandler(long uid);
static void removeAllHandlers();
};
--
2.19.1

View File

@ -1,106 +0,0 @@
From 76e0943e4f2b72c11cdf4ac2001d647abae0617f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Thu, 18 Apr 2019 13:41:04 +0200
Subject: [PATCH 3/3] Add a logdebug argument to hawkey.Sack()
When set to false (default), only logs messages from INFO up, when true,
logs all messages, including DEBUG.
The fact that its a keyword argument means the change is compatible with
older consumers of the API, but the bahaviour will be changed, the debug
messages will not be logged anymore.
https://bugzilla.redhat.com/show_bug.cgi?id=1355764
https://bugzilla.redhat.com/show_bug.cgi?id=1695720
backport from:
https://github.com/rpm-software-management/libdnf/pull/707/commits/6c52bd330b37e07a3a708cee29c0d0772a161053
---
python/hawkey/sack-py.cpp | 29 +++++++++++++++++++++--------
python/hawkey/sack-py.hpp | 2 +-
2 files changed, 22 insertions(+), 9 deletions(-)
diff --git a/python/hawkey/sack-py.cpp b/python/hawkey/sack-py.cpp
index a7ccb37..58b0f19 100644
--- a/python/hawkey/sack-py.cpp
+++ b/python/hawkey/sack-py.cpp
@@ -183,7 +183,7 @@ log_handler_noop(const gchar *, GLogLevelFlags, const gchar *, gpointer)
}
gboolean
-set_logfile(const gchar *path, FILE *log_out)
+set_logfile(const gchar *path, FILE *log_out, bool debug)
{
log_out = fopen(path, "a");
@@ -194,9 +194,16 @@ set_logfile(const gchar *path, FILE *log_out)
// other logger to stderr/stdout, we do not want that
g_log_set_default_handler(log_handler_noop, nullptr);
+ GLogLevelFlags log_mask = debug ? G_LOG_LEVEL_MASK : static_cast<GLogLevelFlags>(
+ G_LOG_LEVEL_INFO |
+ G_LOG_LEVEL_MESSAGE |
+ G_LOG_LEVEL_WARNING |
+ G_LOG_LEVEL_CRITICAL |
+ G_LOG_LEVEL_ERROR);
+
// set the handler for the default domain as well as "libdnf"
- g_log_set_handler(nullptr, G_LOG_LEVEL_MASK, log_handler, log_out);
- g_log_set_handler("libdnf", G_LOG_LEVEL_MASK, log_handler, log_out);
+ g_log_set_handler(nullptr, log_mask, log_handler, log_out);
+ g_log_set_handler("libdnf", log_mask, log_handler, log_out);
g_info("=== Started libdnf-%d.%d.%d ===", LIBDNF_MAJOR_VERSION,
LIBDNF_MINOR_VERSION, LIBDNF_MICRO_VERSION);
@@ -216,16 +223,22 @@ sack_init(_SackObject *self, PyObject *args, PyObject *kwds)
PyObject *logfile_py = NULL;
self->log_out = NULL;
int make_cache_dir = 0;
+ PyObject *debug_object = nullptr;
gboolean all_arch = FALSE;
const char *kwlist[] = {"cachedir", "arch", "rootdir", "pkgcls",
- "pkginitval", "make_cache_dir", "logfile", "all_arch",
- NULL};
+ "pkginitval", "make_cache_dir", "logfile", "logdebug",
+ "all_arch", NULL};
- if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OssOOiOi", (char**) kwlist,
+ if (!PyArg_ParseTupleAndKeywords(args, kwds, "|OssOOiOO!i", (char**) kwlist,
&cachedir_py, &arch, &rootdir,
&custom_class, &custom_val,
- &make_cache_dir, &logfile_py, &all_arch))
+ &make_cache_dir, &logfile_py,
+ &PyBool_Type, &debug_object,
+ &all_arch))
return -1;
+
+ bool debug = debug_object != nullptr && PyObject_IsTrue(debug_object);
+
if (cachedir_py != NULL) {
cachedir = PycompString(cachedir_py);
if (!cachedir.getCString())
@@ -249,7 +262,7 @@ sack_init(_SackObject *self, PyObject *args, PyObject *kwds)
PycompString logfile(logfile_py);
if (!logfile.getCString())
return -1;
- if (!set_logfile(logfile.getCString(), self->log_out)) {
+ if (!set_logfile(logfile.getCString(), self->log_out, debug)) {
PyErr_Format(PyExc_IOError, "Failed to open log file: %s", logfile.getCString());
return -1;
}
diff --git a/python/hawkey/sack-py.hpp b/python/hawkey/sack-py.hpp
index cba8acc..50289d7 100644
--- a/python/hawkey/sack-py.hpp
+++ b/python/hawkey/sack-py.hpp
@@ -35,7 +35,7 @@ DnfSack *sackFromPyObject(PyObject *o);
int sack_converter(PyObject *o, DnfSack **sack_ptr);
PyObject *new_package(PyObject *sack, Id id);
-gboolean set_logfile(const gchar *path, FILE *log_out);
+gboolean set_logfile(const gchar *path, FILE *log_out, bool debug = false);
const char *log_level_name(int level);
#endif // SACK_PY_H
--
2.19.1

View File

@ -1,74 +0,0 @@
From b91a898bcfbe2743fb1b5fd524eef077271187e3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hr=C3=A1zk=C3=BD?= <lhrazky@redhat.com>
Date: Wed, 17 Apr 2019 13:48:26 +0200
Subject: [PATCH 1/3] Set relevant g_log domain handlers instead of a default
one
Sets up logging for the default domain as well as "libdnf" domain
instead of setting a default logging handler. The default handler is a
catch-all for messages with a (domain, level) combination that doesn't
get handled by any other handler.
We certainly don't want to be logging (domain, level) combinations that
we explicitly turned off. The glib's g_log_default_handler() doesn't
print DEBUG and INFO level messages, but ours did, effectively
redirecting anything (using glib logging) that was turned off elsewhere
to hawkey.log.
This commit sets the default log handler to a noop function to prevent
any unhandled messages to be logged here. This in theory should have no
effect if we don't turn off log levels from MESSAGE above (and we don't
have unhandled log domains), but if we ever do that, supposedly it is to
further minimize the logging and thus disabling logging of such messages
is the desired behaviour.
The logging of all libdnf code has the "libdnf" log domain and we also
set the same handler for the default domain (nullptr) just in case we
have some code somewhere using g_log and not having a domain set.
https://bugzilla.redhat.com/show_bug.cgi?id=1580022
https://bugzilla.redhat.com/show_bug.cgi?id=1678598
https://bugzilla.redhat.com/show_bug.cgi?id=1355764
https://bugzilla.redhat.com/show_bug.cgi?id=1695720
backport from:
https://github.com/rpm-software-management/libdnf/pull/707/commits/609d60f2a23182ba329a1d157f7263c13d4a379a
---
python/hawkey/sack-py.cpp | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/python/hawkey/sack-py.cpp b/python/hawkey/sack-py.cpp
index 95764fd..a7ccb37 100644
--- a/python/hawkey/sack-py.cpp
+++ b/python/hawkey/sack-py.cpp
@@ -177,6 +177,11 @@ log_handler(const gchar *log_domain, GLogLevelFlags log_level, const gchar *mess
g_free(msg);
}
+static void
+log_handler_noop(const gchar *, GLogLevelFlags, const gchar *, gpointer)
+{
+}
+
gboolean
set_logfile(const gchar *path, FILE *log_out)
{
@@ -185,7 +190,14 @@ set_logfile(const gchar *path, FILE *log_out)
if (!log_out)
return FALSE;
- g_log_set_default_handler(log_handler, log_out);
+ // The default log handler prints messages that weren't handled by any
+ // other logger to stderr/stdout, we do not want that
+ g_log_set_default_handler(log_handler_noop, nullptr);
+
+ // set the handler for the default domain as well as "libdnf"
+ g_log_set_handler(nullptr, G_LOG_LEVEL_MASK, log_handler, log_out);
+ g_log_set_handler("libdnf", G_LOG_LEVEL_MASK, log_handler, log_out);
+
g_info("=== Started libdnf-%d.%d.%d ===", LIBDNF_MAJOR_VERSION,
LIBDNF_MINOR_VERSION, LIBDNF_MICRO_VERSION);
return TRUE;
--
2.19.1

Binary file not shown.

BIN
libdnf-0.37.2.tar.gz Normal file

Binary file not shown.

View File

@ -1,136 +1,154 @@
%global libsolv_version 0.6.30-1
%global libsolv_version 0.7.7
%global libmodulemd_version 1.6.1
%global dnf_conflict 3.7.1
%global librepo_version 1.11.0
%global dnf_conflict 4.2.13
%global swig_version 3.0.12
%global requires_python2_sphinx python2-sphinx
%global requires_python3_sphinx python3-sphinx
%bcond_with valgrind
%bcond_without python3
%bcond_without python2
%bcond_with python2
%bcond_with rhsm
%bcond_with zchunk
%global _cmake_opts \\\
-DENABLE_RHSM_SUPPORT=%{?with_rhsm:ON}%{!?with_rhsm:OFF} \\\
%{nil}
Name: libdnf
Version: 0.22.0
Release: 9
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
Patch0001: 0001-Modify-solver_describe_decision-to-report-cleaned-RhBug1486749.patch
Patch0002: 0002-history-Fix-crash-in-TransactionItemaddReplacedBy.patch
Patch0003: 0003-swdb-create-persistent-WAL-files-RhBug1640235.patch
Patch0004: 0004-Relocate-ModuleContainer-save-hook-RhBug1632518.patch
Patch0005: 0005-Test-if-sack-is-present-and-run-save-module-persistor-RhBug1632518.patch
Name: libdnf
Version: 0.37.2
Release: 2
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
BuildRequires: cmake gcc gcc-c++ libsolv-devel >= %{libsolv_version} gettext
BuildRequires: pkgconfig(librepo) >= %{librepo_version} pkgconfig(check)
BuildRequires: pkgconfig(gio-unix-2.0) >= 2.46.0 pkgconfig(gtk-doc) gpgme-devel
BuildRequires: rpm-devel >= 4.11.0 pkgconfig(sqlite3) pkgconfig(smartcols)
BuildRequires: pkgconfig(json-c) pkgconfig(cppunit) pkgconfig(libcrypto)
BuildRequires: pkgconfig(modulemd) >= %{libmodulemd_version}
Patch6000: Set-relevant-g_log-domain-handlers-instead-of-a-defa.patch
Patch6001: Add-a-debug-argument-to-Librepolog-addHandler.patch
Patch6002: Add-a-logdebug-argument-to-hawkey.Sack.patch
Requires: libmodulemd >= %{libmodulemd_version}
Requires: libsolv >= %{libsolv_version}
Requires: librepo >= %{librepo_version}
BuildRequires: cmake gcc gcc-c++ libsolv-devel >= %{libsolv_version} pkgconfig(librepo) pkgconfig(check)
BuildRequires: pkgconfig(gio-unix-2.0) >= 2.46.0 pkgconfig(gtk-doc) pkgconfig(sqlite3) pkgconfig(json-c)
BuildRequires: rpm-devel >= 4.11.0 pkgconfig(cppunit) pkgconfig(smartcols)
BuildRequires: pkgconfig(modulemd) >= %{libmodulemd_version} gettext gpgme-devel
Requires: libmodulemd%{?_isa} >= %{libmodulemd_version}
Requires: libsolv%{?_isa} >= %{libsolv_version}
%if %{without python2}
Obsoletes: python2-%{name} < %{version}-%{release}
Obsoletes: python2-hawkey < %{version}-%{release}
Obsoletes: python2-hawkey-debuginfo < %{version}-%{release}
Obsoletes: python2-libdnf-debuginfo < %{version}-%{release}
%endif
%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}
%package devel
Summary: Development files for %{name}
Requires: %{name} = %{version}-%{release}
Requires: libsolv-devel >= %{libsolv_version}
%description devel
Development files for %{name}.
%if %{with python2}
%package -n python2-libdnf
%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 swig >= %{swig_version}
Summary: Python 2 bindings for the libdnf library.
Requires: %{name} = %{version}-%{release}
BuildRequires: python2-devel swig >= %{swig_version}
%if !0%{?mageia}
BuildRequires: %{requires_python2_sphinx}
%endif
%description -n python2-libdnf
%description -n python2-%{name}
Python 2 bindings for the libdnf library.
%endif
%package -n python3-libdnf
%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 swig >= %{swig_version}
Summary: Python 3 bindings for the libdnf library.
Requires: %{name} = %{version}-%{release}
BuildRequires: python3-devel %{requires_python3_sphinx} swig >= %{swig_version}
%description -n python3-libdnf
%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
%package -n python2-hawkey
Summary: Python 2 bindings for the hawkey library
%{?python_provide:%python_provide python2-hawkey}
BuildRequires: python2-devel python2-nose
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python2-%{name} = %{version}-%{release}
Conflicts: python2-dnf < %{dnf_conflict}
Conflicts: python-dnf < %{dnf_conflict}
BuildRequires: python2-devel python2-nose
Requires: %{name} = %{version}-%{release}
Requires: python2-%{name} = %{version}-%{release}
Conflicts: python2-dnf < %{dnf_conflict}
Conflicts: python-dnf < %{dnf_conflict}
%description -n python2-hawkey
Python 2 bindings for the hawkey library.
%endif
%package -n python3-hawkey
Summary: Python 3 bindings for the hawkey library
%if %{with python3}
%package -n python3-hawkey
Summary: Python 3 bindings for the hawkey library
%{?python_provide:%python_provide python3-hawkey}
BuildRequires: python3-devel python3-nose
Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: python3-%{name} = %{version}-%{release}
Conflicts: python3-dnf < %{dnf_conflict}
Obsoletes: platform-python-hawkey < %{version}-%{release}
BuildRequires: python3-devel python3-nose
Requires: %{name} = %{version}-%{release}
Requires: python3-%{name} = %{version}-%{release}
Conflicts: python3-dnf < %{dnf_conflict}
Obsoletes: platform-python-hawkey < %{version}-%{release}
%description -n python3-hawkey
Python 3 bindings for the hawkey library.
%endif
%prep
%autosetup -p1
%autosetup
%if %{with python2}
mkdir build-py2
%endif
%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}
%cmake -DPYTHON_DESIRED:FILEPATH=%{__python2} -DWITH_MAN=OFF ../ %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?with_valgrind:-DDISABLE_VALGRIND=1} %{_cmake_opts}
%make_build
popd
%endif
%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}
%cmake -DPYTHON_DESIRED:FILEPATH=%{__python3} -DWITH_GIR=0 -DWITH_MAN=0 -Dgtkdoc=0 ../ %{!?with_zchunk:-DWITH_ZCHUNK=OFF} %{!?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
%if %{with python3}
%if %{without python2}
pushd build-py3
make ARGS="-V" test
popd
%else
pushd build-py3/python/hawkey/tests
make ARGS="-V" test
popd
%endif
%endif
%install
%if %{with python2}
@ -138,21 +156,27 @@ pushd build-py2
%make_install
popd
%endif
%if %{with python3}
pushd build-py3
%make_install
popd
%endif
%find_lang %{name}
%ldconfig_scriptlets
%files -f %{name}.lang
%license COPYING AUTHORS
%doc README.md
%doc %{_datadir}/gtk-doc/html/%{name}/
%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}/
@ -160,28 +184,23 @@ popd
%if %{with python2}
%files -n python2-%{name}
%{python2_sitearch}/%{name}/
%endif
%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
%endif # with python2
%if %{with python3}
%files -n python3-hawkey
%{python3_sitearch}/hawkey/
%endif
%changelog
* Sat Dec 21 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.22.0-9
- Not log DEBUG messages by default (RhBug:1355764)
* Sat Nov 9 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.22.0-8
- Type:bugfix
- Id:NA
- SUG:NA
- DESC:add the release
* Wed Sep 18 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.22.0-7
- Package init
* Tue Jan 7 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.37.2-2
- Package init.