[libvirt PATCH] schemas: move out of docs, fix no-docs build

root posted 1 patch 2 years, 1 month ago
Failed in applying to current master (apply log)
There is a newer version of this series
docs/meson.build                               | 2 --
meson.build                                    | 2 ++
{docs/schemas => schemas}/basictypes.rng       | 0
{docs/schemas => schemas}/capability.rng       | 0
{docs/schemas => schemas}/cpu.rng              | 0
{docs/schemas => schemas}/cputypes.rng         | 0
{docs/schemas => schemas}/domain.rng           | 0
{docs/schemas => schemas}/domainbackup.rng     | 0
{docs/schemas => schemas}/domaincaps.rng       | 0
{docs/schemas => schemas}/domaincheckpoint.rng | 0
{docs/schemas => schemas}/domaincommon.rng     | 0
{docs/schemas => schemas}/domainsnapshot.rng   | 0
{docs/schemas => schemas}/interface.rng        | 0
{docs/schemas => schemas}/meson.build          | 0
{docs/schemas => schemas}/network.rng          | 0
{docs/schemas => schemas}/networkcommon.rng    | 0
{docs/schemas => schemas}/networkport.rng      | 0
{docs/schemas => schemas}/nodedev.rng          | 0
{docs/schemas => schemas}/nwfilter.rng         | 0
{docs/schemas => schemas}/nwfilter_params.rng  | 0
{docs/schemas => schemas}/nwfilterbinding.rng  | 0
{docs/schemas => schemas}/secret.rng           | 0
{docs/schemas => schemas}/storagecommon.rng    | 0
{docs/schemas => schemas}/storagepool.rng      | 0
{docs/schemas => schemas}/storagepoolcaps.rng  | 0
{docs/schemas => schemas}/storagevol.rng       | 0
26 files changed, 2 insertions(+), 2 deletions(-)
rename {docs/schemas => schemas}/basictypes.rng (100%)
rename {docs/schemas => schemas}/capability.rng (100%)
rename {docs/schemas => schemas}/cpu.rng (100%)
rename {docs/schemas => schemas}/cputypes.rng (100%)
rename {docs/schemas => schemas}/domain.rng (100%)
rename {docs/schemas => schemas}/domainbackup.rng (100%)
rename {docs/schemas => schemas}/domaincaps.rng (100%)
rename {docs/schemas => schemas}/domaincheckpoint.rng (100%)
rename {docs/schemas => schemas}/domaincommon.rng (100%)
rename {docs/schemas => schemas}/domainsnapshot.rng (100%)
rename {docs/schemas => schemas}/interface.rng (100%)
rename {docs/schemas => schemas}/meson.build (100%)
rename {docs/schemas => schemas}/network.rng (100%)
rename {docs/schemas => schemas}/networkcommon.rng (100%)
rename {docs/schemas => schemas}/networkport.rng (100%)
rename {docs/schemas => schemas}/nodedev.rng (100%)
rename {docs/schemas => schemas}/nwfilter.rng (100%)
rename {docs/schemas => schemas}/nwfilter_params.rng (100%)
rename {docs/schemas => schemas}/nwfilterbinding.rng (100%)
rename {docs/schemas => schemas}/secret.rng (100%)
rename {docs/schemas => schemas}/storagecommon.rng (100%)
rename {docs/schemas => schemas}/storagepool.rng (100%)
rename {docs/schemas => schemas}/storagepoolcaps.rng (100%)
rename {docs/schemas => schemas}/storagevol.rng (100%)
[libvirt PATCH] schemas: move out of docs, fix no-docs build
Posted by root 2 years, 1 month ago
From: Claudio Fontana <cfontana@suse.de>

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 top source directory.

