r47251 - in /packages/unstable/gnome-software/debian/patches: ./ 01_fwupd-dont-crash.patch 02_fwupd-nofail.patch series

mak at users.alioth.debian.org mak at users.alioth.debian.org
Fri Jan 15 14:13:25 UTC 2016


Author: mak
Date: Fri Jan 15 14:13:24 2016
New Revision: 47251

URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=47251
Log:
Add several patches to fix fwupd issues

Added:
    packages/unstable/gnome-software/debian/patches/
    packages/unstable/gnome-software/debian/patches/01_fwupd-dont-crash.patch
    packages/unstable/gnome-software/debian/patches/02_fwupd-nofail.patch
    packages/unstable/gnome-software/debian/patches/series

Added: packages/unstable/gnome-software/debian/patches/01_fwupd-dont-crash.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/gnome-software/debian/patches/01_fwupd-dont-crash.patch?rev=47251&op=file
==============================================================================
--- packages/unstable/gnome-software/debian/patches/01_fwupd-dont-crash.patch	(added)
+++ packages/unstable/gnome-software/debian/patches/01_fwupd-dont-crash.patch	[utf-8] Fri Jan 15 14:13:24 2016
@@ -0,0 +1,113 @@
+From acd34d50260b60ce5e7cc83506874e6f611e02f2 Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Fri, 8 Jan 2016 10:42:46 +0000
+Subject: Do not crash on refresh if the fwupd daemon is not available
+
+Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1282395
+---
+ src/plugins/gs-plugin-fwupd.c | 38 ++++++++++++++++----------------------
+ 1 file changed, 16 insertions(+), 22 deletions(-)
+
+diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
+index 0a4844a..d5e5f66 100644
+--- a/src/plugins/gs-plugin-fwupd.c
++++ b/src/plugins/gs-plugin-fwupd.c
+@@ -34,7 +34,7 @@
+ #include "gs-utils.h"
+ 
+ struct GsPluginPrivate {
+-	gsize			 done_init;
++	GMutex			 mutex;
+ 	GDBusProxy		*proxy;
+ 	GPtrArray		*to_download;
+ 	GPtrArray		*to_ignore;
+@@ -137,6 +137,7 @@ gs_plugin_startup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
+ 	g_autoptr(GError) error_local = NULL;
+ 	g_autofree gchar *data = NULL;
+ 	g_autoptr(GDBusConnection) conn = NULL;
++	g_autoptr(GMutexLocker) locker = g_mutex_locker_new (&plugin->priv->mutex);
+ 
+ 	/* register D-Bus errors */
+ 	fwupd_error_quark ();
+@@ -411,23 +412,20 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
+ {
+ 	GVariant *variant;
+ 	const gchar *key;
+-	gboolean ret;
+ 	g_autoptr(GError) error_local = NULL;
+ 	g_autoptr(GsApp) app = NULL;
+ 	g_autoptr(GVariantIter) iter = NULL;
+ 	g_autoptr(GVariant) val = NULL;
+ 
+-	/* watch the file in case it comes or goes */
+-	if (g_once_init_enter (&plugin->priv->done_init)) {
+-		ret = gs_plugin_startup (plugin, cancellable, error);
+-		g_once_init_leave (&plugin->priv->done_init, TRUE);
+-		if (!ret)
++	/* set up plugin */
++	if (plugin->priv->proxy == NULL) {
++		if (!gs_plugin_startup (plugin, cancellable, error))
+ 			return FALSE;
+ 	}
+-
+-	/* could not connect */
+ 	if (plugin->priv->proxy == NULL)
+ 		return TRUE;
++
++	/* get historical updates */
+ 	val = g_dbus_proxy_call_sync (plugin->priv->proxy,
+ 				      "GetResults",
+ 				      g_variant_new ("(s)", FWUPD_DEVICE_ID_ANY),
+@@ -476,23 +474,20 @@ gs_plugin_add_updates (GsPlugin *plugin,
+ 		       GError **error)
+ {
+ 	const gchar *id;
+-	gboolean ret;
+ 	GVariantIter *iter_device;
+ 	g_autoptr(GError) error_local = NULL;
+ 	g_autoptr(GVariantIter) iter = NULL;
+ 	g_autoptr(GVariant) val = NULL;
+ 
+-	/* watch the file in case it comes or goes */
+-	if (g_once_init_enter (&plugin->priv->done_init)) {
+-		ret = gs_plugin_startup (plugin, cancellable, error);
+-		g_once_init_leave (&plugin->priv->done_init, TRUE);
+-		if (!ret)
++	/* set up plugin */
++	if (plugin->priv->proxy == NULL) {
++		if (!gs_plugin_startup (plugin, cancellable, error))
+ 			return FALSE;
+ 	}
+-
+-	/* could not connect */
+ 	if (plugin->priv->proxy == NULL)
+ 		return TRUE;
++
++	/* get current list of updates */
+ 	val = g_dbus_proxy_call_sync (plugin->priv->proxy,
+ 				      "GetUpdates",
+ 				      NULL,
+@@ -732,16 +727,15 @@ gs_plugin_refresh (GsPlugin *plugin,
+ 		   GError **error)
+ {
+ 	const gchar *tmp;
+-	gboolean ret;
+ 	guint i;
+ 
+ 	/* set up plugin */
+-	if (g_once_init_enter (&plugin->priv->done_init)) {
+-		ret = gs_plugin_startup (plugin, cancellable, error);
+-		g_once_init_leave (&plugin->priv->done_init, TRUE);
+-		if (!ret)
++	if (plugin->priv->proxy == NULL) {
++		if (!gs_plugin_startup (plugin, cancellable, error))
+ 			return FALSE;
+ 	}
++	if (plugin->priv->proxy == NULL)
++		return TRUE;
+ 
+ 	/* ensure networking is set up */
+ 	if (!gs_plugin_fwupd_setup_networking (plugin, error))
+-- 
+cgit v0.11.2
+

Added: packages/unstable/gnome-software/debian/patches/02_fwupd-nofail.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/gnome-software/debian/patches/02_fwupd-nofail.patch?rev=47251&op=file
==============================================================================
--- packages/unstable/gnome-software/debian/patches/02_fwupd-nofail.patch	(added)
+++ packages/unstable/gnome-software/debian/patches/02_fwupd-nofail.patch	[utf-8] Fri Jan 15 14:13:24 2016
@@ -0,0 +1,97 @@
+From fa85bfaa6ab226cdd98360063735e83dcd2e5445 Mon Sep 17 00:00:00 2001
+From: Matthias Klumpp <matthias at tenstral.net>
+Date: Fri, 15 Jan 2016 14:59:03 +0100
+Subject: Don't fail updates if fwupd daemon does not exist
+
+This resolves https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808305
+---
+ src/plugins/gs-plugin-fwupd.c | 34 +++++++++++++++++++++++++++-------
+ 1 file changed, 27 insertions(+), 7 deletions(-)
+
+diff --git a/src/plugins/gs-plugin-fwupd.c b/src/plugins/gs-plugin-fwupd.c
+index d5e5f66..80cf7a5 100644
+--- a/src/plugins/gs-plugin-fwupd.c
++++ b/src/plugins/gs-plugin-fwupd.c
+@@ -42,6 +42,7 @@ struct GsPluginPrivate {
+ 	gchar			*cachedir;
+ 	gchar			*lvfs_sig_fn;
+ 	gchar			*lvfs_sig_hash;
++	gchar			*config_fn;
+ };
+
+ /**
+@@ -93,6 +94,16 @@ gs_plugin_initialize (GsPlugin *plugin)
+ 	plugin->priv = GS_PLUGIN_GET_PRIVATE (GsPluginPrivate);
+ 	plugin->priv->to_download = g_ptr_array_new_with_free_func (g_free);
+ 	plugin->priv->to_ignore = g_ptr_array_new_with_free_func (g_free);
++
++	plugin->priv->config_fn = g_build_filename (SYSCONFDIR, "fwupd.conf", NULL);
++	if (!g_file_test (plugin->priv->config_fn, G_FILE_TEST_EXISTS)) {
++		g_free (plugin->priv->config_fn);
++		plugin->priv->config_fn = g_strdup ("/etc/fwupd.conf");
++	}
++	if (!g_file_test (plugin->priv->config_fn, G_FILE_TEST_EXISTS)) {
++		g_debug ("fwupd configuration not found, disabling plugin.");
++		gs_plugin_set_enabled (plugin, FALSE);
++	}
+ }
+
+ /**
+@@ -104,6 +115,7 @@ gs_plugin_destroy (GsPlugin *plugin)
+ 	g_free (plugin->priv->cachedir);
+ 	g_free (plugin->priv->lvfs_sig_fn);
+ 	g_free (plugin->priv->lvfs_sig_hash);
++	g_free (plugin->priv->config_fn);
+ 	g_ptr_array_unref (plugin->priv->to_download);
+ 	g_ptr_array_unref (plugin->priv->to_ignore);
+ 	if (plugin->priv->proxy != NULL)
+@@ -435,6 +447,13 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
+ 				      &error_local);
+ 	if (val == NULL) {
+ 		if (g_error_matches (error_local,
++				     G_DBUS_ERROR,
++				     G_DBUS_ERROR_SERVICE_UNKNOWN)) {
++			/* the fwupd service might be unavailable, continue in that case */
++			g_debug ("fwupd: Could not get historical updates, service is unknown.");
++			return TRUE;
++		}
++		if (g_error_matches (error_local,
+ 				     FWUPD_ERROR,
+ 				     FWUPD_ERROR_NOTHING_TO_DO))
+ 			return TRUE;
+@@ -497,6 +516,13 @@ gs_plugin_add_updates (GsPlugin *plugin,
+ 				      &error_local);
+ 	if (val == NULL) {
+ 		if (g_error_matches (error_local,
++				     G_DBUS_ERROR,
++				     G_DBUS_ERROR_SERVICE_UNKNOWN)) {
++			/* the fwupd service might be unavailable, continue in that case */
++			g_debug ("fwupd: Could not get updates, service is unknown.");
++			return TRUE;
++		}
++		if (g_error_matches (error_local,
+ 				     FWUPD_ERROR,
+ 				     FWUPD_ERROR_NOTHING_TO_DO))
+ 			return TRUE;
+@@ -612,7 +638,6 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
+ 	g_autofree gchar *basename_data = NULL;
+ 	g_autofree gchar *cache_fn_data = NULL;
+ 	g_autofree gchar *checksum = NULL;
+-	g_autofree gchar *config_fn = NULL;
+ 	g_autofree gchar *url_data = NULL;
+ 	g_autofree gchar *url_sig = NULL;
+ 	g_autoptr(GKeyFile) config = NULL;
+@@ -621,12 +646,7 @@ gs_plugin_fwupd_check_lvfs_metadata (GsPlugin *plugin,
+
+ 	/* read config file */
+ 	config = g_key_file_new ();
+-	config_fn = g_build_filename (SYSCONFDIR, "fwupd.conf", NULL);
+-	if (!g_file_test (config_fn, G_FILE_TEST_EXISTS)) {
+-		g_free (config_fn);
+-		config_fn = g_strdup ("/etc/fwupd.conf");
+-	}
+-	if (!g_key_file_load_from_file (config, config_fn, G_KEY_FILE_NONE, error))
++	if (!g_key_file_load_from_file (config, plugin->priv->config_fn, G_KEY_FILE_NONE, error))
+ 		return FALSE;
+
+ 	/* check cache age */

Added: packages/unstable/gnome-software/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/packages/unstable/gnome-software/debian/patches/series?rev=47251&op=file
==============================================================================
--- packages/unstable/gnome-software/debian/patches/series	(added)
+++ packages/unstable/gnome-software/debian/patches/series	[utf-8] Fri Jan 15 14:13:24 2016
@@ -0,0 +1,2 @@
+01_fwupd-dont-crash.patch
+02_fwupd-nofail.patch




More information about the pkg-gnome-commits mailing list