rpms/PackageKit/devel pk-dont-hang-when-cache-deep.patch, NONE, 1.1 PackageKit.spec, 1.60, 1.61

Richard Hughes rhughes at fedoraproject.org
Thu Sep 25 14:00:35 UTC 2008


Author: rhughes

Update of /cvs/pkgs/rpms/PackageKit/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7737

Modified Files:
	PackageKit.spec 
Added Files:
	pk-dont-hang-when-cache-deep.patch 
Log Message:
* Thu Sep 25 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.4-5
- When returning results from a cache we should always return finished in an
  idle loop so we can block and wait for a response
- This fixes the bug where if you have two GetUpdates in the queue the second
  would hang waiting for the first, even though it had already finished.


pk-dont-hang-when-cache-deep.patch:

--- NEW FILE pk-dont-hang-when-cache-deep.patch ---
commit 58955c21674e37d43d7353d30ab1da3163699e94
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Sep 25 14:32:25 2008 +0100

    bugfix: finish a cached transaction in an idle loop
    
    When returning results from a cache we should always return finished in an idle
    loop so we can block and wait for a response without having to know if we need
    to wait for ::Finished()

diff --git a/src/pk-transaction.c b/src/pk-transaction.c
index db68d4d..73f86dc 100644
--- a/src/pk-transaction.c
+++ b/src/pk-transaction.c
@@ -1093,6 +1093,19 @@ pk_transaction_commit (PkTransaction *transaction)
 }
 
 /**
+ * pk_transaction_finished_idle_cb:
+ **/
+static gboolean
+pk_transaction_finished_idle_cb (PkTransaction *transaction)
+{
+	const gchar *exit_text;
+	exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
+	egg_debug ("emitting finished '%s'", exit_text);
+	g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, 0);
+	return FALSE;
+}
+
+/**
  * pk_transaction_search_check:
  **/
 static gboolean
@@ -1236,7 +1249,6 @@ pk_transaction_accept_eula (PkTransaction *transaction, const gchar *eula_id, DB
 {
 	gboolean ret;
 	GError *error;
-	const gchar *exit_text;
 	gchar *sender;
 
 	g_return_if_fail (PK_IS_TRANSACTION (transaction));
@@ -1275,10 +1287,7 @@ pk_transaction_accept_eula (PkTransaction *transaction, const gchar *eula_id, DB
 		return;
 	}
 
-	exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
-	egg_debug ("emitting finished transaction '%s', %i", exit_text, 0);
-	g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, 0);
-
+	g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
 	dbus_g_method_return (context);
 }
 
@@ -1746,18 +1755,13 @@ pk_transaction_get_packages (PkTransaction *transaction, const gchar *filter, DB
 gboolean
 pk_transaction_get_old_transactions (PkTransaction *transaction, guint number, GError **error)
 {
-	const gchar *exit_text;
-
 	g_return_val_if_fail (PK_IS_TRANSACTION (transaction), FALSE);
 	g_return_val_if_fail (transaction->priv->tid != NULL, FALSE);
 
 	egg_debug ("GetOldTransactions method called");
 
 	pk_transaction_db_get_list (transaction->priv->transaction_db, number);
-
-	exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
-	egg_debug ("emitting finished transaction '%s', %i", exit_text, 0);
-	g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, 0);
+	g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
 
 	return TRUE;
 }
@@ -2071,10 +2075,7 @@ pk_transaction_get_update_detail (PkTransaction *transaction, gchar **package_id
 
 	/* if we have nothing to do, i.e. everything was in the cache */
 	if (array->len == 0) {
-		const gchar *exit_text;
-		exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
-		egg_debug ("emitting finished '%s' as no more to process", exit_text);
-		g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, 0);
+		g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
 		goto out;
 	}
 
@@ -2152,7 +2153,6 @@ pk_transaction_get_updates (PkTransaction *transaction, const gchar *filter, DBu
 	if (updates_cache != NULL) {
 		const PkPackageObj *obj;
 		const gchar *info_text;
-		const gchar *exit_text;
 		guint i;
 		guint length;
 
@@ -2169,10 +2169,7 @@ pk_transaction_get_updates (PkTransaction *transaction, const gchar *filter, DBu
 			g_free (package_id);
 		}
 
-		/* we are done */
-		exit_text = pk_exit_enum_to_text (PK_EXIT_ENUM_SUCCESS);
-		egg_debug ("emitting finished '%s'", exit_text);
-		g_signal_emit (transaction, signals [PK_TRANSACTION_FINISHED], 0, exit_text, 0);
+		g_idle_add ((GSourceFunc) pk_transaction_finished_idle_cb, transaction);
 
 		dbus_g_method_return (context);
 		return;


Index: PackageKit.spec
===================================================================
RCS file: /cvs/pkgs/rpms/PackageKit/devel/PackageKit.spec,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- PackageKit.spec	23 Sep 2008 13:50:10 -0000	1.60
+++ PackageKit.spec	25 Sep 2008 14:00:04 -0000	1.61
@@ -8,7 +8,7 @@
 Summary:   System daemon that is a DBUS abstraction layer for package management
 Name:      PackageKit
 Version:   0.3.4
-Release:   4%{?dist}
+Release:   5%{?dist}
 License:   GPLv2+
 Group:     System Environment/Libraries
 URL:       http://packagekit.freedesktop.org
@@ -24,6 +24,9 @@
 # upstream: 16bea44b16fd8b1ac36cc5939caf1017eece12eb
 Patch2:    pk-fix-yum-error-name.patch
 
+# upstream: 58955c21674e37d43d7353d30ab1da3163699e94
+Patch3:    pk-dont-hang-when-cache-deep.patch
+
 Requires: dbus >= %{dbus_version}
 Requires: dbus-glib >= %{dbus_glib_version}
 Requires: PackageKit-libs = %{version}-%{release}
@@ -151,6 +154,7 @@
 %patch0 -p1
 %patch1 -p1
 %patch2 -p1
+%patch3 -p1
 
 %build
 %configure --enable-yum --enable-smart --with-default-backend=yum --disable-local
@@ -281,6 +285,12 @@
 %{_includedir}/*
 
 %changelog
+* Thu Sep 25 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.4-5
+- When returning results from a cache we should always return finished in an
+  idle loop so we can block and wait for a response
+- This fixes the bug where if you have two GetUpdates in the queue the second
+  would hang waiting for the first, even though it had already finished.
+
 * Tue Sep 23 2008 Richard Hughes  <rhughes at redhat.com> - 0.3.4-4
 - Fix the error dialog when no mirrors are found
 




More information about the fedora-extras-commits mailing list