r54520 - in /desktop/unstable/gnome-software/debian: changelog patches/ patches/0001-fwupd-Do-not-use-deprecated-API.patch patches/0002-fwupd-Port-to-the-version-1.0-API.patch patches/series
biebl at users.alioth.debian.org
biebl at users.alioth.debian.org
Sat Oct 21 03:21:59 UTC 2017
Author: biebl
Date: Sat Oct 21 03:21:59 2017
New Revision: 54520
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=54520
Log:
Cherry-pick upstream fixes to make gnome-software build against fwupd 1.0.
(Closes: #879006)
Added:
desktop/unstable/gnome-software/debian/patches/
desktop/unstable/gnome-software/debian/patches/0001-fwupd-Do-not-use-deprecated-API.patch
desktop/unstable/gnome-software/debian/patches/0002-fwupd-Port-to-the-version-1.0-API.patch
desktop/unstable/gnome-software/debian/patches/series
Modified:
desktop/unstable/gnome-software/debian/changelog
Modified: desktop/unstable/gnome-software/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-software/debian/changelog?rev=54520&op=diff
==============================================================================
--- desktop/unstable/gnome-software/debian/changelog [utf-8] (original)
+++ desktop/unstable/gnome-software/debian/changelog [utf-8] Sat Oct 21 03:21:59 2017
@@ -1,3 +1,10 @@
+gnome-software (3.26.1-1.1) UNRELEASED; urgency=medium
+
+ * Cherry-pick upstream fixes to make gnome-software build against fwupd 1.0.
+ (Closes: #879006)
+
+ -- Michael Biebl <biebl at debian.org> Sat, 21 Oct 2017 05:20:41 +0200
+
gnome-software (3.26.1-1) unstable; urgency=medium
* New upstream release
Added: desktop/unstable/gnome-software/debian/patches/0001-fwupd-Do-not-use-deprecated-API.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-software/debian/patches/0001-fwupd-Do-not-use-deprecated-API.patch?rev=54520&op=file
==============================================================================
--- desktop/unstable/gnome-software/debian/patches/0001-fwupd-Do-not-use-deprecated-API.patch (added)
+++ desktop/unstable/gnome-software/debian/patches/0001-fwupd-Do-not-use-deprecated-API.patch [utf-8] Sat Oct 21 03:21:59 2017
@@ -0,0 +1,36 @@
+From 18ec45c2bac1c8390ebef4d13733220c4718d4cb Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Wed, 13 Sep 2017 15:24:56 +0100
+Subject: [PATCH 1/2] fwupd: Do not use deprecated API
+
+(cherry picked from commit a2eaf2d29ae8b8f73ea3b640221a0664226bb9ad)
+---
+ plugins/fwupd/gs-plugin-fwupd.c | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
+index c57bb63d..107f7626 100644
+--- a/plugins/fwupd/gs-plugin-fwupd.c
++++ b/plugins/fwupd/gs-plugin-fwupd.c
+@@ -352,11 +352,16 @@ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
+ FwupdRelease *rel = fwupd_result_get_release (res);
+ GsApp *app;
+ GPtrArray *guids;
+- const gchar *id;
++ g_autofree gchar *id = NULL;
+ g_autoptr(AsIcon) icon = NULL;
+
+ /* get from cache */
+- id = fwupd_result_get_unique_id (res);
++ id = as_utils_unique_id_build (AS_APP_SCOPE_SYSTEM,
++ AS_BUNDLE_KIND_UNKNOWN,
++ NULL, /* origin */
++ AS_APP_KIND_FIRMWARE,
++ fwupd_release_get_appstream_id (rel),
++ NULL);
+ app = gs_plugin_cache_lookup (plugin, id);
+ if (app == NULL) {
+ app = gs_plugin_app_new (plugin, id);
+--
+2.15.0.rc1
+
Added: desktop/unstable/gnome-software/debian/patches/0002-fwupd-Port-to-the-version-1.0-API.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-software/debian/patches/0002-fwupd-Port-to-the-version-1.0-API.patch?rev=54520&op=file
==============================================================================
--- desktop/unstable/gnome-software/debian/patches/0002-fwupd-Port-to-the-version-1.0-API.patch (added)
+++ desktop/unstable/gnome-software/debian/patches/0002-fwupd-Port-to-the-version-1.0-API.patch [utf-8] Sat Oct 21 03:21:59 2017
@@ -0,0 +1,445 @@
+From 7a5e03235bbd96463823f13c11ce926a6de820a0 Mon Sep 17 00:00:00 2001
+From: Richard Hughes <richard at hughsie.com>
+Date: Sun, 17 Sep 2017 12:58:47 +0100
+Subject: [PATCH 2/2] fwupd: Port to the version 1.0 API
+
+(cherry picked from commit 781c81721964e841fd35a0cd7a10c8ed51afa339)
+---
+ plugins/fwupd/gs-plugin-fwupd.c | 253 +++++++++++++++++++++++++++++++++++++++-
+ 1 file changed, 251 insertions(+), 2 deletions(-)
+
+diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
+index 107f7626..8bb0289a 100644
+--- a/plugins/fwupd/gs-plugin-fwupd.c
++++ b/plugins/fwupd/gs-plugin-fwupd.c
+@@ -46,8 +46,10 @@ struct GsPluginData {
+ GPtrArray *to_ignore;
+ GsApp *app_current;
+ GsApp *cached_origin;
++#if !FWUPD_CHECK_VERSION(1,0,0)
+ GHashTable *remote_asc_hash;
+ gchar *config_fn;
++#endif
+ };
+
+ static void
+@@ -103,6 +105,7 @@ gs_plugin_initialize (GsPlugin *plugin)
+ priv->client = fwupd_client_new ();
+ priv->to_download = g_ptr_array_new_with_free_func (g_free);
+ priv->to_ignore = g_ptr_array_new_with_free_func (g_free);
++#if !FWUPD_CHECK_VERSION(1,0,0)
+ priv->remote_asc_hash = g_hash_table_new_full (g_str_hash, g_str_equal,
+ g_free, g_free);
+ priv->config_fn = g_build_filename (SYSCONFDIR, "fwupd.conf", NULL);
+@@ -115,6 +118,7 @@ gs_plugin_initialize (GsPlugin *plugin)
+ gs_plugin_set_enabled (plugin, FALSE);
+ return;
+ }
++#endif
+
+ /* unique to us */
+ gs_plugin_set_app_gtype (plugin, GS_TYPE_FWUPD_APP);
+@@ -129,8 +133,10 @@ gs_plugin_destroy (GsPlugin *plugin)
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ if (priv->cached_origin != NULL)
+ g_object_unref (priv->cached_origin);
++#if !FWUPD_CHECK_VERSION(1,0,0)
+ g_hash_table_unref (priv->remote_asc_hash);
+ g_free (priv->config_fn);
++#endif
+ g_object_unref (priv->client);
+ g_ptr_array_unref (priv->to_download);
+ g_ptr_array_unref (priv->to_ignore);
+@@ -150,10 +156,16 @@ gs_plugin_fwupd_changed_cb (FwupdClient *client, GsPlugin *plugin)
+
+ static void
+ gs_plugin_fwupd_device_changed_cb (FwupdClient *client,
++#if FWUPD_CHECK_VERSION(1,0,0)
++ FwupdDevice *dev,
++#else
+ FwupdResult *res,
++#endif
+ GsPlugin *plugin)
+ {
++#if !FWUPD_CHECK_VERSION(1,0,0)
+ FwupdDevice *dev = fwupd_result_get_device (res);
++#endif
+
+ /* fwupd >= 0.7.1 supports per-device signals, and also the
+ * SUPPORTED flag -- so we can limit number of UI refreshes */
+@@ -237,6 +249,7 @@ gs_plugin_fwupd_get_file_checksum (const gchar *filename,
+ return g_compute_checksum_for_data (checksum_type, (const guchar *)data, len);
+ }
+
++#if !FWUPD_CHECK_VERSION(1,0,0)
+ static gboolean
+ gs_plugin_fwupd_setup_remote (GsPlugin *plugin, FwupdRemote *remote, GError **error)
+ {
+@@ -290,6 +303,7 @@ gs_plugin_fwupd_setup_remotes (GsPlugin *plugin, GCancellable *cancellable, GErr
+ }
+ return TRUE;
+ }
++#endif
+
+ gboolean
+ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
+@@ -322,8 +336,12 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
+ g_signal_connect (priv->client, "notify::status",
+ G_CALLBACK (gs_plugin_fwupd_notify_status_cb), plugin);
+
++#if !FWUPD_CHECK_VERSION(1,0,0)
+ /* get the hashes of the previously downloaded asc files */
+ return gs_plugin_fwupd_setup_remotes (plugin, cancellable, error);
++#else
++ return TRUE;
++#endif
+ }
+
+ static void
+@@ -345,11 +363,18 @@ gs_plugin_fwupd_add_required_location (GsPlugin *plugin, const gchar *location)
+ g_ptr_array_add (priv->to_download, g_strdup (location));
+ }
+
++#if FWUPD_CHECK_VERSION(1,0,0)
++static GsApp *
++gs_plugin_fwupd_new_app_from_device (GsPlugin *plugin, FwupdDevice *dev)
++{
++ FwupdRelease *rel = fwupd_device_get_release_default (dev);
++#else
+ static GsApp *
+ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
+ {
+ FwupdDevice *dev = fwupd_result_get_device (res);
+ FwupdRelease *rel = fwupd_result_get_release (res);
++#endif
+ GsApp *app;
+ GPtrArray *guids;
+ g_autofree gchar *id = NULL;
+@@ -518,11 +543,19 @@ fwupd_checksum_get_by_kind (GPtrArray *checksums, GChecksumType kind)
+ static gboolean
+ gs_plugin_add_update_app (GsPlugin *plugin,
+ GsAppList *list,
++#if FWUPD_CHECK_VERSION(1,0,0)
++ FwupdDevice *dev,
++#else
+ FwupdResult *res,
++#endif
+ gboolean is_downloaded,
+ GError **error)
+ {
++#if FWUPD_CHECK_VERSION(1,0,0)
++ FwupdRelease *rel = fwupd_device_get_release_default (dev);
++#else
+ FwupdRelease *rel = fwupd_result_get_release (res);
++#endif
+ GPtrArray *checksums;
+ const gchar *update_uri;
+ g_autofree gchar *basename = NULL;
+@@ -531,7 +564,11 @@ gs_plugin_add_update_app (GsPlugin *plugin,
+ g_autoptr(GsApp) app = NULL;
+
+ /* update unsupported */
++#if FWUPD_CHECK_VERSION(1,0,0)
++ app = gs_plugin_fwupd_new_app_from_device (plugin, dev);
++#else
+ app = gs_plugin_fwupd_new_app_from_results (plugin, res);
++#endif
+ if (gs_app_get_state (app) != AS_APP_STATE_UPDATABLE_LIVE) {
+ g_set_error (error,
+ GS_PLUGIN_ERROR,
+@@ -650,14 +687,26 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ g_autoptr(GError) error_local = NULL;
+ g_autoptr(GsApp) app = NULL;
++#if FWUPD_CHECK_VERSION(1,0,0)
++ g_autoptr(FwupdDevice) dev = NULL;
++#else
+ g_autoptr(FwupdResult) res = NULL;
++#endif
+
+ /* get historical updates */
++#if FWUPD_CHECK_VERSION(1,0,0)
++ dev = fwupd_client_get_results (priv->client,
++ FWUPD_DEVICE_ID_ANY,
++ cancellable,
++ &error_local);
++ if (dev == NULL) {
++#else
+ res = fwupd_client_get_results (priv->client,
+ FWUPD_DEVICE_ID_ANY,
+ cancellable,
+ &error_local);
+ if (res == NULL) {
++#endif
+ if (g_error_matches (error_local,
+ FWUPD_ERROR,
+ FWUPD_ERROR_NOTHING_TO_DO))
+@@ -673,7 +722,11 @@ gs_plugin_add_updates_historical (GsPlugin *plugin,
+ }
+
+ /* parse */
++#if FWUPD_CHECK_VERSION(1,0,0)
++ app = gs_plugin_fwupd_new_app_from_device (plugin, dev);
++#else
+ app = gs_plugin_fwupd_new_app_from_results (plugin, res);
++#endif
+ gs_app_list_add (list, app);
+ return TRUE;
+ }
+@@ -685,11 +738,72 @@ gs_plugin_fwupd_add_updates (GsPlugin *plugin,
+ GCancellable *cancellable,
+ GError **error)
+ {
++#if FWUPD_CHECK_VERSION(1,0,0)
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ g_autoptr(GError) error_local = NULL;
+- g_autoptr(GPtrArray) results = NULL;
++ g_autoptr(GPtrArray) devices = NULL;
+
+ /* get current list of updates */
++ devices = fwupd_client_get_devices (priv->client, cancellable, &error_local);
++ if (devices == NULL) {
++ if (g_error_matches (error_local,
++ FWUPD_ERROR,
++ FWUPD_ERROR_NOTHING_TO_DO)) {
++ g_debug ("no devices");
++ return TRUE;
++ }
++ g_propagate_error (error, g_steal_pointer (&error_local));
++ gs_plugin_fwupd_error_convert (error);
++ return FALSE;
++ }
++ for (guint i = 0; i < devices->len; i++) {
++ FwupdDevice *dev = g_ptr_array_index (devices, i);
++ FwupdRelease *rel_newest;
++ g_autoptr(GError) error_local2 = NULL;
++ g_autoptr(GPtrArray) rels = NULL;
++
++ /* locked device that needs unlocking */
++ if (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_LOCKED)) {
++ g_autoptr(GsApp) app = NULL;
++ app = gs_plugin_fwupd_new_app_from_device (plugin, dev);
++ gs_fwupd_app_set_is_locked (app, TRUE);
++ gs_app_list_add (list, app);
++ continue;
++ }
++
++ /* not going to have results, so save a D-Bus round-trip */
++ if (!fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_SUPPORTED))
++ continue;
++
++ /* get the releases for this device and filter for validity */
++ rels = fwupd_client_get_upgrades (priv->client,
++ fwupd_device_get_id (dev),
++ cancellable, &error_local2);
++ if (rels == NULL) {
++ if (g_error_matches (error_local2,
++ FWUPD_ERROR,
++ FWUPD_ERROR_NOTHING_TO_DO)) {
++ g_debug ("no updates for %s", fwupd_device_get_id (dev));
++ continue;
++ }
++ g_propagate_error (error, g_steal_pointer (&error_local2));
++ gs_plugin_fwupd_error_convert (error);
++ return FALSE;
++ }
++
++ /* normal device update */
++ rel_newest = g_ptr_array_index (rels, 0);
++ fwupd_device_add_release (dev, rel_newest);
++ if (!gs_plugin_add_update_app (plugin, list, dev,
++ is_downloaded, &error_local2)) {
++ g_debug ("%s", error_local2->message);
++ continue;
++ }
++ }
++#else
++ GsPluginData *priv = gs_plugin_get_data (plugin);
++ g_autoptr(GError) error_local = NULL;
++ g_autoptr(GPtrArray) results = NULL;
+ results = fwupd_client_get_updates (priv->client,
+ cancellable, &error_local);
+ if (results == NULL) {
+@@ -725,7 +839,7 @@ gs_plugin_fwupd_add_updates (GsPlugin *plugin,
+ is_downloaded, &error_local2))
+ g_debug ("%s", error_local2->message);
+ }
+-
++#endif
+ return TRUE;
+ }
+
+@@ -755,6 +869,112 @@ gs_plugin_fwupd_refresh_remote (GsPlugin *plugin,
+ GError **error)
+ {
+ GsPluginData *priv = gs_plugin_get_data (plugin);
++#if FWUPD_CHECK_VERSION(1,0,0)
++ GChecksumType checksum_kind;
++ const gchar *url_sig = NULL;
++ const gchar *url = NULL;
++ g_autoptr(GError) error_local = NULL;
++ g_autofree gchar *basename = NULL;
++ g_autofree gchar *basename_sig = NULL;
++ g_autofree gchar *cache_id = NULL;
++ g_autofree gchar *checksum = NULL;
++ g_autofree gchar *filename = NULL;
++ g_autofree gchar *filename_sig = NULL;
++ g_autoptr(GBytes) data = NULL;
++ g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
++
++ /* sanity check */
++ if (fwupd_remote_get_filename_cache_sig (remote) == NULL) {
++ g_set_error (error,
++ GS_PLUGIN_ERROR,
++ GS_PLUGIN_ERROR_FAILED,
++ "remote %s has no cache signature",
++ fwupd_remote_get_id (remote));
++ return FALSE;
++ }
++
++ /* check cache age */
++ if (cache_age > 0) {
++ guint64 age = fwupd_remote_get_age (remote);
++ guint tmp = age < G_MAXUINT ? (guint) age : G_MAXUINT;
++ if (tmp < cache_age) {
++ g_debug ("%s is only %u seconds old, so ignoring refresh",
++ filename_sig, tmp);
++ return TRUE;
++ }
++ }
++
++ /* download the signature first, it's smaller */
++ cache_id = g_strdup_printf ("fwupd/remotes.d/%s", fwupd_remote_get_id (remote));
++ basename_sig = g_path_get_basename (fwupd_remote_get_filename_cache_sig (remote));
++ filename_sig = gs_utils_get_cache_filename (cache_id, basename_sig,
++ GS_UTILS_CACHE_FLAG_WRITEABLE,
++ error);
++
++ /* download the signature first, it's smaller */
++ url_sig = fwupd_remote_get_metadata_uri_sig (remote);
++ gs_app_set_summary_missing (app_dl,
++ /* TRANSLATORS: status text when downloading */
++ _("Downloading firmware update signature…"));
++ data = gs_plugin_download_data (plugin, app_dl, url_sig, cancellable, error);
++ if (data == NULL) {
++ gs_utils_error_add_unique_id (error, priv->cached_origin);
++ return FALSE;
++ }
++
++ /* is the signature hash the same as we had before? */
++ checksum_kind = fwupd_checksum_guess_kind (fwupd_remote_get_checksum (remote));
++ checksum = g_compute_checksum_for_data (checksum_kind,
++ (const guchar *) g_bytes_get_data (data, NULL),
++ g_bytes_get_size (data));
++ if (g_strcmp0 (checksum, fwupd_remote_get_checksum (remote)) == 0) {
++ g_debug ("signature of %s is unchanged", url_sig);
++ return TRUE;
++ }
++
++ /* save to a file */
++ g_debug ("saving new remote signature to %s:", filename_sig);
++ if (!g_file_set_contents (filename_sig,
++ g_bytes_get_data (data, NULL),
++ (guint) g_bytes_get_size (data),
++ &error_local)) {
++ g_set_error (error,
++ GS_PLUGIN_ERROR,
++ GS_PLUGIN_ERROR_WRITE_FAILED,
++ "Failed to save firmware signature: %s",
++ error_local->message);
++ return FALSE;
++ }
++
++ /* download the payload and save to file */
++ basename = g_path_get_basename (fwupd_remote_get_filename_cache (remote));
++ filename = gs_utils_get_cache_filename (cache_id, basename,
++ GS_UTILS_CACHE_FLAG_WRITEABLE,
++ error);
++ if (filename == NULL)
++ return FALSE;
++ g_debug ("saving new firmware metadata to %s:", filename);
++ gs_app_set_summary_missing (app_dl,
++ /* TRANSLATORS: status text when downloading */
++ _("Downloading firmware update metadata…"));
++ url = fwupd_remote_get_metadata_uri (remote);
++ if (!gs_plugin_download_file (plugin, app_dl, url, filename,
++ cancellable, error)) {
++ gs_utils_error_add_unique_id (error, priv->cached_origin);
++ return FALSE;
++ }
++
++ /* phew, lets send all this to fwupd */
++ if (!fwupd_client_update_metadata (priv->client,
++ fwupd_remote_get_id (remote),
++ filename,
++ filename_sig,
++ cancellable,
++ error)) {
++ gs_plugin_fwupd_error_convert (error);
++ return FALSE;
++ }
++#else
+ const gchar *checksum_old;
+ g_autoptr(GError) error_local = NULL;
+ g_autofree gchar *filename = NULL;
+@@ -871,6 +1091,7 @@ gs_plugin_fwupd_refresh_remote (GsPlugin *plugin,
+ gs_plugin_fwupd_error_convert (error);
+ return FALSE;
+ }
++#endif
+ return TRUE;
+ }
+
+@@ -1085,7 +1306,11 @@ gs_plugin_file_to_app (GsPlugin *plugin,
+ GsPluginData *priv = gs_plugin_get_data (plugin);
+ g_autofree gchar *content_type = NULL;
+ g_autofree gchar *filename = NULL;
++#if FWUPD_CHECK_VERSION(1,0,0)
++ g_autoptr(GPtrArray) devices = NULL;
++#else
+ g_autoptr(GPtrArray) results = NULL;
++#endif
+ const gchar *mimetypes[] = {
+ "application/vnd.ms-cab-compressed",
+ NULL };
+@@ -1099,6 +1324,29 @@ gs_plugin_file_to_app (GsPlugin *plugin,
+
+ /* get results */
+ filename = g_file_get_path (file);
++#if FWUPD_CHECK_VERSION(1,0,0)
++ devices = fwupd_client_get_details (priv->client,
++ filename,
++ cancellable,
++ error);
++ if (devices == NULL) {
++ gs_plugin_fwupd_error_convert (error);
++ return FALSE;
++ }
++ for (guint i = 0; i < devices->len; i++) {
++ FwupdDevice *dev = g_ptr_array_index (devices, i);
++ g_autoptr(GsApp) app = NULL;
++
++ /* create each app */
++ app = gs_plugin_fwupd_new_app_from_device (plugin, dev);
++
++ /* we have no update view for local files */
++ gs_app_set_version (app, gs_app_get_update_version (app));
++ gs_app_set_description (app, GS_APP_QUALITY_NORMAL,
++ gs_app_get_update_details (app));
++ gs_app_list_add (list, app);
++ }
++#else
+ results = fwupd_client_get_details_local (priv->client,
+ filename,
+ cancellable,
+@@ -1120,6 +1368,7 @@ gs_plugin_file_to_app (GsPlugin *plugin,
+ gs_app_get_update_details (app));
+ gs_app_list_add (list, app);
+ }
++#endif
+
+ return TRUE;
+ }
+--
+2.15.0.rc1
+
Added: desktop/unstable/gnome-software/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gnome-software/debian/patches/series?rev=54520&op=file
==============================================================================
--- desktop/unstable/gnome-software/debian/patches/series (added)
+++ desktop/unstable/gnome-software/debian/patches/series [utf-8] Sat Oct 21 03:21:59 2017
@@ -0,0 +1,2 @@
+0001-fwupd-Do-not-use-deprecated-API.patch
+0002-fwupd-Port-to-the-version-1.0-API.patch
More information about the pkg-gnome-commits
mailing list