diff options
author | Richard Hughes <richard@hughsie.com> | 2014-06-19 17:20:38 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2014-06-19 18:23:41 +0100 |
commit | b8dd29212a30efc71e490e821d7a2d9266ed88c2 (patch) | |
tree | 4171045994d08e0ae02979bd860ecc04fc637cc8 | |
parent | 45602f0e77a25a62b3af5e1b4c7a0cd815e54415 (diff) | |
download | appstream-glib-b8dd29212a30efc71e490e821d7a2d9266ed88c2.tar.gz |
Do not write X-Kudo-RecentRelease for new versions of the metadata
Software centers can trivially work this out, e.g. something like:
https://git.gnome.org/browse/gnome-software/commit/?id=ad6c09c2eadb903151f3eb14a3962da160795dad
-rw-r--r-- | libappstream-builder/asb-context.c | 17 | ||||
-rw-r--r-- | libappstream-builder/asb-context.h | 1 | ||||
-rw-r--r-- | libappstream-builder/asb-plugin.h | 1 | ||||
-rw-r--r-- | libappstream-builder/plugins/asb-plugin-hardcoded.c | 20 |
4 files changed, 30 insertions, 9 deletions
diff --git a/libappstream-builder/asb-context.c b/libappstream-builder/asb-context.c index 75de2d3..c5d32b1 100644 --- a/libappstream-builder/asb-context.c +++ b/libappstream-builder/asb-context.c @@ -410,6 +410,23 @@ asb_context_get_add_cache_id (AsbContext *ctx) } /** + * asb_context_get_api_version: + * @ctx: A #AsbContext + * + * Gets the target metadata API version. + * + * Returns: floating point + * + * Since: 0.1.0 + **/ +gdouble +asb_context_get_api_version (AsbContext *ctx) +{ + AsbContextPrivate *priv = GET_PRIVATE (ctx); + return priv->api_version; +} + +/** * asb_context_get_temp_dir: * @ctx: A #AsbContext * diff --git a/libappstream-builder/asb-context.h b/libappstream-builder/asb-context.h index 2da3115..0462d4d 100644 --- a/libappstream-builder/asb-context.h +++ b/libappstream-builder/asb-context.h @@ -92,6 +92,7 @@ const gchar *asb_context_get_temp_dir (AsbContext *ctx); gboolean asb_context_get_add_cache_id (AsbContext *ctx); gboolean asb_context_get_extra_checks (AsbContext *ctx); gboolean asb_context_get_use_package_cache (AsbContext *ctx); +gdouble asb_context_get_api_version (AsbContext *ctx); gboolean asb_context_setup (AsbContext *ctx, GError **error); diff --git a/libappstream-builder/asb-plugin.h b/libappstream-builder/asb-plugin.h index 7eaafc4..274aca7 100644 --- a/libappstream-builder/asb-plugin.h +++ b/libappstream-builder/asb-plugin.h @@ -44,6 +44,7 @@ struct AsbPlugin { gboolean enabled; gchar *name; AsbPluginPrivate *priv; + AsbContext *ctx; }; typedef enum { diff --git a/libappstream-builder/plugins/asb-plugin-hardcoded.c b/libappstream-builder/plugins/asb-plugin-hardcoded.c index 5443875..ba42dce 100644 --- a/libappstream-builder/plugins/asb-plugin-hardcoded.c +++ b/libappstream-builder/plugins/asb-plugin-hardcoded.c @@ -261,15 +261,17 @@ asb_plugin_process_app (AsbPlugin *plugin, /* has the application been updated in the last year */ releases = as_app_get_releases (AS_APP (app)); - for (i = 0; i < releases->len; i++) { - release = g_ptr_array_index (releases, i); - secs = (g_get_real_time () / G_USEC_PER_SEC) - - as_release_get_timestamp (release); - days = secs / (60 * 60 * 24); - if (days < 365) { - as_app_add_metadata (AS_APP (app), - "X-Kudo-RecentRelease", "", -1); - break; + if (asb_context_get_api_version (plugin->ctx) <= 0.8) { + for (i = 0; i < releases->len; i++) { + release = g_ptr_array_index (releases, i); + secs = (g_get_real_time () / G_USEC_PER_SEC) - + as_release_get_timestamp (release); + days = secs / (60 * 60 * 24); + if (days < 365) { + as_app_add_metadata (AS_APP (app), + "X-Kudo-RecentRelease", "", -1); + break; + } } } |