Auto sync2gitlab import of libdnf-0.63.0-10.el8.src.rpm

This commit is contained in:
CentOS Sources 2022-06-18 09:25:23 +00:00
parent 587b55460c
commit ec8b0315d2
6 changed files with 371 additions and 1 deletions

View File

@ -0,0 +1,45 @@
From c4ee580c73375060b6eb5b3414636688e3d601c3 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Fri, 10 Jun 2022 15:29:56 +0200
Subject: [PATCH] Do not print errors on failovermethod repo option
(RhBug:2039906)
= changelog =
msg: Do not print errors if repository config contains failovermethod option
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2039906
---
libdnf/conf/ConfigRepo.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/libdnf/conf/ConfigRepo.cpp b/libdnf/conf/ConfigRepo.cpp
index e98ac0af..0cb52f58 100644
--- a/libdnf/conf/ConfigRepo.cpp
+++ b/libdnf/conf/ConfigRepo.cpp
@@ -22,6 +22,8 @@
#include "Const.hpp"
#include "Config-private.hpp"
+#include "bgettext/bgettext-lib.h"
+
namespace libdnf {
class ConfigRepo::Impl {
@@ -174,6 +176,14 @@ ConfigRepo::Impl::Impl(Config & owner, ConfigMain & mainConfig)
owner.optBinds().add("enabled_metadata", enabled_metadata);
owner.optBinds().add("user_agent", user_agent);
owner.optBinds().add("countme", countme);
+ owner.optBinds().add("failovermethod", failovermethod,
+ [&](Option::Priority priority, const std::string & value){
+ if (value != "priority") {
+ throw Option::InvalidValue(_("only the value 'priority' is supported."));
+ }
+ failovermethod.set(priority, value);
+ }, nullptr, false
+ );
owner.optBinds().add("sslverifystatus", sslverifystatus);
}
--
2.36.1

View File

@ -0,0 +1,24 @@
From 9dbd5f8f0ac3d6d3fab9147a3208623cba698682 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: Tue, 14 Jun 2022 17:26:44 +0200
Subject: [PATCH] sack/query.hpp: Add a missing include
---
libdnf/sack/query.hpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/libdnf/sack/query.hpp b/libdnf/sack/query.hpp
index 9e49761c..306b24e3 100644
--- a/libdnf/sack/query.hpp
+++ b/libdnf/sack/query.hpp
@@ -26,6 +26,7 @@
#include "../hy-types.h"
#include "../hy-query.h"
#include "../hy-subject.h"
+#include "../nevra.hpp"
#include "../repo/solvable/Dependency.hpp"
#include "../repo/solvable/DependencyContainer.hpp"
#include "../transaction/Swdb.hpp"
--
2.36.1

View File

@ -0,0 +1,128 @@
From 876393d5d0cd5f806415dcdc90168e58e66da916 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Mon, 28 Mar 2022 07:29:48 +0200
Subject: [PATCH] context: dnf_context_remove accepts `<package-spec>` as dnf,
unify code
Prior to change, the `dnf_context_remove` function only accepted
the package name (without globs). It was not possible to enter more detailed
specifications and thus, for example, select a specific version of the package
to uninstall - for example, which kernel we want to uninstall.
This patch adds full `<package-spec>` support as in dnf, including support
for globs (wildcards) and searching against 'provides' and 'file provides'.
Better error handling for `hy_goal_upgrade_selector` in` dnf_context_update`.
Unification of the function code `dnf_context_install`, `dnf_context_remove`,
`dnf_context_update`.
= changelog =
msg: context: Support <package-spec> (NEVRA forms, provides, file provides) including globs in the dnf_context_remove func
type: enhancement
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2084602
---
libdnf/dnf-context.cpp | 46 ++++++++++++++++++++++++------------------
1 file changed, 26 insertions(+), 20 deletions(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 6cb0011b..4b055f03 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -2391,10 +2391,9 @@ dnf_context_run(DnfContext *context, GCancellable *cancellable, GError **error)
* Since: 0.1.0
**/
gboolean
-dnf_context_install (DnfContext *context, const gchar *name, GError **error) try
+dnf_context_install(DnfContext *context, const gchar *name, GError **error) try
{
DnfContextPrivate *priv = GET_PRIVATE (context);
- g_autoptr(GPtrArray) selector_matches = NULL;
/* create sack and add sources */
if (priv->sack == NULL) {
@@ -2405,7 +2404,7 @@ dnf_context_install (DnfContext *context, const gchar *name, GError **error) try
g_auto(HySubject) subject = hy_subject_create(name);
g_auto(HySelector) selector = hy_subject_get_best_selector(subject, priv->sack, NULL, FALSE, NULL);
- selector_matches = hy_selector_matches(selector);
+ g_autoptr(GPtrArray) selector_matches = hy_selector_matches(selector);
if (selector_matches->len == 0) {
g_set_error(error,
DNF_ERROR,
@@ -2438,31 +2437,33 @@ gboolean
dnf_context_remove(DnfContext *context, const gchar *name, GError **error) try
{
DnfContextPrivate *priv = GET_PRIVATE(context);
- GPtrArray *pkglist;
- hy_autoquery HyQuery query = NULL;
- gboolean ret = TRUE;
- guint i;
/* create sack and add repos */
if (priv->sack == NULL) {
dnf_state_reset(priv->state);
- ret = dnf_context_setup_sack(context, priv->state, error);
- if (!ret)
+ if (!dnf_context_setup_sack(context, priv->state, error))
return FALSE;
}
- /* find installed packages to remove */
- query = hy_query_create(priv->sack);
- query->installed();
- hy_query_filter(query, HY_PKG_NAME, HY_EQ, name);
- pkglist = hy_query_run(query);
+ libdnf::Query query(priv->sack, libdnf::Query::ExcludeFlags::APPLY_EXCLUDES);
+ query.installed();
+ auto ret = query.filterSubject(name, nullptr, false, true, true, true);
+ if (!ret.first) {
+ g_set_error(error,
+ DNF_ERROR,
+ DNF_ERROR_PACKAGE_NOT_FOUND,
+ "No installed package matches '%s'", name);
+ return FALSE;
+ }
+
+ g_autoptr(GPtrArray) packages = query.run();
/* add each package */
- for (i = 0; i < pkglist->len; i++) {
- auto pkg = static_cast<DnfPackage *>(g_ptr_array_index(pkglist, i));
+ for (guint i = 0; i < packages->len; i++) {
+ auto pkg = static_cast<DnfPackage *>(g_ptr_array_index(packages, i));
hy_goal_erase(priv->goal, pkg);
}
- g_ptr_array_unref(pkglist);
+
return TRUE;
} CATCH_TO_GERROR(FALSE)
@@ -2493,8 +2494,7 @@ dnf_context_update(DnfContext *context, const gchar *name, GError **error) try
}
g_auto(HySubject) subject = hy_subject_create(name);
- g_auto(HySelector) selector = hy_subject_get_best_selector(subject, priv->sack, NULL, FALSE,
- NULL);
+ g_auto(HySelector) selector = hy_subject_get_best_selector(subject, priv->sack, NULL, FALSE, NULL);
g_autoptr(GPtrArray) selector_matches = hy_selector_matches(selector);
if (selector_matches->len == 0) {
g_set_error(error,
@@ -2504,8 +2504,14 @@ dnf_context_update(DnfContext *context, const gchar *name, GError **error) try
return FALSE;
}
- if (hy_goal_upgrade_selector(priv->goal, selector))
+ int ret = hy_goal_upgrade_selector(priv->goal, selector);
+ if (ret != 0) {
+ g_set_error(error,
+ DNF_ERROR,
+ ret,
+ "Ill-formed Selector '%s'", name);
return FALSE;
+ }
return TRUE;
} CATCH_TO_GERROR(FALSE)
--
2.36.1

View File

@ -0,0 +1,62 @@
From 44d75a36d7c8a933119e5b63f180a8c23715ec51 Mon Sep 17 00:00:00 2001
From: Jaroslav Rohel <jrohel@redhat.com>
Date: Mon, 28 Mar 2022 07:51:45 +0200
Subject: [PATCH] context: Fix doc dnf_context_install/remove/update/distrosync
Functions do not support groups - only packages are supported.
The `dnf_context_remove` function marks all matching packages for removal
- not just the oldest one.
---
libdnf/dnf-context.cpp | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libdnf/dnf-context.cpp b/libdnf/dnf-context.cpp
index 4b055f03..fe005430 100644
--- a/libdnf/dnf-context.cpp
+++ b/libdnf/dnf-context.cpp
@@ -2379,7 +2379,7 @@ dnf_context_run(DnfContext *context, GCancellable *cancellable, GError **error)
/**
* dnf_context_install:
* @context: a #DnfContext instance.
- * @name: A package or group name, e.g. "firefox" or "@gnome-desktop"
+ * @name: A package specification (NEVRA forms, provide, file provide, globs supported) e.g. "firefox"
* @error: A #GError or %NULL
*
* Finds a remote package and marks it to be installed.
@@ -2422,12 +2422,12 @@ dnf_context_install(DnfContext *context, const gchar *name, GError **error) try
/**
* dnf_context_remove:
* @context: a #DnfContext instance.
- * @name: A package or group name, e.g. "firefox" or "@gnome-desktop"
+ * @name: A package specification (NEVRA forms, provide, file provide, globs supported) e.g. "firefox"
* @error: A #GError or %NULL
*
* Finds an installed package and marks it to be removed.
*
- * If multiple packages are available then only the oldest package is removed.
+ * If multiple packages are available, all of them will be removed.
*
* Returns: %TRUE for success, %FALSE otherwise
*
@@ -2470,7 +2470,7 @@ dnf_context_remove(DnfContext *context, const gchar *name, GError **error) try
/**
* dnf_context_update:
* @context: a #DnfContext instance.
- * @name: A package or group name, e.g. "firefox" or "@gnome-desktop"
+ * @name: A package specification (NEVRA forms, provide, file provide, globs supported) e.g. "firefox"
* @error: A #GError or %NULL
*
* Finds an installed and remote package and marks it to be updated.
@@ -2548,7 +2548,7 @@ dnf_context_update_all (DnfContext *context,
/**
* dnf_context_distrosync:
* @context: a #DnfContext instance.
- * @name: A package or group name, e.g. "firefox" or "@gnome-desktop"
+ * @name: A package specification (NEVRA forms, provide, file provide, globs supported) e.g. "firefox"
* @error: A #GError or %NULL
*
* Finds an installed and remote package and marks it to be synchronized with remote version.
--
2.36.1

View File

@ -0,0 +1,100 @@
From cf4893a0128c567ed1fdd1b02c9cf2b43bfb02f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Mon, 30 May 2022 08:59:41 +0200
Subject: [PATCH] advisory upgrade: filter out advPkgs with different arch
This prevents a situation in security upgrades where libsolv cannot
upgrade dependent pkgs because we ask for an upgrade of different arch:
We can get the following testcase if libdnf has filtered out
json-c-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms
(because there is an advisory for already installed json-c-1-1.el8.x86_64) but
json-c-2-2.el8.i686@rhel-8-for-x86_64-baseos-rpms is not filtered out because
it has different architecture. The resulting transaction doesn't work.
```
repo @System -99.-1000 testtags <inline>
#>=Pkg: bind-libs-lite 1 1.el8 x86_64
#>=Pkg: json-c 1 1.el8 x86_64
repo rhel-8-for-x86_64-baseos-rpms -99.-1000 testtags <inline>
#>=Pkg: json-c 2 2.el8 x86_64
#>=Prv: libjson-c.so.4()(64bit)
#>
#>=Pkg: json-c 2 2.el8 i686
#>=Prv: libjson-c.so.4()
#>
#>=Pkg: bind-libs-lite 2 2.el8 x86_64
#>=Req: libjson-c.so.4()(64bit)
system x86_64 rpm @System
job update oneof json-c-1-1.el8.x86_64@@System json-c-2-2.el8.i686@rhel-8-for-x86_64-baseos-rpms bind-libs-lite-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms [forcebest,targeted,setevr,setarch]
result transaction,problems <inline>
#>problem f06d81a4 info package bind-libs-lite-2-2.el8.x86_64 requires libjson-c.so.4()(64bit), but none of the providers can be installed
#>problem f06d81a4 solution 96f9031b allow bind-libs-lite-1-1.el8.x86_64@@System
#>problem f06d81a4 solution c8daf94f allow json-c-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms
#>upgrade bind-libs-lite-1-1.el8.x86_64@@System bind-libs-lite-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms
#>upgrade json-c-1-1.el8.x86_64@@System json-c-2-2.el8.x86_64@rhel-8-for-x86_64-baseos-rpms```
```
= changelog =
msg: Filter out advisory pkgs with different arch during advisory upgrade, fixes possible problems in dependency resulution.
type: bugfix
resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2088149
---
libdnf/sack/query.cpp | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/libdnf/sack/query.cpp b/libdnf/sack/query.cpp
index ac2736b5..03d39659 100644
--- a/libdnf/sack/query.cpp
+++ b/libdnf/sack/query.cpp
@@ -1877,12 +1877,6 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
std::vector<Solvable *> candidates;
std::vector<Solvable *> installed_solvables;
- Id id = -1;
- while ((id = resultPset->next(id)) != -1) {
- candidates.push_back(pool_id2solvable(pool, id));
- }
- NameArchEVRComparator cmp_key(pool);
-
if (cmp_type & HY_UPGRADE) {
Query installed(sack, ExcludeFlags::IGNORE_EXCLUDES);
installed.installed();
@@ -1893,6 +1887,18 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
installed_solvables.push_back(pool_id2solvable(pool, installed_id));
}
std::sort(installed_solvables.begin(), installed_solvables.end(), NameArchSolvableComparator);
+ Id id = -1;
+ while ((id = resultPset->next(id)) != -1) {
+ Solvable * s = pool_id2solvable(pool, id);
+ // When doing HY_UPGRADE consider only candidate pkgs that have matching Name and Arch
+ // with some already installed pkg (in other words: some other version of the pkg is already installed).
+ // Otherwise a pkg with different Arch than installed can end up in upgrade set which is wrong.
+ // It can result in dependency issues, reported as: RhBug:2088149.
+ auto low = std::lower_bound(installed_solvables.begin(), installed_solvables.end(), s, NameArchSolvableComparator);
+ if (low != installed_solvables.end() && s->name == (*low)->name && s->arch == (*low)->arch) {
+ candidates.push_back(s);
+ }
+ }
// Apply security filters only to packages with lower priority - to unify behaviour upgrade
// and upgrade-minimal
@@ -1915,7 +1921,14 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname)
}
}
std::swap(candidates, priority_candidates);
+ } else {
+ Id id = -1;
+ while ((id = resultPset->next(id)) != -1) {
+ candidates.push_back(pool_id2solvable(pool, id));
+ }
}
+
+ NameArchEVRComparator cmp_key(pool);
std::sort(candidates.begin(), candidates.end(), cmp_key);
for (auto & advisoryPkg : pkgs) {
if (cmp_type & HY_UPGRADE) {
--
2.36.1

View File

@ -56,7 +56,7 @@
Name: libdnf Name: libdnf
Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version}
Release: 9%{?dist} Release: 10%{?dist}
Summary: Library providing simplified C and Python API to libsolv Summary: Library providing simplified C and Python API to libsolv
License: LGPLv2+ License: LGPLv2+
URL: https://github.com/rpm-software-management/libdnf URL: https://github.com/rpm-software-management/libdnf
@ -95,6 +95,12 @@ Patch31: 0031-Increase-required-libsolv-version-for-cache-versioni.patch
Patch32: 0032-Add-more-specific-error-handling-for-loading-repomd-.patch Patch32: 0032-Add-more-specific-error-handling-for-loading-repomd-.patch
Patch33: 0033-libdnf-transaction-RPMItem-Fix-handling-transaction-.patch Patch33: 0033-libdnf-transaction-RPMItem-Fix-handling-transaction-.patch
Patch34: 0034-libdnf-transaction-TransactionItem-Set-short-action-.patch Patch34: 0034-libdnf-transaction-TransactionItem-Set-short-action-.patch
Patch35: 0035-Do-not-print-errors-on-failovermethod-repo-option-Rh.patch
Patch36: 0036-sack-query.hpp-Add-a-missing-include.patch
Patch37: 0037-context-dnf_context_remove-accepts-package-spec-as-d.patch
Patch38: 0038-context-Fix-doc-dnf_context_install-remove-update-di.patch
Patch39: 0039-advisory-upgrade-filter-out-advPkgs-with-different-a.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
@ -339,6 +345,11 @@ popd
%endif %endif
%changelog %changelog
* Tue Jun 14 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.63.0-10
- Do not print errors on failovermethod repo option
- the dnf_context_remove() function accepts `<package-spec>`, doc updates
- advisory upgrade: filter out advPkgs with different arch
* Wed May 04 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.63.0-8 * Wed May 04 2022 Lukas Hrazky <lhrazky@redhat.com> - 0.63.0-8
- Substitute all repository config options (fixes substitution of baseurl) - Substitute all repository config options (fixes substitution of baseurl)
- Use solvfile userdata to store and check checksums and solv versions - Use solvfile userdata to store and check checksums and solv versions