[gnome-software/wip/temp/ubuntu-xenial-rebased-corrected: 166/331] Ignore .deb packages in the libs section



commit f48f0f71b3f953b0eeaf22f7b5f1fa0d1ee76ad9
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon Mar 21 14:12:04 2016 +1300

    Ignore .deb packages in the libs section

 src/plugins/gs-plugin-apt.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.c b/src/plugins/gs-plugin-apt.c
index 828ef96..7c7cddf 100644
--- a/src/plugins/gs-plugin-apt.c
+++ b/src/plugins/gs-plugin-apt.c
@@ -30,6 +30,7 @@
 
 typedef struct {
        gchar *name;
+       gchar *section;
        gchar *installed_version;
        gchar *update_version;
        gint installed_size;
@@ -67,6 +68,7 @@ free_package_info (gpointer data)
 {
        PackageInfo *info = data;
        g_free (info->name);
+       g_free (info->section);
        g_free (info->installed_version);
        g_free (info->update_version);
        g_slice_free (PackageInfo, info);
@@ -315,6 +317,9 @@ field_cb (const gchar *name, gsize name_length, const gchar *value, gsize value_
                        data->current_installed = TRUE;
                        data->plugin->priv->installed_packages = g_list_append 
(data->plugin->priv->installed_packages, data->current_info);
                }
+       } else if (strncmp (name, "Section", name_length) == 0) {
+               g_free (data->current_info->section);
+               data->current_info->section = g_strndup (value, value_length);
        } else if (strncmp (name, "Installed-Size", name_length) == 0) {
                data->current_info->installed_size = atoi (value);
        } else if (strncmp (name, "Version", name_length) == 0) {
@@ -397,6 +402,7 @@ get_changelog (GsPlugin *plugin, GsApp *app)
        else
                source_prefix = g_strdup_printf ("%c", binary_source[0]);
        uri = g_strdup_printf ("http://changelogs.ubuntu.com/changelogs/binary/%s/%s/%s/changelog";, 
source_prefix, binary_source, update_version);
+       g_printerr ("%s\n", uri);
        msg = soup_message_new (SOUP_METHOD_GET, uri);
 
        status_code = soup_session_send_message (plugin->soup_session, msg);
@@ -503,6 +509,15 @@ gs_plugin_refine (GsPlugin *plugin,
        return TRUE;
 }
 
+static gboolean
+is_allowed_section (PackageInfo *info)
+{
+       const gchar *section_blacklist[] = { "libs", NULL };
+
+       /* There's no valid apps in the libs section */
+       return info->section == NULL || !g_strv_contains (section_blacklist, info->section);
+}
+
 gboolean
 gs_plugin_add_installed (GsPlugin *plugin,
                         GList **list,
@@ -525,6 +540,9 @@ gs_plugin_add_installed (GsPlugin *plugin,
                PackageInfo *info = link->data;
                g_autoptr(GsApp) app = NULL;
 
+               if (!is_allowed_section (info))
+                       continue;
+
                app = gs_app_new (info->name);
                // FIXME: Since appstream marks all packages as owned by PackageKit and we are replacing 
PackageKit we need to accept those packages
                gs_app_set_management_plugin (app, "PackageKit");
@@ -803,6 +821,9 @@ gs_plugin_add_updates (GsPlugin *plugin,
                PackageInfo *info = link->data;
                g_autoptr(GsApp) app = NULL;
 
+               if (!is_allowed_section (info))
+                       continue;
+
                app = gs_app_new (info->name);
                // FIXME: Since appstream marks all packages as owned by PackageKit and we are replacing 
PackageKit we need to accept those packages
                gs_app_set_management_plugin (app, "PackageKit");


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