[PackageKit] Backport two patches from master to fix up problems in the hawkey backend

Richard Hughes rhughes at fedoraproject.org
Thu Jan 23 17:24:30 UTC 2014


commit 9761afd2c29ce1a86cb98a10785a4fc5eeb0d6a1
Author: Richard Hughes <richard at hughsie.com>
Date:   Thu Jan 23 17:24:48 2014 +0000

    Backport two patches from master to fix up problems in the hawkey backend

 PackageKit.spec |    9 +++-
 master.patch    |  165 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 173 insertions(+), 1 deletions(-)
---
diff --git a/PackageKit.spec b/PackageKit.spec
index 08abe0b..f9550e9 100644
--- a/PackageKit.spec
+++ b/PackageKit.spec
@@ -6,7 +6,7 @@
 Summary:   Package management service
 Name:      PackageKit
 Version:   0.8.16
-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
@@ -14,6 +14,9 @@ Source0:   http://www.packagekit.org/releases/%{name}-%{version}.tar.xz
 # Fedora-specific: set Vendor.conf up for Fedora.
 Patch0:    PackageKit-0.3.8-Fedora-Vendor.conf.patch
 
+# Already upstream
+Patch1:    master.patch
+
 # Upstreamable?  allow use of xulrunner2 for browser-plugin support
 Patch4: PackageKit-0.7.4-xulrunner2.patch
 
@@ -172,6 +175,7 @@ using PackageKit.
 %prep
 %setup -q
 %patch0 -p1 -b .fedora
+%patch1 -p1 -b .master
 %patch4 -p1 -b .xulrunner2
 
 NOCONFIGURE=1 ./autogen.sh
@@ -336,6 +340,9 @@ popd > /dev/null
 %{_datadir}/gtk-doc/html/PackageKit
 
 %changelog
+* Thu Jan 23 2014 Richard Hughes <rhughes at redhat.com> - 0.8.16-2
+- Backport two patches from master to fix up problems in the hawkey backend.
+
 * Mon Jan 20 2014 Richard Hughes <rhughes at redhat.com> - 0.8.16-1
 - New upstream release
 - hawkey: Do not fail when update details are no longer available
