schemas: move out of docs, fix no-docs build

schemas are used for more than just documentation,
virsh edit fails if schemas are not available.

Therefore, fix the no-docs build by moving schemas/
to the parsing code inside src/conf/.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Claudio Fontana 2022-03-22 09:18:57 +01:00 committed by Andrea Bolognani
parent ccffb60a9d
commit 76ddf2d2e3
30 changed files with 26 additions and 24 deletions

View File

@ -73,7 +73,7 @@ The first task is to define the public API. If the new API involves an
XML extension, you have to enhance the RelaxNG schema and document the
new elements or attributes:
``docs/schemas/domaincommon.rng docs/formatdomain.html.in``
``src/conf/schemas/domaincommon.rng docs/formatdomain.html.in``
If the API extension involves a new function, you have to add a
declaration in the public header, and arrange to export the function

View File

@ -333,8 +333,6 @@ subdir('js')
subdir('kbase')
subdir('logos')
subdir('manpages')
subdir('schemas')
foreach file : docs_assets
# This hack enables us to view the web pages

View File

@ -345,7 +345,7 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt,
g_autofree char *schemafile = NULL;
if (!(schemafile = virFileFindResource("cpu.rng",
abs_top_srcdir "/docs/schemas",
abs_top_srcdir "/src/conf/schemas",
PKGDATADIR "/schemas")))
return -1;

View File

@ -111,3 +111,5 @@ virt_conf_lib = static_library(
libvirt_libs += virt_conf_lib
conf_inc_dir = include_directories('.')
subdir('schemas')

View File

@ -1,4 +1,4 @@
docs_schema_files = [
schema_files = [
'basictypes.rng',
'capability.rng',
'cpu.rng',
@ -24,4 +24,4 @@ docs_schema_files = [
'storagevol.rng',
]
install_data(docs_schema_files, install_dir: pkgdatadir / 'schemas')
install_data(schema_files, install_dir: pkgdatadir / 'schemas')

View File

@ -1099,7 +1099,7 @@ virXMLParseHelper(int domcode,
if (validate && schemafile != NULL) {
g_autofree char *schema = virFileFindResource(schemafile,
abs_top_srcdir "/docs/schemas",
abs_top_srcdir "/src/conf/schemas",
PKGDATADIR "/schemas");
if (!schema ||
(virXMLValidateAgainstSchema(schema, xml) < 0))

View File

@ -336,27 +336,29 @@ mymain(void)
{
int ret = 0;
#define SCHEMAS_PATH "src/conf/schemas/"
#define DO_TEST(sch, ent) \
if (testSchemaEntries((sch), (ent), G_N_ELEMENTS(ent)) < 0) \
ret = -1;
DO_TEST("docs/schemas/capability.rng", schemaCapability);
DO_TEST("docs/schemas/domain.rng", schemaDomain);
DO_TEST("docs/schemas/domaincaps.rng", schemaDomainCaps);
DO_TEST("docs/schemas/domainbackup.rng", schemaDomainBackup);
DO_TEST("docs/schemas/domaincheckpoint.rng", schemaDomainCheckpoint);
DO_TEST("docs/schemas/domainsnapshot.rng", schemaDomainSnapshot);
DO_TEST("docs/schemas/interface.rng", schemaInterface);
DO_TEST("docs/schemas/network.rng", schemaNetwork);
DO_TEST("docs/schemas/networkport.rng", schemaNetworkport);
DO_TEST("docs/schemas/nodedev.rng", schemaNodedev);
DO_TEST("docs/schemas/nwfilter.rng", schemaNwfilter);
DO_TEST("docs/schemas/nwfilterbinding.rng", schemaNwfilterbinding);
DO_TEST("docs/schemas/secret.rng", schemaSecret);
DO_TEST("docs/schemas/storagepoolcaps.rng", schemaStoragepoolcaps);
DO_TEST("docs/schemas/storagepool.rng", schemaStoragePool);
DO_TEST("docs/schemas/storagevol.rng", schemaStorageVol);
DO_TEST("docs/schemas/cpu.rng", schemaCpu);
DO_TEST(SCHEMAS_PATH "capability.rng", schemaCapability);
DO_TEST(SCHEMAS_PATH "domain.rng", schemaDomain);
DO_TEST(SCHEMAS_PATH "domaincaps.rng", schemaDomainCaps);
DO_TEST(SCHEMAS_PATH "domainbackup.rng", schemaDomainBackup);
DO_TEST(SCHEMAS_PATH "domaincheckpoint.rng", schemaDomainCheckpoint);
DO_TEST(SCHEMAS_PATH "domainsnapshot.rng", schemaDomainSnapshot);
DO_TEST(SCHEMAS_PATH "interface.rng", schemaInterface);
DO_TEST(SCHEMAS_PATH "network.rng", schemaNetwork);
DO_TEST(SCHEMAS_PATH "networkport.rng", schemaNetworkport);
DO_TEST(SCHEMAS_PATH "nodedev.rng", schemaNodedev);
DO_TEST(SCHEMAS_PATH "nwfilter.rng", schemaNwfilter);
DO_TEST(SCHEMAS_PATH "nwfilterbinding.rng", schemaNwfilterbinding);
DO_TEST(SCHEMAS_PATH "secret.rng", schemaSecret);
DO_TEST(SCHEMAS_PATH "storagepoolcaps.rng", schemaStoragepoolcaps);
DO_TEST(SCHEMAS_PATH "storagepool.rng", schemaStoragePool);
DO_TEST(SCHEMAS_PATH "storagevol.rng", schemaStorageVol);
DO_TEST(SCHEMAS_PATH "cpu.rng", schemaCpu);
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}