]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
meson: Detect and reject invalid rst2html5 command
authorAndrea Bolognani <abologna@redhat.com>
Mon, 9 Aug 2021 15:04:08 +0000 (17:04 +0200)
committerAndrea Bolognani <abologna@redhat.com>
Wed, 3 Nov 2021 09:10:54 +0000 (10:10 +0100)
The version coming from the rst2html5 package instead of the
docutils package is unable to successfully generate the libvirt
documentation.

Examples of users encountering build issues because of the wrong
version of rst2html5 being installed on their systems:

  https://gitlab.com/libvirt/libvirt/-/issues/40
  https://gitlab.com/libvirt/libvirt/-/issues/139
  https://gitlab.com/libvirt/libvirt/-/issues/169
  https://gitlab.com/libvirt/libvirt/-/issues/195

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
meson.build

index 6e8397480e77c0276a02c55c2a592b0880ecc9ac..3a9066b9fe7fc6e78380df4b94e092be73c4915f 100644 (file)
@@ -812,6 +812,34 @@ foreach item : required_programs_groups
   set_variable('@0@_prog'.format(varname), prog)
 endforeach
 
+# There are two versions of rst2html5 in the wild: one is the version
+# coming from the docutils package, and the other is the one coming
+# from the rst2html5 package. These versions are subtly different,
+# and the libvirt documentation can only be successfully generated
+# using the docutils version. Every now and then, users will report
+# build failures that can be traced back to having the wrong version
+# installed.
+#
+# The only reliable way to tell the two binaries apart seems to be
+# looking look at their version information: the docutils version
+# will report
+#
+#   rst2html5 (Docutils ..., Python ..., on ...)
+#
+# whereas the rst2html5 version will report
+#
+#   rst2html5 ... (Docutils ..., Python ..., on ...)
+#
+# with the additional bit of information being the version number for
+# the rst2html5 package itself.
+#
+# Use this knowledge to detect the version that we know doesn't work
+# for building libvirt and reject it
+rst2html5_version = run_command(rst2html5_prog, '--version')
+rst2html5_version = rst2html5_version.stdout().split('(')
+if rst2html5_version[0] != 'rst2html5 '
+  error('Please uninstall the rst2html5 package and install the docutils package')
+endif
 
 # optional programs