diff --git a/SOURCES/0041-Fix-listing-a-repository-without-cpeid-RhBug-2066334.patch b/SOURCES/0041-Fix-listing-a-repository-without-cpeid-RhBug-2066334.patch new file mode 100644 index 0000000..bd49822 --- /dev/null +++ b/SOURCES/0041-Fix-listing-a-repository-without-cpeid-RhBug-2066334.patch @@ -0,0 +1,35 @@ +From 3a3929a27734aa77c980610a43039cb6b2b6d658 Mon Sep 17 00:00:00 2001 +From: Jan Kolarik +Date: Wed, 10 Aug 2022 05:21:38 +0000 +Subject: [PATCH] Fix listing a repository without cpeid (RhBug:2066334) + += changelog = +type: bugfix +resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2066334 +--- + libdnf/repo/Repo.cpp | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +diff --git a/libdnf/repo/Repo.cpp b/libdnf/repo/Repo.cpp +index e3a574fb..d61a24a5 100644 +--- a/libdnf/repo/Repo.cpp ++++ b/libdnf/repo/Repo.cpp +@@ -1021,8 +1021,13 @@ bool Repo::Impl::loadCache(bool throwExcept, bool ignoreMissing) + for (auto elem = yum_repomd->distro_tags; elem; elem = g_slist_next(elem)) { + if (elem->data) { + auto distroTag = static_cast(elem->data); +- if (distroTag->tag) +- distro_tags.emplace_back(distroTag->cpeid, distroTag->tag); ++ if (distroTag->tag) { ++ std::string cpeid_str; ++ if (distroTag->cpeid) { ++ cpeid_str = distroTag->cpeid; ++ } ++ distro_tags.emplace_back(std::move(cpeid_str), distroTag->tag); ++ } + } + } + +-- +2.37.1 + diff --git a/SOURCES/0042-Allow-change-of-arch-during-security-updates-with-no.patch b/SOURCES/0042-Allow-change-of-arch-during-security-updates-with-no.patch new file mode 100644 index 0000000..842b3eb --- /dev/null +++ b/SOURCES/0042-Allow-change-of-arch-during-security-updates-with-no.patch @@ -0,0 +1,89 @@ +From af5493156ecb1af3aedd5559a9a60b5df54a17ac Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= +Date: Wed, 7 Sep 2022 09:07:04 +0200 +Subject: [PATCH] Allow change of arch during security updates with noarch + (RhBug:2124483) + +This matches upgrade behaviour where upgrading from/to noarch is a +special case and architecture change of a package is allowed +automatically. + += changelog = +msg: Allow change of architecture for packages during security updates with noarch involved +type: security +resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2124483 +--- + libdnf/sack/query.cpp | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/libdnf/sack/query.cpp b/libdnf/sack/query.cpp +index 5355f9f7..b7b1560e 100644 +--- a/libdnf/sack/query.cpp ++++ b/libdnf/sack/query.cpp +@@ -189,6 +189,13 @@ NameArchSolvableComparator(const Solvable * first, const Solvable * second) + return first->arch < second->arch; + } + ++static bool ++NameSolvableComparator(const Solvable * first, const Solvable * second) ++{ ++ return first->name < second->name; ++} ++ ++ + static bool + NamePrioritySolvableKey(const Solvable * first, const Solvable * second) + { +@@ -1878,11 +1885,14 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname) + std::vector installed_solvables; + + if (cmp_type & HY_UPGRADE) { +- // 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) +- // or +- // * with pkg that obsoletes some already installed (or to be installed in this transaction) pkg +- // Otherwise a pkg with different Arch than installed can end up in upgrade set which is wrong. ++ // 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) ++ // * have matching Name with some already installed pkg and either the candidate or the installed pkg is noarch. ++ // This matches upgrade behavior where we allow architecture change only when noarch is involved. ++ // Details: RhBug:2124483, RhBug:2101398 and RhBug:1171543 ++ // * obsoletes some already installed (or to be installed in this transaction) pkg ++ // Otherwise a pkg with different Arch than installed (and than noarch) can end up in upgrade set which is wrong. + // It can result in dependency issues, reported as: RhBug:2088149. + + Query installed(sack, ExcludeFlags::IGNORE_EXCLUDES); +@@ -1893,7 +1903,7 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname) + while ((installed_id = installed.pImpl->result->next(installed_id)) != -1) { + installed_solvables.push_back(pool_id2solvable(pool, installed_id)); + } +- std::sort(installed_solvables.begin(), installed_solvables.end(), NameArchSolvableComparator); ++ std::sort(installed_solvables.begin(), installed_solvables.end(), NameSolvableComparator); + + Query obsoletes(sack, ExcludeFlags::IGNORE_EXCLUDES); + obsoletes.addFilter(HY_PKG, HY_EQ, resultPset); +@@ -1915,12 +1925,16 @@ Query::Impl::filterAdvisory(const Filter & f, Map *m, int keyname) + } + + Id id = -1; +- // Add to candidates resultPset pkgs that match name and arch with some already installed pkg ++ // Add to candidates resultPset pkgs that match name and arch with some already installed pkg or match name and either the installed or candidate are NOARCH + while ((id = resultPset->next(id)) != -1) { + Solvable * s = pool_id2solvable(pool, id); +- 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); ++ auto low = std::lower_bound(installed_solvables.begin(), installed_solvables.end(), s, NameSolvableComparator); ++ while (low != installed_solvables.end() && (*low)->name == s->name) { ++ if (s->arch == (*low)->arch || s->arch == ARCH_NOARCH || (*low)->arch == ARCH_NOARCH) { ++ candidates.push_back(s); ++ break; ++ } ++ ++low; + } + } + +-- +2.37.3 + diff --git a/SPECS/libdnf.spec b/SPECS/libdnf.spec index 37cde22..b029b23 100644 --- a/SPECS/libdnf.spec +++ b/SPECS/libdnf.spec @@ -56,7 +56,7 @@ Name: libdnf Version: %{libdnf_major_version}.%{libdnf_minor_version}.%{libdnf_micro_version} -Release: 11%{?dist} +Release: 13%{?dist} Summary: Library providing simplified C and Python API to libsolv License: LGPLv2+ URL: https://github.com/rpm-software-management/libdnf @@ -101,6 +101,8 @@ 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 Patch40: 0040-Add-obsoletes-to-filtering-for-advisory-candidates.patch +Patch41: 0041-Fix-listing-a-repository-without-cpeid-RhBug-2066334.patch +Patch42: 0042-Allow-change-of-arch-during-security-updates-with-no.patch BuildRequires: cmake @@ -346,6 +348,12 @@ popd %endif %changelog +* Wed Oct 26 2022 Nicola Sella - 0.63.0-13 +- Allow change of arch during security updates with noarch (RhBug:2124483) + +* Tue Sep 13 2022 Lukas Hrazky - 0.63.0-12 +- Fix listing a repository without cpeid (RhBug:2066334) + * Thu Jul 21 2022 Lukas Hrazky - 0.63.0-11 - Add obsoletes to filtering for advisory candidates