[gnome-software/wip/kalev/gnome-3-22: 31/96] Allow the metadata to select the minimum required client version
- From: Kalev Lember <klember src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/kalev/gnome-3-22: 31/96] Allow the metadata to select the minimum required client version
- Date: Tue, 7 Mar 2017 16:26:26 +0000 (UTC)
commit e21c04094896cfb2cee083ceebf24977b51ed715
Author: Richard Hughes <richard hughsie com>
Date: Wed Dec 21 15:58:54 2016 +0000
Allow the metadata to select the minimum required client version
This allows us to have new markup specified in the AppData or AppStream XML:
<requires>
<id compare="ge" version="3.24.0">org.gnome.Software.desktop</id>
</requires>
If this <component> should only be shown in newer versions of gnome-software.
Be careful if you use this feature, as commits may be backported into older
releases.
src/plugins/gs-appstream.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index cbd2d5d..7a5051e 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -515,6 +515,8 @@ gs_appstream_refine_app (GsPlugin *plugin,
AsApp *item,
GError **error)
{
+ AsRequire *req;
+ g_autoptr(GError) error_local = NULL;
GHashTable *urls;
GPtrArray *pkgnames;
GPtrArray *kudos;
@@ -540,6 +542,21 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_set_state (app, as_app_get_state (item));
}
+ /* is compatible */
+ req = as_app_get_require_by_value (item,
+ AS_REQUIRE_KIND_ID,
+ "org.gnome.Software.desktop");
+ if (req != NULL) {
+ if (!as_require_version_compare (req, PACKAGE_VERSION, &error_local)) {
+ g_set_error (error,
+ GS_PLUGIN_ERROR,
+ GS_PLUGIN_ERROR_NOT_SUPPORTED,
+ "not for this gnome-software: %s",
+ error_local->message);
+ return FALSE;
+ }
+ }
+
/* types we can never launch */
switch (gs_app_get_kind (app)) {
case AS_APP_KIND_ADDON:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]