Signed-off-by: Claudio Fontana <cfontana@suse.de>
---
 docs/meson.build                               | 2 --
 meson.build                                    | 2 ++
 {docs/schemas => schemas}/basictypes.rng       | 0
 {docs/schemas => schemas}/capability.rng       | 0
 {docs/schemas => schemas}/cpu.rng              | 0
 {docs/schemas => schemas}/cputypes.rng         | 0
 {docs/schemas => schemas}/domain.rng           | 0
 {docs/schemas => schemas}/domainbackup.rng     | 0
 {docs/schemas => schemas}/domaincaps.rng       | 0
 {docs/schemas => schemas}/domaincheckpoint.rng | 0
 {docs/schemas => schemas}/domaincommon.rng     | 0
 {docs/schemas => schemas}/domainsnapshot.rng   | 0
 {docs/schemas => schemas}/interface.rng        | 0
 {docs/schemas => schemas}/meson.build          | 0
 {docs/schemas => schemas}/network.rng          | 0
 {docs/schemas => schemas}/networkcommon.rng    | 0
 {docs/schemas => schemas}/networkport.rng      | 0
 {docs/schemas => schemas}/nodedev.rng          | 0
 {docs/schemas => schemas}/nwfilter.rng         | 0
 {docs/schemas => schemas}/nwfilter_params.rng  | 0
 {docs/schemas => schemas}/nwfilterbinding.rng  | 0
 {docs/schemas => schemas}/secret.rng           | 0
 {docs/schemas => schemas}/storagecommon.rng    | 0
 {docs/schemas => schemas}/storagepool.rng      | 0
 {docs/schemas => schemas}/storagepoolcaps.rng  | 0
 {docs/schemas => schemas}/storagevol.rng       | 0
 26 files changed, 2 insertions(+), 2 deletions(-)
 rename {docs/schemas => schemas}/basictypes.rng (100%)
 rename {docs/schemas => schemas}/capability.rng (100%)
 rename {docs/schemas => schemas}/cpu.rng (100%)
 rename {docs/schemas => schemas}/cputypes.rng (100%)
 rename {docs/schemas => schemas}/domain.rng (100%)
 rename {docs/schemas => schemas}/domainbackup.rng (100%)
 rename {docs/schemas => schemas}/domaincaps.rng (100%)
 rename {docs/schemas => schemas}/domaincheckpoint.rng (100%)
 rename {docs/schemas => schemas}/domaincommon.rng (100%)
 rename {docs/schemas => schemas}/domainsnapshot.rng (100%)
 rename {docs/schemas => schemas}/interface.rng (100%)
 rename {docs/schemas => schemas}/meson.build (100%)
 rename {docs/schemas => schemas}/network.rng (100%)
 rename {docs/schemas => schemas}/networkcommon.rng (100%)
 rename {docs/schemas => schemas}/networkport.rng (100%)
 rename {docs/schemas => schemas}/nodedev.rng (100%)
 rename {docs/schemas => schemas}/nwfilter.rng (100%)
 rename {docs/schemas => schemas}/nwfilter_params.rng (100%)
 rename {docs/schemas => schemas}/nwfilterbinding.rng (100%)
 rename {docs/schemas => schemas}/secret.rng (100%)
 rename {docs/schemas => schemas}/storagecommon.rng (100%)
 rename {docs/schemas => schemas}/storagepool.rng (100%)
 rename {docs/schemas => schemas}/storagepoolcaps.rng (100%)
 rename {docs/schemas => schemas}/storagevol.rng (100%)

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/meson.build b/meson.build
index f6259e59a4..bea1b8e0ea 100644
--- a/meson.build
+++ b/meson.build
@@ -2125,6 +2125,8 @@ if gen_docs
   subdir('docs')
 endif
 
+subdir('schemas')
+
 subdir('build-aux')
 
 
