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@xxxxxxx> --- changes v1 -> v2: * move to src/conf/ instead of top_srcdir (Daniel) * meson, rename docs_schema_files to just schema_files (Daniel) * tests/virschematest.c: adapt (Andrea) * src/util/virxml.c: adapt (Andrea) * src/conf/cpu_conf.c: adapt (Andrea) * docs/api_extension.rst: adapt one additional reference docs/api_extension.rst | 2 +- docs/meson.build | 2 -- src/conf/cpu_conf.c | 2 +- src/conf/meson.build | 2 ++ {docs => src/conf}/schemas/basictypes.rng | 0 {docs => src/conf}/schemas/capability.rng | 0 {docs => src/conf}/schemas/cpu.rng | 0 {docs => src/conf}/schemas/cputypes.rng | 0 {docs => src/conf}/schemas/domain.rng | 0 {docs => src/conf}/schemas/domainbackup.rng | 0 {docs => src/conf}/schemas/domaincaps.rng | 0 .../conf}/schemas/domaincheckpoint.rng | 0 {docs => src/conf}/schemas/domaincommon.rng | 0 {docs => src/conf}/schemas/domainsnapshot.rng | 0 {docs => src/conf}/schemas/interface.rng | 0 {docs => src/conf}/schemas/meson.build | 4 +-- {docs => src/conf}/schemas/network.rng | 0 {docs => src/conf}/schemas/networkcommon.rng | 0 {docs => src/conf}/schemas/networkport.rng | 0 {docs => src/conf}/schemas/nodedev.rng | 0 {docs => src/conf}/schemas/nwfilter.rng | 0 .../conf}/schemas/nwfilter_params.rng | 0 .../conf}/schemas/nwfilterbinding.rng | 0 {docs => src/conf}/schemas/secret.rng | 0 {docs => src/conf}/schemas/storagecommon.rng | 0 {docs => src/conf}/schemas/storagepool.rng | 0 .../conf}/schemas/storagepoolcaps.rng | 0 {docs => src/conf}/schemas/storagevol.rng | 0 src/util/virxml.c | 2 +- tests/virschematest.c | 36 ++++++++++--------- 30 files changed, 26 insertions(+), 24 deletions(-) rename {docs => src/conf}/schemas/basictypes.rng (100%) rename {docs => src/conf}/schemas/capability.rng (100%) rename {docs => src/conf}/schemas/cpu.rng (100%) rename {docs => src/conf}/schemas/cputypes.rng (100%) rename {docs => src/conf}/schemas/domain.rng (100%) rename {docs => src/conf}/schemas/domainbackup.rng (100%) rename {docs => src/conf}/schemas/domaincaps.rng (100%) rename {docs => src/conf}/schemas/domaincheckpoint.rng (100%) rename {docs => src/conf}/schemas/domaincommon.rng (100%) rename {docs => src/conf}/schemas/domainsnapshot.rng (100%) rename {docs => src/conf}/schemas/interface.rng (100%) rename {docs => src/conf}/schemas/meson.build (83%) rename {docs => src/conf}/schemas/network.rng (100%) rename {docs => src/conf}/schemas/networkcommon.rng (100%) rename {docs => src/conf}/schemas/networkport.rng (100%) rename {docs => src/conf}/schemas/nodedev.rng (100%) rename {docs => src/conf}/schemas/nwfilter.rng (100%) rename {docs => src/conf}/schemas/nwfilter_params.rng (100%) rename {docs => src/conf}/schemas/nwfilterbinding.rng (100%) rename {docs => src/conf}/schemas/secret.rng (100%) rename {docs => src/conf}/schemas/storagecommon.rng (100%) rename {docs => src/conf}/schemas/storagepool.rng (100%) rename {docs => src/conf}/schemas/storagepoolcaps.rng (100%) rename {docs => src/conf}/schemas/storagevol.rng (100%) diff --git a/docs/api_extension.rst b/docs/api_extension.rst index 16d4b0a005..d70c244fd4 100644 --- a/docs/api_extension.rst +++ b/docs/api_extension.rst @@ -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 diff --git a/docs/meson.build b/docs/meson.build index 868267b764..7aebe08047 100644 --- a/docs/meson.build +++ b/docs/meson.build @@ -334,8 +334,6 @@ subdir('js') subdir('kbase') subdir('logos') subdir('manpages') -subdir('schemas') - foreach file : docs_assets # This hack enables us to view the web pages diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 819efcea8c..2d447da7c3 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -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; diff --git a/src/conf/meson.build b/src/conf/meson.build index bd35d87e0a..82d265e975 100644 --- a/src/conf/meson.build +++ b/src/conf/meson.build @@ -111,3 +111,5 @@ virt_conf_lib = static_library( libvirt_libs += virt_conf_lib conf_inc_dir = include_directories('.') + +subdir('schemas') diff --git a/docs/schemas/basictypes.rng b/src/conf/schemas/basictypes.rng similarity index 100% rename from docs/schemas/basictypes.rng rename to src/conf/schemas/basictypes.rng diff --git a/docs/schemas/capability.rng b/src/conf/schemas/capability.rng similarity index 100% rename from docs/schemas/capability.rng rename to src/conf/schemas/capability.rng diff --git a/docs/schemas/cpu.rng b/src/conf/schemas/cpu.rng similarity index 100% rename from docs/schemas/cpu.rng rename to src/conf/schemas/cpu.rng diff --git a/docs/schemas/cputypes.rng b/src/conf/schemas/cputypes.rng similarity index 100% rename from docs/schemas/cputypes.rng rename to src/conf/schemas/cputypes.rng diff --git a/docs/schemas/domain.rng b/src/conf/schemas/domain.rng similarity index 100% rename from docs/schemas/domain.rng rename to src/conf/schemas/domain.rng diff --git a/docs/schemas/domainbackup.rng b/src/conf/schemas/domainbackup.rng similarity index 100% rename from docs/schemas/domainbackup.rng rename to src/conf/schemas/domainbackup.rng diff --git a/docs/schemas/domaincaps.rng b/src/conf/schemas/domaincaps.rng similarity index 100% rename from docs/schemas/domaincaps.rng rename to src/conf/schemas/domaincaps.rng diff --git a/docs/schemas/domaincheckpoint.rng b/src/conf/schemas/domaincheckpoint.rng similarity index 100% rename from docs/schemas/domaincheckpoint.rng rename to src/conf/schemas/domaincheckpoint.rng diff --git a/docs/schemas/domaincommon.rng b/src/conf/schemas/domaincommon.rng similarity index 100% rename from docs/schemas/domaincommon.rng rename to src/conf/schemas/domaincommon.rng diff --git a/docs/schemas/domainsnapshot.rng b/src/conf/schemas/domainsnapshot.rng similarity index 100% rename from docs/schemas/domainsnapshot.rng rename to src/conf/schemas/domainsnapshot.rng diff --git a/docs/schemas/interface.rng b/src/conf/schemas/interface.rng similarity index 100% rename from docs/schemas/interface.rng rename to src/conf/schemas/interface.rng diff --git a/docs/schemas/meson.build b/src/conf/schemas/meson.build similarity index 83% rename from docs/schemas/meson.build rename to src/conf/schemas/meson.build index bb6a48787f..700161bf75 100644 --- a/docs/schemas/meson.build +++ b/src/conf/schemas/meson.build @@ -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') diff --git a/docs/schemas/network.rng b/src/conf/schemas/network.rng similarity index 100% rename from docs/schemas/network.rng rename to src/conf/schemas/network.rng diff --git a/docs/schemas/networkcommon.rng b/src/conf/schemas/networkcommon.rng similarity index 100% rename from docs/schemas/networkcommon.rng rename to src/conf/schemas/networkcommon.rng diff --git a/docs/schemas/networkport.rng b/src/conf/schemas/networkport.rng similarity index 100% rename from docs/schemas/networkport.rng rename to src/conf/schemas/networkport.rng diff --git a/docs/schemas/nodedev.rng b/src/conf/schemas/nodedev.rng similarity index 100% rename from docs/schemas/nodedev.rng rename to src/conf/schemas/nodedev.rng diff --git a/docs/schemas/nwfilter.rng b/src/conf/schemas/nwfilter.rng similarity index 100% rename from docs/schemas/nwfilter.rng rename to src/conf/schemas/nwfilter.rng diff --git a/docs/schemas/nwfilter_params.rng b/src/conf/schemas/nwfilter_params.rng similarity index 100% rename from docs/schemas/nwfilter_params.rng rename to src/conf/schemas/nwfilter_params.rng diff --git a/docs/schemas/nwfilterbinding.rng b/src/conf/schemas/nwfilterbinding.rng similarity index 100% rename from docs/schemas/nwfilterbinding.rng rename to src/conf/schemas/nwfilterbinding.rng diff --git a/docs/schemas/secret.rng b/src/conf/schemas/secret.rng similarity index 100% rename from docs/schemas/secret.rng rename to src/conf/schemas/secret.rng diff --git a/docs/schemas/storagecommon.rng b/src/conf/schemas/storagecommon.rng similarity index 100% rename from docs/schemas/storagecommon.rng rename to src/conf/schemas/storagecommon.rng diff --git a/docs/schemas/storagepool.rng b/src/conf/schemas/storagepool.rng similarity index 100% rename from docs/schemas/storagepool.rng rename to src/conf/schemas/storagepool.rng diff --git a/docs/schemas/storagepoolcaps.rng b/src/conf/schemas/storagepoolcaps.rng similarity index 100% rename from docs/schemas/storagepoolcaps.rng rename to src/conf/schemas/storagepoolcaps.rng diff --git a/docs/schemas/storagevol.rng b/src/conf/schemas/storagevol.rng similarity index 100% rename from docs/schemas/storagevol.rng rename to src/conf/schemas/storagevol.rng diff --git a/src/util/virxml.c b/src/util/virxml.c index 268aad1d20..8ff59e7cda 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -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)) diff --git a/tests/virschematest.c b/tests/virschematest.c index 4e657159e1..29a5546418 100644 --- a/tests/virschematest.c +++ b/tests/virschematest.c @@ -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; } -- 2.35.1