[gnome-software/gnome-3-26] fwupd: Raise the required dep required



commit 1b0617319302347ca6158669c98a2f32f1829092
Author: Richard Hughes <richard hughsie com>
Date:   Sat Sep 9 19:28:53 2017 +0100

    fwupd: Raise the required dep required

 meson.build                     |    2 +-
 plugins/fwupd/gs-plugin-fwupd.c |   68 ++------------------------------------
 2 files changed, 5 insertions(+), 65 deletions(-)
---
diff --git a/meson.build b/meson.build
index 5abb8ca..574ffbb 100644
--- a/meson.build
+++ b/meson.build
@@ -144,7 +144,7 @@ if get_option('enable-packagekit')
 endif
 
 if get_option('enable-fwupd')
-  fwupd = dependency('fwupd', version : '>= 0.9.3')
+  fwupd = dependency('fwupd', version : '>= 0.9.7')
 endif
 
 if get_option('enable-flatpak')
diff --git a/plugins/fwupd/gs-plugin-fwupd.c b/plugins/fwupd/gs-plugin-fwupd.c
index c57bb63..6d6fe1f 100644
--- a/plugins/fwupd/gs-plugin-fwupd.c
+++ b/plugins/fwupd/gs-plugin-fwupd.c
@@ -370,7 +370,6 @@ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
        gs_app_add_category (app, "System");
        gs_fwupd_app_set_device_id (app, fwupd_device_get_id (dev));
 
-#if FWUPD_CHECK_VERSION(0,9,7)
        /* something can be done */
        if (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_UPDATABLE))
                gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
@@ -383,16 +382,6 @@ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
        /* reboot required to apply update */
        if (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_NEEDS_REBOOT))
                gs_app_add_quirk (app, AS_APP_QUIRK_NEEDS_REBOOT);
-#else
-       /* something can be done */
-       if (fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE) ||
-           fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_OFFLINE))
-               gs_app_set_state (app, AS_APP_STATE_UPDATABLE_LIVE);
-
-       /* can be done live */
-       if (!fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_ALLOW_ONLINE))
-               gs_app_add_quirk (app, AS_APP_QUIRK_NEEDS_REBOOT);
-#endif
 
        /* is removable */
        if (!fwupd_device_has_flag (dev, FWUPD_DEVICE_FLAG_INTERNAL))
@@ -479,37 +468,6 @@ gs_plugin_fwupd_new_app_from_results (GsPlugin *plugin, FwupdResult *res)
        return app;
 }
 
-#if !FWUPD_CHECK_VERSION(0,9,4)
-static GChecksumType
-fwupd_checksum_guess_kind (const gchar *checksum)
-{
-       guint len;
-       if (checksum == NULL)
-               return G_CHECKSUM_SHA1;
-       len = strlen (checksum);
-       if (len == 32)
-               return G_CHECKSUM_MD5;
-       if (len == 40)
-               return G_CHECKSUM_SHA1;
-       if (len == 64)
-               return G_CHECKSUM_SHA256;
-       if (len == 128)
-               return G_CHECKSUM_SHA512;
-       return G_CHECKSUM_SHA1;
-}
-
-static const gchar *
-fwupd_checksum_get_by_kind (GPtrArray *checksums, GChecksumType kind)
-{
-       for (guint i = 0; i < checksums->len; i++) {
-               const gchar *checksum = g_ptr_array_index (checksums, i);
-               if (fwupd_checksum_guess_kind (checksum) == kind)
-                       return checksum;
-       }
-       return NULL;
-}
-#endif
-
 static gboolean
 gs_plugin_add_update_app (GsPlugin *plugin,
                          GsAppList *list,
@@ -751,12 +709,12 @@ gs_plugin_fwupd_refresh_remote (GsPlugin *plugin,
 {
        GsPluginData *priv = gs_plugin_get_data (plugin);
        const gchar *checksum_old;
+       const gchar *url_asc = NULL;
+       const gchar *url = NULL;
        g_autoptr(GError) error_local = NULL;
        g_autofree gchar *filename = NULL;
        g_autofree gchar *filename_asc = NULL;
        g_autofree gchar *checksum = NULL;
-       g_autofree gchar *url = NULL;
-       g_autofree gchar *url_asc = NULL;
        g_autoptr(GBytes) data = NULL;
        g_autoptr(GsApp) app_dl = gs_app_new (gs_plugin_get_name (plugin));
 
@@ -776,13 +734,8 @@ gs_plugin_fwupd_refresh_remote (GsPlugin *plugin,
                                                    GS_UTILS_CACHE_FLAG_WRITEABLE,
                                                    error);
        if (cache_age > 0) {
-#if FWUPD_CHECK_VERSION(0,9,5)
                guint64 age = fwupd_remote_get_age (remote);
                guint tmp = age < G_MAXUINT ? (guint) age : G_MAXUINT;
-#else
-               g_autoptr(GFile) file = g_file_new_for_path (filename_asc);
-               guint tmp = gs_utils_get_file_age (file);
-#endif
                if (tmp < cache_age) {
                        g_debug ("%s is only %u seconds old, so ignoring refresh",
                                 filename_asc, tmp);
@@ -791,11 +744,7 @@ gs_plugin_fwupd_refresh_remote (GsPlugin *plugin,
        }
 
        /* download the signature first, it's smaller */
-#if FWUPD_CHECK_VERSION(0,9,7)
-       url_asc = g_strdup (fwupd_remote_get_metadata_uri_sig (remote));
-#else
-       url_asc = soup_uri_to_string (fwupd_remote_get_uri_asc (remote), FALSE);
-#endif
+       url_asc = fwupd_remote_get_metadata_uri_sig (remote);
        gs_app_set_summary_missing (app_dl,
                                    /* TRANSLATORS: status text when downloading */
                                    _("Downloading firmware update signature…"));
@@ -845,11 +794,7 @@ gs_plugin_fwupd_refresh_remote (GsPlugin *plugin,
        gs_app_set_summary_missing (app_dl,
                                    /* TRANSLATORS: status text when downloading */
                                    _("Downloading firmware update metadata…"));
-#if FWUPD_CHECK_VERSION(0,9,7)
-       url = g_strdup (fwupd_remote_get_metadata_uri (remote));
-#else
-       url = soup_uri_to_string (fwupd_remote_get_uri (remote), FALSE);
-#endif
+       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);
@@ -997,13 +942,8 @@ gs_plugin_fwupd_install (GsPlugin *plugin,
        g_set_object (&priv->app_current, app);
 
        /* only offline supported */
-#if FWUPD_CHECK_VERSION(0,9,7)
        if (gs_app_get_metadata_item (app, "fwupd::OnlyOffline") != NULL)
                install_flags |= FWUPD_INSTALL_FLAG_OFFLINE;
-#else
-       if (gs_app_has_quirk (app, AS_APP_QUIRK_NEEDS_REBOOT))
-               install_flags |= FWUPD_INSTALL_FLAG_OFFLINE;
-#endif
 
        gs_app_set_state (app, AS_APP_STATE_INSTALLING);
        if (!fwupd_client_install (priv->client, device_id,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]