diff --git a/docs/schemas/basictypes.rng b/schemas/basictypes.rng
similarity index 100%
rename from docs/schemas/basictypes.rng
rename to schemas/basictypes.rng
diff --git a/docs/schemas/capability.rng b/schemas/capability.rng
similarity index 100%
rename from docs/schemas/capability.rng
rename to schemas/capability.rng
diff --git a/docs/schemas/cpu.rng b/schemas/cpu.rng
similarity index 100%
rename from docs/schemas/cpu.rng
rename to schemas/cpu.rng
diff --git a/docs/schemas/cputypes.rng b/schemas/cputypes.rng
similarity index 100%
rename from docs/schemas/cputypes.rng
rename to schemas/cputypes.rng
diff --git a/docs/schemas/domain.rng b/schemas/domain.rng
similarity index 100%
rename from docs/schemas/domain.rng
rename to schemas/domain.rng
diff --git a/docs/schemas/domainbackup.rng b/schemas/domainbackup.rng
similarity index 100%
rename from docs/schemas/domainbackup.rng
rename to schemas/domainbackup.rng
diff --git a/docs/schemas/domaincaps.rng b/schemas/domaincaps.rng
similarity index 100%
rename from docs/schemas/domaincaps.rng
rename to schemas/domaincaps.rng
diff --git a/docs/schemas/domaincheckpoint.rng b/schemas/domaincheckpoint.rng
similarity index 100%
rename from docs/schemas/domaincheckpoint.rng
rename to schemas/domaincheckpoint.rng
diff --git a/docs/schemas/domaincommon.rng b/schemas/domaincommon.rng
similarity index 100%
rename from docs/schemas/domaincommon.rng
rename to schemas/domaincommon.rng
diff --git a/docs/schemas/domainsnapshot.rng b/schemas/domainsnapshot.rng
similarity index 100%
rename from docs/schemas/domainsnapshot.rng
rename to schemas/domainsnapshot.rng
diff --git a/docs/schemas/interface.rng b/schemas/interface.rng
similarity index 100%
rename from docs/schemas/interface.rng
rename to schemas/interface.rng
diff --git a/docs/schemas/meson.build b/schemas/meson.build
similarity index 100%
rename from docs/schemas/meson.build
rename to schemas/meson.build
diff --git a/docs/schemas/network.rng b/schemas/network.rng
similarity index 100%
rename from docs/schemas/network.rng
rename to schemas/network.rng
diff --git a/docs/schemas/networkcommon.rng b/schemas/networkcommon.rng
similarity index 100%
rename from docs/schemas/networkcommon.rng
rename to schemas/networkcommon.rng
diff --git a/docs/schemas/networkport.rng b/schemas/networkport.rng
similarity index 100%
rename from docs/schemas/networkport.rng
rename to schemas/networkport.rng
diff --git a/docs/schemas/nodedev.rng b/schemas/nodedev.rng
similarity index 100%
rename from docs/schemas/nodedev.rng
rename to schemas/nodedev.rng
diff --git a/docs/schemas/nwfilter.rng b/schemas/nwfilter.rng
similarity index 100%
rename from docs/schemas/nwfilter.rng
rename to schemas/nwfilter.rng
diff --git a/docs/schemas/nwfilter_params.rng b/schemas/nwfilter_params.rng
similarity index 100%
rename from docs/schemas/nwfilter_params.rng
rename to schemas/nwfilter_params.rng
diff --git a/docs/schemas/nwfilterbinding.rng b/schemas/nwfilterbinding.rng
similarity index 100%
rename from docs/schemas/nwfilterbinding.rng
rename to schemas/nwfilterbinding.rng
diff --git a/docs/schemas/secret.rng b/schemas/secret.rng
similarity index 100%
rename from docs/schemas/secret.rng
rename to schemas/secret.rng
diff --git a/docs/schemas/storagecommon.rng b/schemas/storagecommon.rng
similarity index 100%
rename from docs/schemas/storagecommon.rng
rename to schemas/storagecommon.rng
diff --git a/docs/schemas/storagepool.rng b/schemas/storagepool.rng
similarity index 100%
rename from docs/schemas/storagepool.rng
rename to schemas/storagepool.rng
diff --git a/docs/schemas/storagepoolcaps.rng b/schemas/storagepoolcaps.rng
similarity index 100%
rename from docs/schemas/storagepoolcaps.rng
rename to schemas/storagepoolcaps.rng
diff --git a/docs/schemas/storagevol.rng b/schemas/storagevol.rng
similarity index 100%
rename from docs/schemas/storagevol.rng
rename to schemas/storagevol.rng
-- 
2.35.1
Re: [libvirt PATCH] schemas: move out of docs, fix no-docs build
Posted by Daniel P. Berrangé 2 years, 1 month ago
On Thu, Mar 17, 2022 at 07:24:12AM -0600, root wrote:
> From: Claudio Fontana <cfontana@suse.de>
> 
> 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 top source directory.

I don't think we should be adding more top level
directories. Instead this should be src/conf/schemas,
since it represents the schemas that the src/conf
code is parsing.


With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
Re: [libvirt PATCH] schemas: move out of docs, fix no-docs build
Posted by Andrea Bolognani 2 years, 1 month ago
On Thu, Mar 17, 2022 at 07:24:12AM -0600, root wrote:
> From: Claudio Fontana <cfontana@suse.de>

Please look into fixing your email setup so that patches you post to
the list show up as coming from you rather than the root account of a
random SUSE machine :)

> 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 top source directory.
>
> Signed-off-by: Claudio Fontana <cfontana@suse.de>

I like this, but your initial implementation is incomplete: you need
to squash in the diff below to bring things back to a working state.
Please make sure you always run 'meson test' with your patches
applied before posting them to the list.

A couple additional points:

  * the name "docs_schema_files" in meson.build no longer makes sense
    once you take schemas out of docs/, so I would suggest renaming
    it to "schema_files";

  * I feel like src/schemas/ might be a more appropriate location for
    this than the top level. I'd like to hear what other people think
    about this.

Cheers!



diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
index 819efcea8c..2b841ba098 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 "/schemas",
                                                PKGDATADIR "/schemas")))
             return -1;

diff --git a/src/util/virxml.c b/src/util/virxml.c
index 268aad1d20..226aa87f28 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
"/schemas",
                                                       PKGDATADIR "/schemas");
         if (!schema ||
             (virXMLValidateAgainstSchema(schema, xml) < 0))
diff --git a/tests/virschematest.c b/tests/virschematest.c
index 4e657159e1..97106ee76d 100644
--- a/tests/virschematest.c
+++ b/tests/virschematest.c
@@ -340,23 +340,23 @@ mymain(void)
     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/capability.rng", schemaCapability);
