From 35dff110e0535dead28a7ca03172caa3a4741e6a Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Fri, 5 Jan 2024 17:51:43 +0100 Subject: [PATCH] dnf backend: added upstream patch to invalidate cache metadata and possibly fix repo refresh [release 1.1.12-6mamba;Wed Jul 10 2019] --- ...2-dnf-disable-trusted-packages-check.patch | 14 +++ PackageKit-1.1.12-dnf-openmamba.patch | 107 ++++++++++++++++++ PackageKit-1.1.12-dnf-repos-dir.patch | 11 ++ ...cache-after-downloading-new-metadata.patch | 35 ++++++ PackageKit.spec | 65 +++++++++-- 5 files changed, 220 insertions(+), 12 deletions(-) create mode 100644 PackageKit-1.1.12-dnf-disable-trusted-packages-check.patch create mode 100644 PackageKit-1.1.12-dnf-openmamba.patch create mode 100644 PackageKit-1.1.12-dnf-repos-dir.patch create mode 100644 PackageKit-1.1.12-upstream-dnf-invalidate-the-sack-cache-after-downloading-new-metadata.patch diff --git a/PackageKit-1.1.12-dnf-disable-trusted-packages-check.patch b/PackageKit-1.1.12-dnf-disable-trusted-packages-check.patch new file mode 100644 index 0000000..6ccbd60 --- /dev/null +++ b/PackageKit-1.1.12-dnf-disable-trusted-packages-check.patch @@ -0,0 +1,14 @@ +--- PackageKit-1.1.12/backends/dnf/pk-backend-dnf.c.orig 2019-06-23 16:11:17.722559163 +0200 ++++ PackageKit-1.1.12/backends/dnf/pk-backend-dnf.c 2019-06-23 16:11:34.260644154 +0200 +@@ -2514,9 +2514,9 @@ + return FALSE; + + /* depsolve */ +- if (pk_bitfield_contain (job_data->transaction_flags, ++ /*if (pk_bitfield_contain (job_data->transaction_flags, + PK_TRANSACTION_FLAG_ENUM_ONLY_TRUSTED)) +- flags |= DNF_TRANSACTION_FLAG_ONLY_TRUSTED; ++ flags |= DNF_TRANSACTION_FLAG_ONLY_TRUSTED;*/ + if (pk_bitfield_contain (job_data->transaction_flags, + PK_TRANSACTION_FLAG_ENUM_ALLOW_REINSTALL)) + flags |= DNF_TRANSACTION_FLAG_ALLOW_REINSTALL; diff --git a/PackageKit-1.1.12-dnf-openmamba.patch b/PackageKit-1.1.12-dnf-openmamba.patch new file mode 100644 index 0000000..12ec51a --- /dev/null +++ b/PackageKit-1.1.12-dnf-openmamba.patch @@ -0,0 +1,107 @@ +diff -Nru PackageKit-1.1.12.orig/backends/dnf/Makefile.am PackageKit-1.1.12/backends/dnf/Makefile.am +--- PackageKit-1.1.12.orig/backends/dnf/Makefile.am 2018-10-02 10:48:01.000000000 +0200 ++++ PackageKit-1.1.12/backends/dnf/Makefile.am 2019-06-02 14:29:17.819392100 +0200 +@@ -3,7 +3,8 @@ + EXTRA_DIST = \ + dnf-backend-vendor-fedora.c \ + dnf-backend-vendor-mageia.c \ +- dnf-backend-vendor-openmandriva.c ++ dnf-backend-vendor-openmandriva.c \ ++ dnf-backend-vendor-openmamba.c + libpk_backend_dnf_la_SOURCES = \ + dnf-backend-vendor.h \ + dnf-backend.c \ +diff -Nru PackageKit-1.1.12.orig/backends/dnf/Makefile.in PackageKit-1.1.12/backends/dnf/Makefile.in +--- PackageKit-1.1.12.orig/backends/dnf/Makefile.in 2018-11-28 09:00:22.000000000 +0100 ++++ PackageKit-1.1.12/backends/dnf/Makefile.in 2019-06-02 14:29:39.412510430 +0200 +@@ -482,7 +482,8 @@ + EXTRA_DIST = \ + dnf-backend-vendor-fedora.c \ + dnf-backend-vendor-mageia.c \ +- dnf-backend-vendor-openmandriva.c ++ dnf-backend-vendor-openmandriva.c \ ++ dnf-backend-vendor-openmamba.c + + libpk_backend_dnf_la_SOURCES = \ + dnf-backend-vendor.h \ +diff -Nru PackageKit-1.1.12.orig/configure PackageKit-1.1.12/configure +--- PackageKit-1.1.12.orig/configure 2018-11-28 09:00:21.000000000 +0100 ++++ PackageKit-1.1.12/configure 2019-06-02 14:31:03.464965583 +0200 +@@ -1783,7 +1783,7 @@ + where D-BUS system-services directory is + --with-dnf-vendor= + select a vendor configuration (fedora, mageia, +- openmandriva; default is fedora) ++ openmandriva, openmamba; default is fedora) + + Some influential environment variables: + PKG_CONFIG path to pkg-config utility +@@ -22243,7 +22243,7 @@ + withval=$with_dnf_vendor; + fi + +- if test "$with_dnf_vendor" = "fedora" -o "$with_dnf_vendor" = "mageia" -o "$with_dnf_vendor" = "openmandriva"; then ++ if test "$with_dnf_vendor" = "fedora" -o "$with_dnf_vendor" = "mageia" -o "$with_dnf_vendor" = "openmandriva" -o "$with_dnf_vendor" = "openmamba"; then + with_dnf_vendor="$with_dnf_vendor" + else + with_dnf_vendor="fedora" +diff -Nru PackageKit-1.1.12.orig/configure.ac PackageKit-1.1.12/configure.ac +--- PackageKit-1.1.12.orig/configure.ac 2018-11-24 09:40:55.000000000 +0100 ++++ PackageKit-1.1.12/configure.ac 2019-06-02 14:30:31.679794436 +0200 +@@ -394,8 +394,8 @@ + if test x$enable_dnf = xyes; then + PKG_CHECK_MODULES(DNF, appstream-glib libdnf >= 0.22.0 rpm) + AC_ARG_WITH(dnf-vendor, +- [AS_HELP_STRING([--with-dnf-vendor=],[select a vendor configuration (fedora, mageia, openmandriva; default is fedora)])]) +- if test "$with_dnf_vendor" = "fedora" -o "$with_dnf_vendor" = "mageia" -o "$with_dnf_vendor" = "openmandriva"; then ++ [AS_HELP_STRING([--with-dnf-vendor=],[select a vendor configuration (fedora, mageia, openmandriva, openmamba; default is fedora)])]) ++ if test "$with_dnf_vendor" = "fedora" -o "$with_dnf_vendor" = "mageia" -o "$with_dnf_vendor" = "openmandriva" -o "$with_dnf_vendor" = "openmamba"; then + with_dnf_vendor="$with_dnf_vendor" + else + with_dnf_vendor="fedora" +--- /dev/null 2019-03-18 22:35:13.859000000 +0100 ++++ PackageKit-1.1.12/backends/dnf/dnf-backend-vendor-openmamba.c 2019-06-04 18:34:35.213036497 +0200 +@@ -0,0 +1,43 @@ ++/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- ++ * ++ * Copyright (C) 2016 Neal Gompa ++ * Copyright (C) 2018 Kalev Lember ++ * ++ * Licensed under the GNU Lesser General Public License Version 2.1 ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#include "dnf-backend-vendor.h" ++ ++gboolean ++dnf_validate_supported_repo (const gchar *id) ++{ ++ const gchar *default_repos[] = { "rolling", ++ "rolling-games", ++ "rolling-i586", ++ "rolling-games-i586", ++ "unstable-makedist", ++ "unstable-makedist-i586", ++ NULL }; ++ ++ /* core repos that users shouldn't play with */ ++ for (guint i = 0; default_repos[i] != NULL; i++) { ++ if (g_strcmp0 (id, default_repos[i]) == 0) ++ return TRUE; ++ } ++ ++ return FALSE; ++} diff --git a/PackageKit-1.1.12-dnf-repos-dir.patch b/PackageKit-1.1.12-dnf-repos-dir.patch new file mode 100644 index 0000000..f469aca --- /dev/null +++ b/PackageKit-1.1.12-dnf-repos-dir.patch @@ -0,0 +1,11 @@ +--- PackageKit-1.1.12/backends/dnf/pk-backend-dnf.c.orig 2019-06-04 19:08:15.890971265 +0200 ++++ PackageKit-1.1.12/backends/dnf/pk-backend-dnf.c 2019-06-04 19:08:20.520990613 +0200 +@@ -152,7 +152,7 @@ + dnf_context_set_cache_dir (context, cache_dir); + solv_dir = g_build_filename (destdir, "/var/cache/PackageKit", release_ver, "hawkey", NULL); + dnf_context_set_solv_dir (context, solv_dir); +- repo_dir = g_build_filename (destdir, "/etc/yum.repos.d", NULL); ++ repo_dir = g_build_filename (destdir, "/etc/yum/repos.d", NULL); + dnf_context_set_repo_dir (context, repo_dir); + lock_dir = g_build_filename (destdir, "/var/run", NULL); + dnf_context_set_lock_dir (context, lock_dir); diff --git a/PackageKit-1.1.12-upstream-dnf-invalidate-the-sack-cache-after-downloading-new-metadata.patch b/PackageKit-1.1.12-upstream-dnf-invalidate-the-sack-cache-after-downloading-new-metadata.patch new file mode 100644 index 0000000..cc9c07b --- /dev/null +++ b/PackageKit-1.1.12-upstream-dnf-invalidate-the-sack-cache-after-downloading-new-metadata.patch @@ -0,0 +1,35 @@ +From cdbd27d699b51e37c533d07abd2f1ab26e11355c Mon Sep 17 00:00:00 2001 +From: Kalev Lember +Date: Tue, 18 Dec 2018 01:02:27 +0100 +Subject: [PATCH] dnf: Invalidate the sack cache after downloading new metadata + +This fixes first resolve() after refresh() to correctly return the new +data. + +https://bugzilla.redhat.com/show_bug.cgi?id=1642878 +--- + backends/dnf/pk-backend-dnf.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/backends/dnf/pk-backend-dnf.c b/backends/dnf/pk-backend-dnf.c +index 5961f1258..47e565915 100644 +--- a/backends/dnf/pk-backend-dnf.c ++++ b/backends/dnf/pk-backend-dnf.c +@@ -1568,6 +1568,7 @@ pk_backend_refresh_cache_thread (PkBackendJob *job, + gpointer user_data) + { + PkBackendDnfJobData *job_data = pk_backend_job_get_user_data (job); ++ PkBackend *backend = pk_backend_job_get_backend (job); + DnfRepo *repo; + DnfState *state_local; + DnfState *state_loop; +@@ -1699,6 +1700,9 @@ pk_backend_refresh_cache_thread (PkBackendJob *job, + return; + } + ++ /* invalidate the sack cache after downloading new metadata */ ++ pk_backend_sack_cache_invalidate (backend, "downloaded new metadata"); ++ + /* regenerate the libsolv metadata */ + state_local = dnf_state_get_child (job_data->state); + sack = dnf_utils_create_sack_for_filters (job, 0, diff --git a/PackageKit.spec b/PackageKit.spec index d3c5236..242aa22 100644 --- a/PackageKit.spec +++ b/PackageKit.spec @@ -1,6 +1,6 @@ Name: PackageKit Version: 1.1.12 -Release: 1mamba +Release: 6mamba Summary: A system designed to make installing and updating software on your computer easier Group: System/Management Vendor: openmamba @@ -23,50 +23,70 @@ Patch11: PackageKit-0.6.22-display_smart_errors_as_html.patch Patch12: PackageKit-0.8.11-smartBackend-fix-remove-packages.patch Patch13: PackageKit-0.9.5-smartBackend-correctly-raise-exceptions.patch Patch14: PackageKit-1.1.6-yumBackend-override_sigchecks.patch +Patch15: PackageKit-1.1.12-dnf-openmamba.patch +Patch16: PackageKit-1.1.12-dnf-repos-dir.patch +Patch17: PackageKit-1.1.12-dnf-disable-trusted-packages-check.patch +Patch18: PackageKit-1.1.12-upstream-dnf-invalidate-the-sack-cache-after-downloading-new-metadata.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel +BuildRequires: libappstream-glib-devel BuildRequires: libatk-devel +BuildRequires: libbeecrypt-devel BuildRequires: libblkid-devel BuildRequires: libbzip2-devel BuildRequires: libcairo-devel -BuildRequires: libcap-devel +%ifnarch arm +BuildRequires: libcpuinfo-devel +%endif +BuildRequires: libdnf-devel BuildRequires: libdw-devel +BuildRequires: libe2fs-devel BuildRequires: libelf-devel BuildRequires: libexpat-devel BuildRequires: libffi-devel BuildRequires: libfontconfig-devel BuildRequires: libfreetype-devel +BuildRequires: libfribidi-devel BuildRequires: libgcc -BuildRequires: libgcrypt-devel BuildRequires: libgdk-pixbuf-devel BuildRequires: libglib-devel -BuildRequires: libgpg-error-devel BuildRequires: libgraphite2-devel BuildRequires: libgstreamer-devel BuildRequires: libgtk-devel BuildRequires: libgtk2-devel BuildRequires: libharfbuzz-devel +BuildRequires: libkrb5-devel BuildRequires: liblzma-devel +BuildRequires: libmagic-devel BuildRequires: libmount-devel +BuildRequires: libneon-devel +BuildRequires: libopenssl-devel BuildRequires: libpango-devel BuildRequires: libpcre-devel BuildRequires: libpng-devel BuildRequires: libpolkit-devel -BuildRequires: libpython-devel +BuildRequires: libpopt-devel +BuildRequires: libproxy-devel +BuildRequires: librepo-devel BuildRequires: libselinux-devel BuildRequires: libsepol-devel BuildRequires: libsqlite-devel +BuildRequires: libstdc++6-devel +BuildRequires: libsyck-devel BuildRequires: libsystemd-devel BuildRequires: libthai-devel BuildRequires: libunwind-devel BuildRequires: libuuid-devel BuildRequires: libz-devel ## AUTOBUILDREQ-END +BuildRequires: librpm-devel >= 1:4.14.2.1 BuildRequires: gobject-introspection-devel BuildRequires: pm-utils-devel BuildRequires: libcppunit-devel -Requires: yum +BuildRequires: libdnf >= 0.31.0 +BuildRequires: librepo >= 1.10.3 +Requires: dnf %systemd_requires BuildRoot: %{_tmppath}/%{name}-%{version}-root @@ -181,12 +201,17 @@ This package contains static libraries and header files need for development. ##%patch13 -p1 #sed -i "s|/usr/bin/python$|/usr/bin/python%{python27_version}|" backends/smart/smartBackend.py %patch14 -p1 +%patch15 -p1 +%patch16 -p1 +%patch17 -p1 +%patch18 -p1 %build %configure \ - --enable-yum \ + --enable-dnf \ --enable-pm-utils \ - --with-default-backend=yum \ + --with-default-backend=dnf \ + --with-dnf-vendor=openmamba \ --enable-introspection \ --enable-networkmanager \ PYTHON=%{__python} @@ -219,11 +244,11 @@ rm -f %{buildroot}/var/lib/PackageKit/transactions.db %{_sysconfdir}/cron.daily/packagekit-background.cron %{_sysconfdir}/dbus-1/system.d/org.freedesktop.PackageKit.conf %{_sysconfdir}/profile.d/PackageKit.sh -%{_sysconfdir}/yum/pluginconf.d/refresh-packagekit.conf +#%{_sysconfdir}/yum/pluginconf.d/refresh-packagekit.conf %config(noreplace) %{_sysconfdir}/sysconfig/packagekit-background %{_bindir}/pkcon %{_bindir}/pkmon -%{_prefix}/lib/yum-plugins/refresh-packagekit.py +#%{_prefix}/lib/yum-plugins/refresh-packagekit.py %dir %{_libdir}/packagekit-backend %{_libdir}/packagekit-backend/libpk_backend_* %{_unitdir}/packagekit.service @@ -242,8 +267,8 @@ rm -f %{buildroot}/var/lib/PackageKit/transactions.db %{_datadir}/polkit-1/rules.d/org.freedesktop.packagekit.rules %{_datadir}/PackageKit/helpers %{_datadir}/PackageKit/pk-upgrade-distro.sh -%dir %{python_sitelib}/packagekit -%{python_sitelib}/packagekit/* +#%dir %{python_sitelib}/packagekit +#%{python_sitelib}/packagekit/* %dir /var/lib/PackageKit %dir /var/cache/PackageKit %dir /var/cache/PackageKit/downloads @@ -296,6 +321,22 @@ rm -f %{buildroot}/var/lib/PackageKit/transactions.db #%{_libdir}/pkgconfig/packagekit-plugin.pc %changelog +* Wed Jul 10 2019 Silvan Calarco 1.1.12-6mamba +- dnf backend: added upstream patch to invalidate cache metadata and possibly fix repo refresh + +* Sun Jun 23 2019 Silvan Calarco 1.1.12-5mamba +- dns: added patch to disable trusted packages check + +* Sat Jun 22 2019 Silvan Calarco 1.1.12-4mamba +- rebuilt with rpm 4 + +* Tue Jun 04 2019 Silvan Calarco 1.1.12-3mamba +- fix for openmamba dnf backend patch and configure arguments +- added patch to use /etc/yum/repos.d instead of /etc/yum.repos.d + +* Sat Jun 01 2019 Silvan Calarco 1.1.12-2mamba +- rebuilt with dnf support instead of broken yum + * Fri Dec 28 2018 Silvan Calarco 1.1.12-1mamba - update to 1.1.12