From e305a15bf93a0b95f370b764001a3a34ff0f3af2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= Date: Tue, 5 Oct 2021 11:24:18 +0100 Subject: Warn about unexpected files in the database MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To help remind users that files must end in .xml, warn about any unusually named files. There are a couple of files we should not warn about since we expect them to be present - VERSION - LICENSE The entire 'schema' sub-directory should be ignored. Common editor backups "~" and ".bak" should be ignored. Signed-off-by: Daniel P. Berrangé --- osinfo/osinfo_loader.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c index 9ec99cd..ca2c765 100644 --- a/osinfo/osinfo_loader.c +++ b/osinfo/osinfo_loader.c @@ -2349,9 +2349,18 @@ static void osinfo_loader_find_files(OsinfoLoader *loader, type = g_file_info_get_attribute_uint32(info, G_FILE_ATTRIBUTE_STANDARD_TYPE); if (type == G_FILE_TYPE_DIRECTORY) { - osinfo_loader_find_files(loader, base, ent, entries, FALSE, &error); - } else if (g_str_has_suffix(name, ".xml")) { - osinfo_loader_entity_files_add_path(entries, base, ent); + if (!g_str_equal(name, "schema")) + osinfo_loader_find_files(loader, base, ent, entries, FALSE, &error); + } else { + if (g_str_has_suffix(name, ".xml")) { + osinfo_loader_entity_files_add_path(entries, base, ent); + } else if (!g_str_equal(name, "LICENSE") && + !g_str_equal(name, "VERSION") && + !g_str_has_suffix(name, "~") && + !g_str_has_suffix(name, ".bak")) { + g_autofree gchar *path = g_file_get_path(ent); + g_printerr("Ignoring %s with missing '.xml' extension\n", path); + } } g_object_unref(ent); g_object_unref(info); -- cgit v1.2.1