[gnome-software/wip/ubuntu-zesty] apt: Adopt system packages



commit acc4a0f7b02dfe61534c2de07900d4f81dcb4e1c
Author: Iain Lane <iain orangesquash org uk>
Date:   Tue Dec 6 13:22:46 2016 +0000

    apt: Adopt system packages
    
    Previously the PackageKit plugin would set the management plugin on
    GsApps and we wanted to install those, but this doesn't happen any more.
    Now we need to set the management plugin when adopting GsApps.
    
    We conflict with PackageKit, so there should be no issue here.
    
    https://bugs.launchpad.net/ubuntu/+source/gnome-software/+bug/1640741

 src/plugins/gs-plugin-apt.cc |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/gs-plugin-apt.cc b/src/plugins/gs-plugin-apt.cc
index 463242f..18711e4 100644
--- a/src/plugins/gs-plugin-apt.cc
+++ b/src/plugins/gs-plugin-apt.cc
@@ -144,6 +144,15 @@ gs_plugin_destroy (GsPlugin *plugin)
        g_mutex_clear (&priv->mutex);
 }
 
+void
+gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
+{
+       if (gs_app_get_bundle_kind (app) == AS_BUNDLE_KIND_PACKAGE &&
+           gs_app_get_scope (app) == AS_APP_SCOPE_SYSTEM) {
+               gs_app_set_management_plugin (app, "apt");
+               return;
+       }
+}
 
 static void
 read_list_file_cb (GObject *object,
@@ -855,11 +864,7 @@ app_is_ours (GsApp *app)
 {
        const gchar *management_plugin = gs_app_get_management_plugin (app);
 
-       // FIXME: Since appstream marks all packages as owned by PackageKit and
-       // we are replacing PackageKit we need to accept those packages
-       const gchar *our_management_plugins[] = { "PackageKit", "apt", NULL };
-
-       return g_strv_contains (our_management_plugins, management_plugin);
+       return g_strcmp0 (management_plugin, "apt") == 0;
 }
 
 gboolean


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