diff --git a/PackageKit-zypp-avoid-statuReset.patch b/PackageKit-zypp-avoid-statuReset.patch new file mode 100644 index 0000000..f933602 --- /dev/null +++ b/PackageKit-zypp-avoid-statuReset.patch @@ -0,0 +1,68 @@ +From e9f61bd37d7269aec15c15a98d2353c809ee0f86 Mon Sep 17 00:00:00 2001 +From: Jonathan Kang +Date: Fri, 22 Jul 2022 15:11:15 +0800 +Subject: [PATCH] zypp: Avoid statuReset() on locked packages + +https://bugzilla.suse.com/show_bug.cgi?id=1199895 +--- + backends/zypp/pk-backend-zypp.cpp | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +Index: PackageKit-1.2.5/backends/zypp/pk-backend-zypp.cpp +=================================================================== +--- PackageKit-1.2.5.orig/backends/zypp/pk-backend-zypp.cpp ++++ PackageKit-1.2.5/backends/zypp/pk-backend-zypp.cpp +@@ -1482,7 +1482,7 @@ zypp_perform_execution (PkBackendJob *jo + ResPool pool = ResPool::instance (); + for (ResPool::const_iterator it = pool.begin (); it != pool.end (); ++it) { + if (it->status ().isToBeInstalled ()) +- it->statusReset (); ++ it->statusReinit (); + } + + pk_backend_job_error_code (job, PK_ERROR_ENUM_DEP_RESOLUTION_FAILED, "%s", emsg); +@@ -1520,7 +1520,7 @@ zypp_perform_execution (PkBackendJob *jo + switch (type) { + case REMOVE: + if (!(*it)->isSystem ()) { +- it->statusReset (); ++ it->statusReinit (); + continue; + } + break; +@@ -1537,7 +1537,7 @@ zypp_perform_execution (PkBackendJob *jo + + if (!zypp_backend_pool_item_notify (job, *it, TRUE)) + ret = FALSE; +- it->statusReset (); ++ it->statusReinit (); + } + goto exit; + } +@@ -2849,7 +2849,7 @@ backend_install_packages_thread (PkBacke + if (!zypp_perform_execution (job, zypp, INSTALL, FALSE, transaction_flags)) { + // reset the status of the marked packages + for (vector::iterator it = items.begin (); it != items.end (); ++it) { +- it->statusReset (); ++ it->statusReinit (); + } + return; + } +@@ -2954,7 +2954,7 @@ backend_remove_packages_thread (PkBacken + if (!zypp_perform_execution (job, zypp, REMOVE, TRUE, transaction_flags)) { + //reset the status of the marked packages + for (vector::iterator it = items.begin (); it != items.end (); ++it) { +- it->statusReset(); ++ it->statusReinit(); + } + zypp_backend_finished_error ( + job, PK_ERROR_ENUM_TRANSACTION_ERROR, +@@ -3803,7 +3803,7 @@ backend_what_provides_thread (PkBackendJ + zypp_backend_package (job, status, it->resolvable()->satSolvable(), + it->resolvable ()->summary ().c_str ()); + } +- it->statusReset (); ++ it->statusReinit (); + } + solver.setIgnoreAlreadyRecommended (FALSE); + } else { diff --git a/PackageKit-zypp-disable-upgrade-system-in-sle.patch b/PackageKit-zypp-disable-upgrade-system-in-sle.patch new file mode 100644 index 0000000..2170366 --- /dev/null +++ b/PackageKit-zypp-disable-upgrade-system-in-sle.patch @@ -0,0 +1,50 @@ +From 01ae2ceee2688b308553b0ed0c5f9c1b6f27ad78 Mon Sep 17 00:00:00 2001 +From: Jonathan Kang +Date: Wed, 27 Jul 2022 17:15:31 +0800 +Subject: [PATCH] zypp: Disable upgrade-system support in SLE + +--- + backends/zypp/pk-backend-zypp.cpp | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp +index 259aa2b90..271cc0a6c 100644 +--- a/backends/zypp/pk-backend-zypp.cpp ++++ b/backends/zypp/pk-backend-zypp.cpp +@@ -44,6 +44,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -3547,6 +3548,8 @@ pk_backend_upgrade_system_thread (PkBackendJob *job, + gpointer user_data) + { + const gchar *release_ver = NULL; ++ g_autofree gchar *release_name = NULL; ++ g_autoptr(GError) error = NULL; + PkBitfield transaction_flags = 0; + + g_variant_get (params, "(t&su)", +@@ -3565,6 +3568,16 @@ pk_backend_upgrade_system_thread (PkBackendJob *job, + return; + } + ++ release_name = pk_get_distro_name (&error); ++ if (release_name == NULL) ++ g_error ("Failed to parse os-release: %s", error->message); ++ if (g_str_has_prefix (release_name, "SLE")) { ++ pk_backend_job_error_code (job, PK_ERROR_ENUM_NOT_SUPPORTED, ++ "upgrade-system is not supported in SLE."); ++ ++ return; ++ } ++ + ResPool pool = zypp_build_pool (zypp, TRUE); + PkRestartEnum restart = PK_RESTART_ENUM_NONE; + PoolStatusSaver saver; +-- +2.36.1 + diff --git a/PackageKit-zypp-fix-is-tumbleweed-check.patch b/PackageKit-zypp-fix-is-tumbleweed-check.patch new file mode 100644 index 0000000..39aefba --- /dev/null +++ b/PackageKit-zypp-fix-is-tumbleweed-check.patch @@ -0,0 +1,39 @@ +From 27eb171c805eedcd121d174c5d89d5eb2f15a045 Mon Sep 17 00:00:00 2001 +From: Jonathan Kang +Date: Tue, 2 Aug 2022 09:23:18 +0800 +Subject: [PATCH] zypp: build the pool before calling is_tumbleweed() + +This makes sure that is_tumbleweed() returns the correct result. +--- + backends/zypp/pk-backend-zypp.cpp | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp +index ecdfc9c89..62adbb8be 100644 +--- a/backends/zypp/pk-backend-zypp.cpp ++++ b/backends/zypp/pk-backend-zypp.cpp +@@ -3563,6 +3563,10 @@ pk_backend_upgrade_system_thread (PkBackendJob *job, + return; + } + ++ ResPool pool = zypp_build_pool (zypp, TRUE); ++ PkRestartEnum restart = PK_RESTART_ENUM_NONE; ++ PoolStatusSaver saver; ++ + if (is_tumbleweed ()) { + pk_backend_job_error_code (job, PK_ERROR_ENUM_NOT_SUPPORTED, + "upgrade-system is not supported in Tumbleweed, use \"pkcon update\" instead."); +@@ -3579,10 +3583,6 @@ pk_backend_upgrade_system_thread (PkBackendJob *job, + return; + } + +- ResPool pool = zypp_build_pool (zypp, TRUE); +- PkRestartEnum restart = PK_RESTART_ENUM_NONE; +- PoolStatusSaver saver; +- + /* Set environment variable ZYPP_REPO_RELEASEVER to target version. */ + g_setenv ("ZYPP_REPO_RELEASEVER", release_ver, TRUE); + +-- +2.37.1 + diff --git a/PackageKit-zypp-restore-pool-status-after-simulating-update.patch b/PackageKit-zypp-restore-pool-status-after-simulating-update.patch new file mode 100644 index 0000000..efa44c0 --- /dev/null +++ b/PackageKit-zypp-restore-pool-status-after-simulating-update.patch @@ -0,0 +1,33 @@ +From 8843cdf4de151d6a515bb3c42ca02774573bb370 Mon Sep 17 00:00:00 2001 +From: Jonathan Kang +Date: Mon, 1 Aug 2022 10:08:19 +0800 +Subject: [PATCH] zypp: restore pool status after simulating an update + +Previously, when simulating an update, doUpgrade() or doUpdate() is +called. But the changes to the pool never got commited nor cancelled. +This leads to the result that locked packages are updated in a later +update/upgrade. + +Fix that by restoring the ResPool status to the state before simulating +an update. + +https://bugzilla.suse.com/show_bug.cgi?id=1199895 +--- + backends/zypp/pk-backend-zypp.cpp | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp +index 271cc0a6c..ecdfc9c89 100644 +--- a/backends/zypp/pk-backend-zypp.cpp ++++ b/backends/zypp/pk-backend-zypp.cpp +@@ -3451,6 +3451,7 @@ upgrade_system (PkBackendJob *job, + if (!zypp_refresh_cache (job, zypp, FALSE)) { + return; + } ++ PoolStatusSaver saver; + zypp_get_updates (job, zypp, candidates); + if (candidates.empty ()) { + pk_backend_job_error_code (job, PK_ERROR_ENUM_NO_DISTRO_UPGRADE_DATA, +-- +2.36.1 + diff --git a/PackageKit-zypp-update-libzypp-dependency-version.patch b/PackageKit-zypp-update-libzypp-dependency-version.patch new file mode 100644 index 0000000..648b838 --- /dev/null +++ b/PackageKit-zypp-update-libzypp-dependency-version.patch @@ -0,0 +1,29 @@ +From 58c7c0285100c6c26f299571dac784e8495df357 Mon Sep 17 00:00:00 2001 +From: Jonathan Kang +Date: Wed, 3 Aug 2022 10:55:48 +0800 +Subject: [PATCH] zypp: update libzypp dependency version + +In commit dd1964255, we use the newly introduced +PoolItem::statusReinit() to reset pool items status. Since this is +introduced in version 17.31.0, update libzypp dependency version. + +https://bugzilla.suse.com/show_bug.cgi?id=1199895 +--- + backends/zypp/meson.build | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/backends/zypp/meson.build b/backends/zypp/meson.build +index 84d5b6fbf..5957926dd 100644 +--- a/backends/zypp/meson.build ++++ b/backends/zypp/meson.build +@@ -1,6 +1,6 @@ + add_languages('cpp') + +-zypp_dep = dependency('libzypp', version: '>=6.16.0') ++zypp_dep = dependency('libzypp', version: '>=17.31.0') + + # define if libzypp returns package size in bytes + zypp_args = [] +-- +2.37.1 + diff --git a/PackageKit.changes b/PackageKit.changes index a4c86c1..a76efb8 100644 --- a/PackageKit.changes +++ b/PackageKit.changes @@ -1,3 +1,24 @@ +------------------------------------------------------------------- +Wed Aug 3 03:27:36 UTC 2022 - Jonathan Kang + +- Modified PackageKit.spec: bump libzypp dependency version to + 17.31.0. +- Add PackageKit-zypp-avoid-statuReset.patch: zypp: Avoid + statuReset() on locked packages + (gh#PackageKit/PackageKit/commit/dd1964255, bsc#1199895). +- Add PackageKit-zypp-disable-upgrade-system-in-sle.patch: zypp: + Disable upgrade-system support in SLE + (gh#PackageKit/PackageKit/commit/0fcd820c2). +- Add PackageKit-zypp-restore-pool-status-after-simulating-update.patch: + zypp: restore pool status after simulating an update + (gh#PackageKit/PackageKit/commit/2b61a6649, bsc#1199895). +- Add PackageKit-zypp-fix-is-tumbleweed-check.patch: zypp: build + the pool before calling is_tumbleweed() + (gh#PackageKit/PackageKit/commit/146890153). +- Add PackageKit-zypp-update-libzypp-dependency-version.patch: + zypp: update libzypp dependency version + (gh#PackageKit/PackageKit/commit/58c7c0285, bsc#1199895). + ------------------------------------------------------------------- Sat Jul 9 12:35:42 UTC 2022 - Callum Farmer diff --git a/PackageKit.spec b/PackageKit.spec index 06c41f1..e844fd1 100644 --- a/PackageKit.spec +++ b/PackageKit.spec @@ -56,6 +56,16 @@ Patch4: PackageKit-fix-crash-pre-dbus.patch Patch5: PackageKit-zypp-locked-packages.patch # PATCH-FIX-UPSTREAM PackageKit-zypp-add-upgrade-system.patch gh#hughsie/PackageKit/commit/930dd201b sckang@suse.com -- zypp: implement upgrade-system method Patch6: PackageKit-zypp-add-upgrade-system.patch +# PATCH-FIX-UPSTREAM PackageKit-zypp-avoid-statuReset.patch gh#PackageKit/PackageKit/commit/dd1964255, bsc#1199895 sckang@suse.com -- zypp: Avoid statuReset() on locked packages +Patch7: PackageKit-zypp-avoid-statuReset.patch +# PATCH-FIX-UPSTREAM PackageKit-zypp-disable-upgrade-system-in-sle.patch gh#PackageKit/PackageKit/commit/0fcd820c2 sckang@suse.com -- zypp: Disable upgrade-system support in SLE +Patch8: PackageKit-zypp-disable-upgrade-system-in-sle.patch +# PATCH-FIX-UPSTREAM PackageKit-zypp-restore-pool-status-after-simulating-update.patch gh#PackageKit/PackageKit/commit/2b61a6649, bsc#1199895 sckang@suse.com -- zypp: restore pool status after simulating an update +Patch9: PackageKit-zypp-restore-pool-status-after-simulating-update.patch +# PATCH-FIX-UPSTREAM PackageKit-zypp-fix-is-tumbleweed-check.patch gh#PackageKit/PackageKit/commit/146890153 sckang@suse.com -- zypp: build the pool before calling is_tumbleweed() +Patch10: PackageKit-zypp-fix-is-tumbleweed-check.patch +# PATCH-FIX-UPSTREAM PackageKit-zypp-update-libzypp-dependency-version.patch gh#PackageKit/PackageKit/commit/58c7c0285, bsc#1199895 sckang@suse.com -- zypp: update libzypp dependency version +Patch11: PackageKit-zypp-update-libzypp-dependency-version.patch BuildRequires: fdupes BuildRequires: gcc-c++ @@ -73,7 +83,6 @@ BuildRequires: libdnf-devel >= 0.43.1 %endif BuildRequires: libgudev-1_0-devel BuildRequires: libtool -BuildRequires: libzypp-devel BuildRequires: meson >= 0.50 BuildRequires: mozilla-nspr-devel >= 4.8 BuildRequires: ninja @@ -111,7 +120,9 @@ suck less. Summary: Zypp backend for the PackageKit installation management software License: GPL-2.0-or-later Group: System/Daemons +BuildRequires: libzypp-devel >= 17.31.0 Requires: %{name} = %{version} +Requires: libzypp >= 17.31.0 Provides: %{name}-backend = %{version} Conflicts: %{name}-backend Supplements: (%{name} and libzypp)