Since this file gets changed (and broken) rather often, introduce a
schema file so that the test suite can validate it.
---
docs/news.xml | 2 ++
docs/schemas/news.rng | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/virschematest.c | 2 ++
3 files changed, 77 insertions(+)
create mode 100644 docs/schemas/news.rng
diff --git a/docs/news.xml b/docs/news.xml
index 024b659e8..c2a2917c1 100644
--- a/docs/news.xml
+++ b/docs/news.xml
@@ -18,6 +18,8 @@
each <section> tag is required to contain at least one <change> tag.
Lines should be kept under 80 columns, and should not exceed 100 columns.
+
+ This file is validated against docs/news.rng schema.
-->
<libvirt>
diff --git a/docs/schemas/news.rng b/docs/schemas/news.rng
new file mode 100644
index 000000000..94a6870c1
--- /dev/null
+++ b/docs/schemas/news.rng
@@ -0,0 +1,73 @@
+<?xml version="1.0"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <ref name="libvirt"/>
+ </start>
+
+ <define name="libvirt">
+ <element name="libvirt">
+ <oneOrMore>
+ <ref name="release"/>
+ </oneOrMore>
+ </element>
+ </define>
+
+ <define name="release">
+ <element name="release">
+ <attribute name="version">
+ <data type="string">
+ <param name="pattern">v[0-9]+\.[0-9]+\.[0-9]+</param>
+ </data>
+ </attribute>
+ <attribute name="date">
+ <data type="string">
+ <param name="pattern">[0-9]{4}-[0-9]{2}-[0-9]{2}|unreleased</param>
+ </data>
+ </attribute>
+ <oneOrMore>
+ <ref name="section"/>
+ </oneOrMore>
+ </element>
+ </define>
+
+ <define name="section">
+ <element name="section">
+ <attribute name="title">
+ <data type="string"/>
+ </attribute>
+ <oneOrMore>
+ <ref name="change"/>
+ </oneOrMore>
+ </element>
+ </define>
+
+ <define name="change">
+ <element name="change">
+ <element name="summary">
+ <choice>
+ <data type="string">
+ <param name="pattern">\n[^\n]+\n +</param>
+ </data>
+ <empty/>
+ </choice>
+ </element>
+ <optional>
+ <element name="description">
+ <ref name="description"/>
+ </element>
+ </optional>
+ </element>
+ </define>
+
+ <define name="description">
+ <oneOrMore>
+ <choice>
+ <text/>
+ <element name="code">
+ <text/>
+ </element>
+ </choice>
+ </oneOrMore>
+ </define>
+
+</grammar>
diff --git a/tests/virschematest.c b/tests/virschematest.c
index beefabc96..e0e5872db 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -237,6 +237,8 @@ mymain(void)
DO_TEST("storagevol.rng", "storagevolxml2xmlin", "storagevolxml2xmlout",
"storagevolschemadata");
+ DO_TEST_FILE("news.rng", "../docs/news.xml");
+
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
--
2.12.1
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
On Tue, 2017-03-28 at 13:58 +0200, Peter Krempa wrote:
[...]
> @@ -18,6 +18,8 @@
> each <section> tag is required to contain at least one <change> tag.
>
> Lines should be kept under 80 columns, and should not exceed 100 columns.
> +
> + This file is validated against docs/news.rng schema.
It's actually docs/schemas/news.rng ;)
[...]
> @@ -0,0 +1,73 @@
> +<?xml version="1.0"?>
> +<grammar xmlns="http://relaxng.org/ns/structure/1.0" datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
I would put datatypeLibrary= right under xmlns=, but it's
okay either way.
I'm no RNG expert, but the schema looks fine to me.
> @@ -237,6 +237,8 @@ mymain(void)
> DO_TEST("storagevol.rng", "storagevolxml2xmlin", "storagevolxml2xmlout",
> "storagevolschemadata");
>
> + DO_TEST_FILE("news.rng", "../docs/news.xml");
You'll want to deal with how this interacts with VPATH
builds, as mentioned by Martin.
--
Andrea Bolognani / Red Hat / Virtualization
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
© 2016 - 2026 Red Hat, Inc.