[Libosinfo] [PATCH 2/2] Add simple 'check' target to validate XML files

Pino Toscano ptoscano at redhat.com
Thu Mar 16 10:21:55 UTC 2017


Add a very simple 'check' target; its only job is to validate every XML
data file against the RNG schema, so there is no risk to ship files that
do not conform the it.
---
 Makefile | 9 +++++++++
 README   | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/Makefile b/Makefile
index 6ff9b5c..a7a5c68 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,8 @@ ARCHIVE = osinfo-db-$(TODAY).tar.xz
 
 ZANATA = zanata-cli
 
+XMLLINT = xmllint
+
 V = 0
 
 V_I18N = $(V_I18N_$(V))
@@ -114,3 +116,10 @@ update-po:
           fi; \
         done
 
+check: $(DATA_FILES) $(SCHEMA_FILES)
+	for xml in `find data -name '*.xml' | sort`; do \
+	  if ! $(XMLLINT) --relaxng data/schema/osinfo.rng --noout $$xml; then \
+	    exit 1; \
+	  fi; \
+	done
+
diff --git a/README b/README
index b2822cb..a352115 100644
--- a/README
+++ b/README
@@ -17,6 +17,8 @@ Dependencies
 - Required:
   - osinfo-db-tools
   - intltool
+- Optional:
+  - xmllint (from libxml2) -- for testing
 
 Patch submissions
 =================
-- 
2.9.3




More information about the Libosinfo mailing list