[Libosinfo] [PATCH db-tools 10/11] Filter list of files included in created tar
Daniel P. Berrange
berrange at redhat.com
Tue Jun 28 15:52:36 UTC 2016
Don't include hidden files or editor backup files in the
exported tar. Also whitelist to only include files with
a .xml or .rng suffix. This facilitates running against
a local git repo which may have other files such as the
automake/autoconf .in and .am files.
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
tools/osinfo-db-export.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/tools/osinfo-db-export.c b/tools/osinfo-db-export.c
index 52792a7..4321ae4 100644
--- a/tools/osinfo-db-export.c
+++ b/tools/osinfo-db-export.c
@@ -206,6 +206,17 @@ static int osinfo_db_export_create_file(const gchar *prefix,
switch (type) {
case G_FILE_TYPE_REGULAR:
case G_FILE_TYPE_SYMBOLIC_LINK:
+ if (g_file_info_get_is_backup(info) ||
+ g_file_info_get_is_hidden(info)) {
+ ret = 0;
+ goto cleanup;
+ }
+ if (!g_str_has_suffix(entpath, ".rng") &&
+ !g_str_has_suffix(entpath, ".xml")) {
+ ret = 0;
+ goto cleanup;
+ }
+
if (verbose) {
g_print("%s: r %s\n", argv0, entpath);
}
--
2.7.4
More information about the Libosinfo
mailing list