Accepting request 1007202 from GNOME:Factory

OBS-URL: https://build.opensuse.org/request/show/1007202
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/PackageKit?expand=0&rev=231
This commit is contained in:
Dominique Leuenberger 2022-10-03 11:44:23 +00:00 committed by Git OBS Bridge
commit 180bde1b35
5 changed files with 79 additions and 35 deletions

View File

@ -0,0 +1,39 @@
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
@@ -169,18 +169,30 @@ zypp_build_package_id_from_resolvable (c
{
gchar *package_id;
const char *arch;
+ g_autofree gchar *repo = NULL;
if (isKind<SrcPackage>(resolvable))
arch = "source";
else
arch = resolvable.arch ().asString ().c_str ();
- string repo = resolvable.repository ().alias();
- if (resolvable.isSystem())
- repo = "installed";
+ if (resolvable.isSystem ()) {
+ PoolItem pi;
+ PoolItem installedPI { resolvable };
+ ui::Selectable::Ptr selectable { ui::Selectable::get (resolvable) };
+
+ if (selectable->identicalAvailableObj (installedPI) != NULL)
+ pi = selectable->identicalAvailableObj (installedPI);
+ else
+ pi = selectable->updateCandidateObj ();
+
+ repo = g_strconcat ("installed:", pi.repository ().alias ().c_str (), NULL);
+ } else
+ repo = g_strdup (resolvable.repository ().alias ().c_str ());
+
package_id = pk_package_id_build (resolvable.name ().c_str (),
resolvable.edition ().asString ().c_str (),
- arch, repo.c_str ());
+ arch, repo);
return package_id;
}

View File

@ -0,0 +1,17 @@
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
@@ -2940,6 +2940,12 @@ backend_remove_packages_thread (PkBacken
return;
}
PoolItem item(solvable);
+ if (item.status ().isLocked ()) {
+ zypp_backend_finished_error (job, PK_ERROR_ENUM_PACKAGE_FAILED_TO_REMOVE,
+ "Failed to remove %s: Locked package.",
+ solvable.name ().c_str ());
+ return;
+ }
if (solvable.isSystem ()) {
item.status ().setToBeUninstalled (ResStatus::USER);
items.push_back (item);

View File

@ -1,26 +0,0 @@
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
@@ -1239,13 +1239,19 @@ zypp_get_package_updates (string repo, s
resolver->doUpdate ();
}
- for (; it != e; ++it)
- if (it->status().isToBeInstalled()) {
+ for (; it != e; ++it) {
+ if (it->status().isLocked()) {
+ // We pretend locked packages are not upgradable at all since
+ // we can't represent the concept of holds in PackageKit.
+ // https://github.com/PackageKit/PackageKit/issues/325
+ continue;
+ } else if (it->status().isToBeInstalled()) {
ui::Selectable::constPtr s =
ui::Selectable::get((*it)->kind(), (*it)->name());
if (s->hasInstalledObj())
pks.insert(*it);
}
+ }
if (is_tumbleweed ()) {
resolver->setUpgradeMode (FALSE);

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Sep 26 03:12:44 UTC 2022 - Jonathan Kang <songchuan.kang@suse.com>
- Add PackageKit-zypp-dont-remove-locked-packages.patch: zypp:
Check if packages are locked before removing
(gh#PackageKit/PackageKit/commit/8649a07bc, bsc#1199895).
- Add PackageKit-zypp-add-repo-in-packageid.patch: zypp: add
repository data in package id
(gh#PackageKit/PackageKit/commit/8eb2ef0ae, bsc#1202585).
- Remove PackageKit-zypp-locked-packages.patch: reverted upstream
(gh#PackageKit/PackageKit/commit/ed3e38043).
-------------------------------------------------------------------
Fri Sep 2 01:16:56 UTC 2022 - Jonathan Kang <songchuan.kang@suse.com>

View File

@ -52,22 +52,24 @@ Patch2: PackageKit-remove-polkit-rules.patch
Patch3: PackageKit-dnf-Add-support-for-AppStream-repodata-basenames-use.patch
# PATCH-FIX-UPSTREAM PackageKit-fix-crash-pre-dbus.patch gh#hughsie/PackageKit!436 -- Do not crash when calling pk_dbus_get_uid() before D-Bus is setup
Patch4: PackageKit-fix-crash-pre-dbus.patch
# PATCH-FIX-UPSTREAM PackageKit-zypp-locked-packages.patch gh#hughsie/PackageKit#543, boo#1199895 sckang@suse.com -- zypp: ignore locked packages
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
Patch5: 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
Patch6: 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
Patch7: 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
Patch8: 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
Patch9: 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
Patch10: PackageKit-zypp-update-libzypp-dependency-version.patch
# PATCH-FIX-UPSTREAM PackageKit-zypp-dont-refresh-before-searching.patch gh#PackageKit/PackageKit/commit/7e700e217, bsc#1202796 sckang@suse.com -- zypp: Don't refresh repos before searching
Patch12: PackageKit-zypp-dont-refresh-before-searching.patch
Patch11: PackageKit-zypp-dont-refresh-before-searching.patch
# PATCH-FIX-UPSTREAM PackageKit-zypp-dont-remove-locked-packages.patch gh#PackageKit/PackageKit/commit/8649a07bc, bsc#1199895 sckang@suse.com -- zypp: Check if packages are locked before removing
Patch12: PackageKit-zypp-dont-remove-locked-packages.patch
# PATCH-FIX-UPSTREAM PackageKit-zypp-fix-package-id.patch gh#PackageKit/PackageKit/commit/8eb2ef0ae, bsc#1202585 sckang@suse.com -- zypp: add repository data in package id
Patch13: PackageKit-zypp-add-repo-in-packageid.patch
BuildRequires: fdupes
BuildRequires: gcc-c++