+    DO_TEST("schemas/domain.rng", schemaDomain);
+    DO_TEST("schemas/domaincaps.rng", schemaDomainCaps);
+    DO_TEST("schemas/domainbackup.rng", schemaDomainBackup);
+    DO_TEST("schemas/domaincheckpoint.rng", schemaDomainCheckpoint);
+    DO_TEST("schemas/domainsnapshot.rng", schemaDomainSnapshot);
+    DO_TEST("schemas/interface.rng", schemaInterface);
+    DO_TEST("schemas/network.rng", schemaNetwork);
+    DO_TEST("schemas/networkport.rng", schemaNetworkport);
+    DO_TEST("schemas/nodedev.rng", schemaNodedev);
+    DO_TEST("schemas/nwfilter.rng", schemaNwfilter);
+    DO_TEST("schemas/nwfilterbinding.rng", schemaNwfilterbinding);
+    DO_TEST("schemas/secret.rng", schemaSecret);
+    DO_TEST("schemas/storagepoolcaps.rng", schemaStoragepoolcaps);
+    DO_TEST("schemas/storagepool.rng", schemaStoragePool);
+    DO_TEST("schemas/storagevol.rng", schemaStorageVol);
+    DO_TEST("schemas/cpu.rng", schemaCpu);

     return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
 }
-- 
Andrea Bolognani / Red Hat / Virtualization
Re: [libvirt PATCH] schemas: move out of docs, fix no-docs build
Posted by Claudio Fontana 2 years, 1 month ago
On 3/21/22 2:34 PM, Andrea Bolognani wrote:
> On Thu, Mar 17, 2022 at 07:24:12AM -0600, root wrote:
>> From: Claudio Fontana <cfontana@suse.de>
> 
> Please look into fixing your email setup so that patches you post to
> the list show up as coming from you rather than the root account of a
> random SUSE machine :)

..ups yes, I noticed today in another patch too.

> 
>> 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 top source directory.
>>
>> Signed-off-by: Claudio Fontana <cfontana@suse.de>
> 
> I like this, but your initial implementation is incomplete: you need
> to squash in the diff below to bring things back to a working state.
> Please make sure you always run 'meson test' with your patches
> applied before posting them to the list.

Thanks! Will do it from now on.

> 
> A couple additional points:
> 
>   * the name "docs_schema_files" in meson.build no longer makes sense
>     once you take schemas out of docs/, so I would suggest renaming
>     it to "schema_files";
> 
>   * I feel like src/schemas/ might be a more appropriate location for
>     this than the top level. I'd like to hear what other people think
>     about this.
> 
> Cheers!
> 
> 
> 
> diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c
> index 819efcea8c..2b841ba098 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 "/schemas",
>                                                 PKGDATADIR "/schemas")))
>              return -1;
> 
> diff --git a/src/util/virxml.c b/src/util/virxml.c
> index 268aad1d20..226aa87f28 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
> "/schemas",
>                                                        PKGDATADIR "/schemas");
>          if (!schema ||
>              (virXMLValidateAgainstSchema(schema, xml) < 0))
> diff --git a/tests/virschematest.c b/tests/virschematest.c
> index 4e657159e1..97106ee76d 100644
> --- a/tests/virschematest.c
> +++ b/tests/virschematest.c
> @@ -340,23 +340,23 @@ mymain(void)
>      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/capability.rng", schemaCapability);
> +    DO_TEST("schemas/domain.rng", schemaDomain);
> +    DO_TEST("schemas/domaincaps.rng", schemaDomainCaps);
> +    DO_TEST("schemas/domainbackup.rng", schemaDomainBackup);
> +    DO_TEST("schemas/domaincheckpoint.rng", schemaDomainCheckpoint);
> +    DO_TEST("schemas/domainsnapshot.rng", schemaDomainSnapshot);
> +    DO_TEST("schemas/interface.rng", schemaInterface);
> +    DO_TEST("schemas/network.rng", schemaNetwork);
> +    DO_TEST("schemas/networkport.rng", schemaNetworkport);
> +    DO_TEST("schemas/nodedev.rng", schemaNodedev);
> +    DO_TEST("schemas/nwfilter.rng", schemaNwfilter);
> +    DO_TEST("schemas/nwfilterbinding.rng", schemaNwfilterbinding);
> +    DO_TEST("schemas/secret.rng", schemaSecret);
> +    DO_TEST("schemas/storagepoolcaps.rng", schemaStoragepoolcaps);
> +    DO_TEST("schemas/storagepool.rng", schemaStoragePool);
> +    DO_TEST("schemas/storagevol.rng", schemaStorageVol);
> +    DO_TEST("schemas/cpu.rng", schemaCpu);
> 
>      return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
>  }
> 

Thanks, will add,

Claudio