From f32a4e4c10e9f6b6bfb2a6a671d6d1802d4efe41 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Fri, 13 Jun 2014 16:24:45 +0100 Subject: Allow validating AppStream files using appstream-util --- client/as-util.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'client') diff --git a/client/as-util.c b/client/as-util.c index c8ad541..7ef0854 100644 --- a/client/as-util.c +++ b/client/as-util.c @@ -952,6 +952,20 @@ as_util_validate_file (const gchar *filename, _cleanup_object_unref_ AsApp *app = NULL; _cleanup_ptrarray_unref_ GPtrArray *probs = NULL; + /* is AppStream */ + if (g_str_has_suffix (filename, ".xml.gz")) { + gboolean ret; + _cleanup_object_unref_ AsStore *store; + _cleanup_object_unref_ GFile *file; + file = g_file_new_for_path (filename); + store = as_store_new (); + ret = as_store_from_file (store, file, NULL, NULL, error); + if (!ret) + return FALSE; + g_print ("%s: %s\n", filename, _("OK")); + return TRUE; + } + /* load file */ app = as_app_new (); g_print ("%s: ", filename); -- cgit v1.2.1