Backport a patch that fixes applying firmware updates using gnome-software

This commit is contained in:
Richard Hughes 2018-01-12 10:51:18 +00:00
parent 8512f5d41a
commit d380a45596
2 changed files with 108 additions and 1 deletions

View File

@ -0,0 +1,100 @@
From 74fa2ca635a6b7263c58375d8588d8fd3fe16e43 Mon Sep 17 00:00:00 2001
From: Richard Hughes <richard@hughsie.com>
Date: Wed, 10 Jan 2018 21:33:39 +0000
Subject: [PATCH] Fix firmware downloading using gnome-software compiled
against fwupd 1.0.x
Always set the AppStream app properties on the FwupdRelease. In some cases we
were returning FwupdRelease objects with no name or summary which gnome-software
was ignoring.
---
src/fu-engine.c | 21 ++++++++++++---------
src/fu-util.c | 12 ++++++++++++
2 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/src/fu-engine.c b/src/fu-engine.c
index ed4b893..8eb2d4d 100644
--- a/src/fu-engine.c
+++ b/src/fu-engine.c
@@ -218,6 +218,7 @@ fu_engine_device_changed_cb (FuDeviceList *device_list, FuDevice *device, FuEngi
static void
fu_engine_set_release_from_appstream (FuEngine *self,
FwupdRelease *rel,
+ AsApp *app,
AsRelease *release)
{
AsChecksum *csum;
@@ -225,6 +226,15 @@ fu_engine_set_release_from_appstream (FuEngine *self,
const gchar *tmp;
GBytes *remote_blob;
+ /* set from the AsApp */
+ fwupd_release_set_appstream_id (rel, as_app_get_id (app));
+ fwupd_release_set_homepage (rel, as_app_get_url_item (app, AS_URL_KIND_HOMEPAGE));
+ fwupd_release_set_license (rel, as_app_get_project_license (app));
+ fwupd_release_set_name (rel, as_app_get_name (app, NULL));
+ fwupd_release_set_summary (rel, as_app_get_comment (app, NULL));
+ fwupd_release_set_vendor (rel, as_app_get_developer_name (app, NULL));
+ fwupd_release_set_appstream_id (rel, as_app_get_id (app));
+
/* find the remote */
remote_blob = as_release_get_blob (release, "fwupd::RemoteId");
if (remote_blob != NULL) {
@@ -2058,13 +2068,7 @@ fu_engine_get_result_from_app (FuEngine *self, AsApp *app, GError **error)
fwupd_device_set_description (dev, as_app_get_description (app, NULL));
rel = fwupd_release_new ();
fwupd_release_set_trust_flags (rel, trust_flags);
- fwupd_release_set_homepage (rel, as_app_get_url_item (app, AS_URL_KIND_HOMEPAGE));
- fwupd_release_set_license (rel, as_app_get_project_license (app));
- fwupd_release_set_name (rel, as_app_get_name (app, NULL));
- fwupd_release_set_summary (rel, as_app_get_comment (app, NULL));
- fwupd_release_set_vendor (rel, as_app_get_developer_name (app, NULL));
- fwupd_release_set_appstream_id (rel, as_app_get_id (app));
- fu_engine_set_release_from_appstream (self, rel, release);
+ fu_engine_set_release_from_appstream (self, rel, app, release);
fwupd_device_add_release (dev, rel);
return g_steal_pointer (&dev);
}
@@ -2278,8 +2282,7 @@ fu_engine_get_releases_for_device (FuEngine *self, FuDevice *device, GError **er
g_autoptr(FwupdRelease) rel = fwupd_release_new ();
/* create new FwupdRelease for the AsRelease */
- fwupd_release_set_appstream_id (rel, as_app_get_id (app));
- fu_engine_set_release_from_appstream (self, rel, release);
+ fu_engine_set_release_from_appstream (self, rel, app, release);
/* invalid */
if (fwupd_release_get_uri (rel) == NULL)
diff --git a/src/fu-util.c b/src/fu-util.c
index b563832..970a6bb 100644
--- a/src/fu-util.c
+++ b/src/fu-util.c
@@ -901,6 +901,12 @@ fu_util_get_releases (FuUtilPrivate *priv, gchar **values, GError **error)
/* TRANSLATORS: section header for release version number */
fu_util_print_data (_("Version"), fwupd_release_get_version (rel));
+ /* TRANSLATORS: section header for the release name */
+ fu_util_print_data (_("Name"), fwupd_release_get_name (rel));
+
+ /* TRANSLATORS: section header for the release one line summary */
+ fu_util_print_data (_("Summary"), fwupd_release_get_summary (rel));
+
/* TRANSLATORS: section header for the remote the file is coming from */
fu_util_print_data (_("Remote"), fwupd_release_get_remote_id (rel));
@@ -1074,6 +1080,12 @@ fu_util_get_updates (FuUtilPrivate *priv, gchar **values, GError **error)
fu_util_print_data (_("Update Version"),
fwupd_release_get_version (rel));
+ /* TRANSLATORS: section header for the release name */
+ fu_util_print_data (_("Update Name"), fwupd_release_get_name (rel));
+
+ /* TRANSLATORS: section header for the release one line summary */
+ fu_util_print_data (_("Update Summary"), fwupd_release_get_summary (rel));
+
/* TRANSLATORS: section header for remote ID, e.g. lvfs-testing */
fu_util_print_data (_("Update Remote ID"),
fwupd_release_get_remote_id (rel));
--
2.14.3

View File

@ -21,11 +21,14 @@
Summary: Firmware update daemon
Name: fwupd
Version: 1.0.3
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2+
URL: https://github.com/hughsie/fwupd
Source0: http://people.freedesktop.org/~hughsient/releases/%{name}-%{version}.tar.xz
# already upstream
Patch0: 0001-Fix-firmware-downloading-using-gnome-software-compil.patch
BuildRequires: docbook-utils
BuildRequires: gettext
BuildRequires: glib2-devel >= %{glib2_version}
@ -117,6 +120,7 @@ Data files for installed tests.
%prep
%setup -q
%patch0 -p1 -b .fix-gnome-software
%build
@ -263,6 +267,9 @@ mkdir -p --mode=0700 $RPM_BUILD_ROOT%{_localstatedir}/lib/fwupd/gnupg
%{_datadir}/installed-tests/fwupd/*.py*
%changelog
* Fri Jan 12 2018 Richard Hughes <richard@hughsie.com> 1.0.3-2
- Backport a patch that fixes applying firmware updates using gnome-software.
* Tue Jan 09 2018 Richard Hughes <richard@hughsie.com> 1.0.3-1
- New upstream release
- Add a new plugin to add support for CSR "Driverless DFU"