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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 17, 2022 at 07:24:12AM -0600, root wrote:
> From: Claudio Fontana <cfontana@xxxxxxx>

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@xxxxxxx>

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




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux