Backport a patch from master to fix package selection in gnome-packagekit

This commit is contained in:
Richard Hughes 2013-05-09 19:48:07 +01:00
parent d87cb2473a
commit 6f8e083fe6
2 changed files with 57 additions and 1 deletions

View File

@ -0,0 +1,47 @@
From b5a499ec7c34ea32f4ba379ec2b7cd352fe4c2d3 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Thu, 9 May 2013 15:45:25 +0100
Subject: [PATCH] Ensure the package is removed from the sack properly
We have to remove the package from the array itself, and the hash cache.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=960081
---
lib/packagekit-glib2/pk-package-sack.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/lib/packagekit-glib2/pk-package-sack.c b/lib/packagekit-glib2/pk-package-sack.c
index 94d02c3..59e47fb 100644
--- a/lib/packagekit-glib2/pk-package-sack.c
+++ b/lib/packagekit-glib2/pk-package-sack.c
@@ -445,6 +445,7 @@ pk_package_sack_remove_package (PkPackageSack *sack, PkPackage *package)
g_return_val_if_fail (PK_IS_PACKAGE (package), FALSE);
/* remove from array */
+ g_hash_table_remove (sack->priv->table, pk_package_get_id (package));
ret = g_ptr_array_remove (sack->priv->array, package);
return ret;
@@ -467,7 +468,6 @@ pk_package_sack_remove_package_by_id (PkPackageSack *sack,
const gchar *package_id)
{
PkPackage *package;
- const gchar *id;
gboolean ret = FALSE;
guint i;
GPtrArray *array;
@@ -478,9 +478,8 @@ pk_package_sack_remove_package_by_id (PkPackageSack *sack,
array = sack->priv->array;
for (i = 0; i < array->len; i++) {
package = g_ptr_array_index (array, i);
- id = pk_package_get_id (package);
- if (g_strcmp0 (package_id, id) == 0) {
- g_ptr_array_remove_index (array, i);
+ if (g_strcmp0 (package_id, pk_package_get_id (package)) == 0) {
+ pk_package_sack_remove_package (sack, package);
ret = TRUE;
break;
}
--
1.8.2.1

View File

@ -1,9 +1,10 @@
%define _default_patch_fuzz 2
%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
Summary: Package management service
Name: PackageKit
Version: 0.8.8
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+ and LGPLv2+
URL: http://www.packagekit.org
Source0: http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
@ -17,6 +18,9 @@ Patch1: PackageKit-0.4.4-Fedora-turn-off-time.conf.patch
# Upstreamable? allow use of xulrunner2 for browser-plugin support
Patch4: PackageKit-0.7.4-xulrunner2.patch
# Upstream
Patch6: 0001-Ensure-the-package-is-removed-from-the-sack-properly.patch
Requires: %{name}-glib%{?_isa} = %{version}-%{release}
Requires: PackageKit-backend
Requires: shared-mime-info
@ -237,6 +241,7 @@ user to restart the computer or remove and re-insert the device.
%patch0 -p1 -b .fedora
%patch1 -p1 -b .no-time
%patch4 -p1 -b .xulrunner2
%patch6 -p1 -b .fix-package-sack-removal
NOCONFIGURE=1 ./autogen.sh
@ -436,6 +441,10 @@ update-mime-database %{_datadir}/mime &> /dev/null || :
%{_libdir}/pkgconfig/packagekit-plugin.pc
%changelog
* Thu May 09 2013 Richard Hughes <rhughes@redhat.com> - 0.8.8-2
- Backport a patch from master to fix package selection in gnome-packagekit
- Resolves: #960081
* Wed May 08 2013 Richard Hughes <rhughes@redhat.com> - 0.8.8-1
- New upstream release
- PackageKit now allow local active users to install signed software without