diff --git a/master.patch b/master.patch
new file mode 100644
index 0000000..5d68283
--- /dev/null
+++ b/master.patch
@@ -0,0 +1,165 @@
+commit 09c9cde8c0cfec3a5f4320ec10bf2e1b0f9b460f
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Thu Jan 23 13:46:49 2014 +0000
+
+    hawkey: Fix installing i386 packages on a 64bit computer
+
+diff --git a/backends/hawkey/pk-backend-hawkey.c b/backends/hawkey/pk-backend-hawkey.c
+index f2ee746..b069396 100644
+--- a/backends/hawkey/pk-backend-hawkey.c
++++ b/backends/hawkey/pk-backend-hawkey.c
+@@ -3196,10 +3196,12 @@ out:
+ }
+ 
+ /**
+- * hif_is_installed_package_name:
++ * hif_is_installed_package_name_arch:
+  */
+ static gboolean
+-hif_is_installed_package_name (HySack sack, const gchar *name)
++hif_is_installed_package_name_arch (HySack sack,
++				    const gchar *name,
++				    const gchar *arch)
+ {
+ 	gboolean ret;
+ 	HyPackageList pkglist = NULL;
+@@ -3208,6 +3210,7 @@ hif_is_installed_package_name (HySack sack, const gchar *name)
+ 	/* run query */
+ 	query = hy_query_create (sack);
+ 	hy_query_filter (query, HY_PKG_NAME, HY_EQ, name);
++	hy_query_filter (query, HY_PKG_ARCH, HY_EQ, arch);
+ 	hy_query_filter (query, HY_PKG_REPONAME, HY_EQ, HY_SYSTEM_REPO_NAME);
+ 	pkglist = hy_query_run (query);
+ 
+@@ -3228,7 +3231,9 @@ hif_is_installed_package_id (HySack sack, const gchar *package_id)
+ 	gboolean ret;
+ 	gchar **split;
+ 	split = pk_package_id_split (package_id);
+-	ret = hif_is_installed_package_name (sack, split[PK_PACKAGE_ID_NAME]);
++	ret = hif_is_installed_package_name_arch (sack,
++						  split[PK_PACKAGE_ID_NAME],
++						  split[PK_PACKAGE_ID_ARCH]);
+ 	g_strfreev (split);
+ 	return ret;
+ }
+commit 5776000231f81f7d0d764038a9957439c35a7a5d
+Author: Richard Hughes <richard at hughsie.com>
+Date:   Thu Jan 23 14:25:55 2014 +0000
+
+    hawkey: Release locks early if the state fails
+
+diff --git a/backends/hawkey/hif-lock.c b/backends/hawkey/hif-lock.c
+index 97066f4..a644330 100644
+--- a/backends/hawkey/hif-lock.c
++++ b/backends/hawkey/hif-lock.c
+@@ -91,6 +91,19 @@ hif_lock_type_to_string (HifLockType lock_type)
+ }
+ 
+ /**
++ * hif_lock_mode_to_string:
++ **/
++static const gchar *
++hif_lock_mode_to_string (HifLockMode lock_mode)
++{
++	if (lock_mode == HIF_LOCK_MODE_THREAD)
++		return "thread";
++	if (lock_mode == HIF_LOCK_MODE_PROCESS)
++		return "process";
++	return "unknown";
++}
++
++/**
+  * hif_lock_get_item_by_type_mode:
+  **/
+ static HifLockItem *
+@@ -337,7 +350,9 @@ hif_lock_take (HifLock *lock,
+ 				g_set_error (error,
+ 					     HIF_ERROR,
+ 					     PK_ERROR_ENUM_CANNOT_GET_LOCK,
+-					     "already locked by %s",
++					     "%s[%s] already locked by %s",
++					     hif_lock_type_to_string (type),
++					     hif_lock_mode_to_string (mode),
+ 					     cmdline);
+ 				goto out;
+ 			}
+@@ -520,7 +535,7 @@ hif_lock_finalize (GObject *object)
+ 		if (item->refcount > 0) {
+ 			g_warning ("held lock %s at shutdown",
+ 				   hif_lock_type_to_string (item->type));
+-			hif_lock_release (lock, item->type, NULL);
++			hif_lock_release (lock, item->id, NULL);
+ 		}
+ 	}
+ 
+diff --git a/backends/hawkey/hif-source.c b/backends/hawkey/hif-source.c
+index b79f525..fffcc31 100644
+--- a/backends/hawkey/hif-source.c
++++ b/backends/hawkey/hif-source.c
+@@ -695,6 +695,7 @@ hif_source_update (HifSource *src,
+ 	if (!ret)
+ 		goto out;
+ out:
++	hif_state_release_locks (state);
+ 	lr_handle_setopt (src->repo_handle, NULL, LRO_PROGRESSCB, NULL);
+ 	lr_handle_setopt (src->repo_handle, NULL, LRO_PROGRESSDATA, 0xdeadbeef);
+ 	return ret;
+diff --git a/backends/hawkey/hif-state.c b/backends/hawkey/hif-state.c
+index 6cd706f..fc6753c 100644
+--- a/backends/hawkey/hif-state.c
++++ b/backends/hawkey/hif-state.c
+@@ -273,13 +273,17 @@ hif_state_set_speed (HifState *state, guint64 speed)
+ /**
+  * hif_state_release_locks:
+  **/
+-static gboolean
++gboolean
+ hif_state_release_locks (HifState *state)
+ {
+ 	gboolean ret = TRUE;
+ 	guint i;
+ 	guint lock_id;
+ 
++	/* release children first */
++	if (state->priv->child != NULL)
++		hif_state_release_locks (state->priv->child);
++
+ 	/* release each one */
+ 	for (i = 0; i < state->priv->lock_ids->len; i++) {
+ 		lock_id = GPOINTER_TO_UINT (g_ptr_array_index (state->priv->lock_ids, i));
+diff --git a/backends/hawkey/hif-state.h b/backends/hawkey/hif-state.h
+index ffd42e9..b7b26f4 100644
+--- a/backends/hawkey/hif-state.h
++++ b/backends/hawkey/hif-state.h
+@@ -131,6 +131,7 @@ gboolean	 hif_state_take_lock			(HifState		*state,
+ 							 HifLockType		 lock_type,
+ 							 HifLockMode		 lock_mode,
+ 							 GError			**error);
++gboolean	 hif_state_release_locks		(HifState		*state);
+ 
+ G_END_DECLS
+ 
+diff --git a/backends/hawkey/pk-backend-hawkey.c b/backends/hawkey/pk-backend-hawkey.c
+index b069396..40831b9 100644
+--- a/backends/hawkey/pk-backend-hawkey.c
++++ b/backends/hawkey/pk-backend-hawkey.c
+@@ -521,8 +521,10 @@ pk_backend_stop_job (PkBackend *backend, PkBackendJob *job)
+ 	PkBackendHifJobData *job_data = pk_backend_job_get_user_data (job);
+ 
+ 	g_object_unref (job_data->cancellable);
+-	if (job_data->state != NULL)
++	if (job_data->state != NULL) {
++		hif_state_release_locks (job_data->state);
+ 		g_object_unref (job_data->state);
++	}
+ 	if (job_data->sources != NULL)
+ 		g_ptr_array_unref (job_data->sources);
+ 	g_ptr_array_unref (job_data->packages_to_download);
+@@ -2954,6 +2956,7 @@ pk_backend_transaction_commit (PkBackendJob *job, HifState *state, GError **erro
+ 	if (!ret)
+ 		goto out;
+ out:
++	hif_state_release_locks (state);
+ 	g_free (verbosity_string);
+ 	if (commit != NULL) {
+ 		g_timer_destroy (commit->timer);


More information about the scm-commits mailing list