[PATCH db-tools 10/11] Filter list of files included in created tar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---
 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

_______________________________________________
Libosinfo mailing list
Libosinfo@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libosinfo



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux