summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2014-06-13 16:24:45 +0100
committerRichard Hughes <richard@hughsie.com>2014-06-13 16:24:45 +0100
commitf32a4e4c10e9f6b6bfb2a6a671d6d1802d4efe41 (patch)
tree2c2789c89f60c596cf91f1f3ce5ef521f2537abb /client
parentc8da94a61228c9931a4f41cd20b63baa2bf95f93 (diff)
downloadappstream-glib-f32a4e4c10e9f6b6bfb2a6a671d6d1802d4efe41.tar.gz
Allow validating AppStream files using appstream-util
Diffstat (limited to 'client')
-rw-r--r--client/as-util.c14
1 files changed, 14 insertions, 0 deletions
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);