[gnome-software: 9/11] external-appstream: Move plugin into GsPluginLoader
- From: Milan Crha <mcrha src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software: 9/11] external-appstream: Move plugin into GsPluginLoader
- Date: Thu, 10 Jun 2021 12:20:06 +0000 (UTC)
commit 848c2da5698c8febd9253ccad560620704ded1b5
Author: Philip Withnall <pwithnall endlessos org>
Date: Wed May 19 17:03:51 2021 +0100
external-appstream: Move plugin into GsPluginLoader
The `external-appstream` plugin is the only one which is ordered before
the `appstream` plugin in the plugins graph. By removing it, it becomes
possible to move the `appstream` plugin itself into the core of
gnome-software. In turn, this will reduce interactions between plugins,
which will make the plugin threading model easier to modify in future.
The `external_appstream` Meson option continues to allow the external
appstream functionality (and `gs-install-appstream` helper binary) to be
disabled as before.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
.../gs-install-appstream.c | 0
gs-install-appstream/meson.build | 18 +++++++++++
.../gs-external-appstream-utils.c | 0
.../gs-external-appstream-utils.h | 0
lib/gs-plugin-loader.c | 13 ++++++++
lib/meson.build | 2 ++
meson.build | 4 +++
.../gs-plugin-external-appstream.c | 35 ----------------------
plugins/external-appstream/meson.build | 35 ----------------------
plugins/meson.build | 3 --
po/POTFILES.in | 3 +-
11 files changed, 38 insertions(+), 75 deletions(-)
---
diff --git a/plugins/external-appstream/gs-install-appstream.c b/gs-install-appstream/gs-install-appstream.c
similarity index 100%
rename from plugins/external-appstream/gs-install-appstream.c
rename to gs-install-appstream/gs-install-appstream.c
diff --git a/gs-install-appstream/meson.build b/gs-install-appstream/meson.build
new file mode 100644
index 000000000..57d7f9a07
--- /dev/null
+++ b/gs-install-appstream/meson.build
@@ -0,0 +1,18 @@
+executable(
+ 'gnome-software-install-appstream',
+ sources : [
+ 'gs-install-appstream.c',
+ ],
+ dependencies : [
+ gio_unix,
+ libgnomesoftware_dep,
+ libxmlb,
+ ],
+ include_directories : [
+ include_directories('..'),
+ include_directories('../lib'),
+ ],
+ c_args : ['-DG_LOG_DOMAIN="GsInstallAppstream"'],
+ install : true,
+ install_dir : get_option('libexecdir'),
+)
diff --git a/plugins/external-appstream/gs-external-appstream-utils.c b/lib/gs-external-appstream-utils.c
similarity index 100%
rename from plugins/external-appstream/gs-external-appstream-utils.c
rename to lib/gs-external-appstream-utils.c
diff --git a/plugins/external-appstream/gs-external-appstream-utils.h b/lib/gs-external-appstream-utils.h
similarity index 100%
rename from plugins/external-appstream/gs-external-appstream-utils.h
rename to lib/gs-external-appstream-utils.h
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index a4e8a5ad7..f1deb0f36 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -23,6 +23,7 @@
#include "gs-app-list-private.h"
#include "gs-category-manager.h"
#include "gs-category-private.h"
+#include "gs-external-appstream-utils.h"
#include "gs-ioprio.h"
#include "gs-os-release.h"
#include "gs-plugin-loader.h"
@@ -1113,6 +1114,18 @@ gs_plugin_loader_run_results (GsPluginLoaderHelper *helper,
/* Refining is done separately as it’s a special action */
g_assert (action != GS_PLUGIN_ACTION_REFINE);
+ /* Download updated external appstream before anything else */
+#ifdef ENABLE_EXTERNAL_APPSTREAM
+ if (action == GS_PLUGIN_ACTION_REFRESH) {
+ /* FIXME: Using plugin_loader->plugins->pdata[0] is a hack; see
+ * comment below for details. */
+ if (!gs_external_appstream_refresh (plugin_loader->plugins->pdata[0],
+ gs_plugin_job_get_age (helper->plugin_job),
+ cancellable, error))
+ return FALSE;
+ }
+#endif
+
/* run each plugin */
for (guint i = 0; i < plugin_loader->plugins->len; i++) {
GsPlugin *plugin = g_ptr_array_index (plugin_loader->plugins, i);
diff --git a/lib/meson.build b/lib/meson.build
index dcc40871f..92da51389 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -11,6 +11,7 @@ libgnomesoftware_public_headers = [
'gs-category.h',
'gs-category-manager.h',
'gs-desktop-data.h',
+ 'gs-external-appstream-utils.h',
'gs-icon.h',
'gs-ioprio.h',
'gs-key-colors.h',
@@ -81,6 +82,7 @@ libgnomesoftware = library(
'gs-category-manager.c',
'gs-debug.c',
'gs-desktop-data.c',
+ 'gs-external-appstream-utils.c',
'gs-icon.c',
'gs-ioprio.c',
'gs-ioprio.h',
diff --git a/meson.build b/meson.build
index 75e5afa67..8d00084d3 100644
--- a/meson.build
+++ b/meson.build
@@ -261,6 +261,7 @@ conf.set_quoted('LOCALSTATEDIR',
conf.set_quoted('LIBEXECDIR',
join_paths(get_option('prefix'),
get_option('libexecdir')))
+conf.set('ENABLE_EXTERNAL_APPSTREAM', get_option('external_appstream'))
configure_file(
output : 'config.h',
configuration : conf
@@ -281,6 +282,9 @@ subdir('data')
subdir('lib')
subdir('plugins')
subdir('src')
+if get_option('external_appstream')
+ subdir('gs-install-appstream')
+endif
subdir('po')
subdir('doc')
diff --git a/plugins/meson.build b/plugins/meson.build
index 666f36758..01fc42f17 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -38,6 +38,3 @@ endif
if get_option('snap')
subdir('snap')
endif
-if get_option('external_appstream')
- subdir('external-appstream')
-endif
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 660a91250..7423fa63e 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,6 +1,7 @@
data/appdata/org.gnome.Software.appdata.xml.in
data/org.gnome.software.external-appstream.policy.in.in
data/org.gnome.software.gschema.xml
+gs-install-appstream/gs-install-appstream.c
src/gnome-software-local-file.desktop.in
lib/gs-app.c
src/gs-app-addon-row.c
@@ -86,8 +87,6 @@ src/org.gnome.Software.desktop.in
plugins/core/gs-plugin-generic-updates.c
plugins/core/gs-plugin-rewrite-resource.c
plugins/eos-updater/gs-plugin-eos-updater.c
-plugins/external-appstream/gs-install-appstream.c
-plugins/external-appstream/gs-plugin-external-appstream.c
plugins/fedora-pkgdb-collections/gs-plugin-fedora-pkgdb-collections.c
plugins/flatpak/org.gnome.Software.Plugin.Flatpak.metainfo.xml.in
plugins/flatpak/gs-flatpak.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]