[gnome-software/jrocha/fix-install-queue: 1/8] Save/load install queue using unique IDs
- From: Joaquim Rocha <jrocha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/jrocha/fix-install-queue: 1/8] Save/load install queue using unique IDs
- Date: Fri, 16 Feb 2018 13:32:33 +0000 (UTC)
commit 22832b20bca1cb3236ea8e0fd079227b45427fad
Author: Joaquim Rocha <jrocha endlessm com>
Date: Thu Feb 15 23:06:57 2018 +0100
Save/load install queue using unique IDs
When saving and loading the apps in the installation queue, unique IDs
should be used instead of simple IDs. The reason for this is that if
only simple IDs are used, then there's no way of checking which apps
really need to be installed (e.g. there can be an app with the same
simple ID coming from Flatpak or from PackageKit).
https://phabricator.endlessm.com/T21194
lib/gs-plugin-loader.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index d82c68ea..78d32ff2 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -1750,9 +1750,15 @@ load_install_queue (GsPluginLoader *plugin_loader, GError **error)
names = g_strsplit (contents, "\n", 0);
for (guint i = 0; names[i] != NULL; i++) {
g_autoptr(GsApp) app = NULL;
- if (strlen (names[i]) == 0)
+ const gchar *id = names[i];
+
+ if (strlen (id) == 0)
+ continue;
+ if (!as_utils_unique_id_valid (id))
continue;
- app = gs_app_new (names[i]);
+
+ app = gs_app_new (NULL);
+ gs_app_set_from_unique_id (app, id);
gs_app_set_state (app, AS_APP_STATE_QUEUED_FOR_INSTALL);
gs_app_list_add (list, app);
}
@@ -1798,7 +1804,7 @@ save_install_queue (GsPluginLoader *plugin_loader)
GsApp *app;
app = g_ptr_array_index (pending_apps, i);
if (gs_app_get_state (app) == AS_APP_STATE_QUEUED_FOR_INSTALL) {
- g_string_append (s, gs_app_get_id (app));
+ g_string_append (s, gs_app_get_unique_id (app));
g_string_append_c (s, '\n');
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]