[gnome-software: 18/72] packagekit: Inline gs_plugin_packagekit_refine_name_to_id()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 18/72] packagekit: Inline gs_plugin_packagekit_refine_name_to_id()
- Date: Wed, 15 Dec 2021 13:00:54 +0000 (UTC)
commit 7a7dd1a4158491dfef2f933e3f52c7ec190bc9ad
Author: Philip Withnall <pwithnall endlessos org>
Date: Fri Oct 22 16:42:47 2021 +0100
packagekit: Inline gs_plugin_packagekit_refine_name_to_id()
This introduces no functional changes, but will make upcoming
refactoring simpler.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1472
plugins/packagekit/gs-plugin-packagekit.c | 72 +++++++++++++------------------
1 file changed, 30 insertions(+), 42 deletions(-)
---
diff --git a/plugins/packagekit/gs-plugin-packagekit.c b/plugins/packagekit/gs-plugin-packagekit.c
index 90f085cb4..6f5e370c9 100644
--- a/plugins/packagekit/gs-plugin-packagekit.c
+++ b/plugins/packagekit/gs-plugin-packagekit.c
@@ -1401,46 +1401,6 @@ gs_plugin_packagekit_refine_valid_package_name (const gchar *source)
return TRUE;
}
-static gboolean
-gs_plugin_packagekit_refine_name_to_id (GsPluginPackagekit *self,
- GsAppList *list,
- GsPluginRefineFlags flags,
- GCancellable *cancellable,
- GError **error)
-{
- g_autoptr(GsAppList) resolve_all = gs_app_list_new ();
- for (guint i = 0; i < gs_app_list_length (list); i++) {
- GPtrArray *sources;
- GsApp *app = gs_app_list_index (list, i);
- const gchar *tmp;
- if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD))
- continue;
- if (!gs_app_has_management_plugin (app, NULL) &&
- !gs_app_has_management_plugin (app, GS_PLUGIN (self)))
- continue;
- sources = gs_app_get_sources (app);
- if (sources->len == 0)
- continue;
- tmp = g_ptr_array_index (sources, 0);
- if (!gs_plugin_packagekit_refine_valid_package_name (tmp))
- continue;
- if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN ||
- gs_plugin_refine_requires_package_id (app, flags) ||
- gs_plugin_refine_requires_origin (app, flags) ||
- gs_plugin_refine_requires_version (app, flags)) {
- gs_app_list_add (resolve_all, app);
- }
- }
- if (gs_app_list_length (resolve_all) > 0) {
- if (!gs_plugin_packagekit_resolve_packages (self,
- resolve_all,
- cancellable,
- error))
- return FALSE;
- }
- return TRUE;
-}
-
static gboolean
gs_plugin_packagekit_refine_filename_to_id (GsPluginPackagekit *self,
GsAppList *list,
@@ -1537,6 +1497,7 @@ gs_plugin_refine (GsPlugin *plugin,
GError **error)
{
GsPluginPackagekit *self = GS_PLUGIN_PACKAGEKIT (plugin);
+ g_autoptr(GsAppList) resolve_all = gs_app_list_new ();
/* when we need the cannot-be-upgraded applications, we implement this
* by doing a UpgradeSystem(SIMULATE) which adds the removed packages
@@ -1589,8 +1550,35 @@ gs_plugin_refine (GsPlugin *plugin,
}
/* can we resolve in one go? */
- if (!gs_plugin_packagekit_refine_name_to_id (self, list, flags, cancellable, error))
- return FALSE;
+ for (guint i = 0; i < gs_app_list_length (list); i++) {
+ GPtrArray *sources;
+ GsApp *app = gs_app_list_index (list, i);
+ const gchar *tmp;
+ if (gs_app_has_quirk (app, GS_APP_QUIRK_IS_WILDCARD))
+ continue;
+ if (!gs_app_has_management_plugin (app, NULL) &&
+ !gs_app_has_management_plugin (app, GS_PLUGIN (self)))
+ continue;
+ sources = gs_app_get_sources (app);
+ if (sources->len == 0)
+ continue;
+ tmp = g_ptr_array_index (sources, 0);
+ if (!gs_plugin_packagekit_refine_valid_package_name (tmp))
+ continue;
+ if (gs_app_get_state (app) == GS_APP_STATE_UNKNOWN ||
+ gs_plugin_refine_requires_package_id (app, flags) ||
+ gs_plugin_refine_requires_origin (app, flags) ||
+ gs_plugin_refine_requires_version (app, flags)) {
+ gs_app_list_add (resolve_all, app);
+ }
+ }
+ if (gs_app_list_length (resolve_all) > 0) {
+ if (!gs_plugin_packagekit_resolve_packages (self,
+ resolve_all,
+ cancellable,
+ error))
+ return FALSE;
+ }
/* set the package-id for an installed desktop file */
if (!gs_plugin_packagekit_refine_filename_to_id (self, list, flags, cancellable, error))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]