[gnome-software] Allow the metadata to select the minimum required client version
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Allow the metadata to select the minimum required client version
- Date: Fri, 23 Dec 2016 11:01:37 +0000 (UTC)
commit aa1179f69a68d55571bee9974663474e78c44c5d
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 | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-appstream.c b/src/plugins/gs-appstream.c
index bb5e24f..7af6954 100644
--- a/src/plugins/gs-appstream.c
+++ b/src/plugins/gs-appstream.c
@@ -511,6 +511,10 @@ gs_appstream_refine_app (GsPlugin *plugin,
AsApp *item,
GError **error)
{
+#if AS_CHECK_VERSION(0,6,7)
+ AsRequire *req;
+ g_autoptr(GError) error_local = NULL;
+#endif
GHashTable *urls;
GPtrArray *array;
GPtrArray *pkgnames;
@@ -538,6 +542,23 @@ gs_appstream_refine_app (GsPlugin *plugin,
gs_app_set_state (app, as_app_get_state (item));
}
+#if AS_CHECK_VERSION(0,6,7)
+ /* 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;
+ }
+ }
+#endif
+
/* 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]