[libvirt] [PATCH 0/7] docs: fix various problems in docs and cleanup rules

There were a few problems in the docs build from the vpath build https://www.redhat.com/archives/libvir-list/2019-November/msg00308.html - We can't browse the website from the build dir - Including of the acl permissions was broken This series fixes those two problems and also fixes the generation of API reference docs for admin, qemu & lxc APIs. Finally there's a bunch of cleanups / simplifications in build rules Daniel P. Berrangé (7): docs: stop using custom rules for building / installing web pages Drop building of API -refs.xml files docs: use variable for referencing API XML filenames docs: generate API reference pages for admin, qemu & lxc libraries docs: remove unused make targets docs: fix ability to view web pages from build tree docs: fix include of ACL permissions files docs/Makefile.am | 180 +++++++++++++++++++++++----------------------- docs/apibuild.py | 170 ------------------------------------------- docs/docs.html.in | 4 ++ docs/newapi.xsl | 14 ++-- docs/page.xsl | 4 +- 5 files changed, 103 insertions(+), 269 deletions(-) -- 2.23.0

Define automake variables for all the data we need built and installed and let automake generate the install rules normally. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 80 +++++++++++++----------------------------------- 1 file changed, 21 insertions(+), 59 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 0311bbedd8..60ca6aba5b 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -49,6 +49,9 @@ apipng = \ html/home.png \ html/right.png +apirefdir = $(HTML_DIR)/html +apiref_DATA = $(apihtml) $(apipng) + css = \ generic.css \ libvirt.css \ @@ -59,6 +62,9 @@ javascript = \ js/main.js \ $(NULL) +javascriptdir = $(HTML_DIR)/js +javascript_DATA = $(javascript) + fonts = \ fonts/LICENSE.md \ fonts/stylesheet.css \ @@ -73,6 +79,9 @@ fonts = \ fonts/overpass-mono-semibold.woff \ fonts/overpass-regular.woff +fontsdir = $(HTML_DIR)/fonts +fonts_DATA = $(fonts) + logofiles = \ logos/logo-base.svg \ logos/logo-square.svg \ @@ -92,6 +101,9 @@ logofiles = \ logos/logo-banner-light-256.png \ logos/logo-banner-light-800.png +logofilesdir = $(HTML_DIR)/logos +logofiles_DATA = $(logofiles) + png = \ 32favicon.png \ libvirt-daemon-arch.png \ @@ -107,15 +119,20 @@ gif = \ architecture.gif \ node.gif - internals_html_in = \ $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/internals/*.html.in)) internals_html = $(internals_html_in:%.html.in=%.html) +internalsdir = $(HTML_DIR)/internals +internals_DATA = $(internals_html) + kbase_html_in = \ $(patsubst $(srcdir)/%,%,$(wildcard $(srcdir)/kbase/*.html.in)) kbase_html = $(kbase_html_in:%.html.in=%.html) +kbasedir = $(HTML_DIR)/kbase +kbase_DATA = $(kbase_html) + # Generate hvsupport.html and news.html first, since they take one extra step. dot_html_generated_in = \ hvsupport.html.in \ @@ -126,6 +143,9 @@ dot_html = \ $(dot_html_generated_in:%.html.in=%.html) \ $(dot_html_in:%.html.in=%.html) +htmldir = $(HTML_DIR) +html_DATA = $(css) $(png) $(gif) $(dot_html) + xml = \ libvirt-api.xml \ libvirt-refs.xml @@ -200,16 +220,11 @@ timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \ date -u; \ fi)" -all-am: web - api: libvirt-api.xml libvirt-refs.xml qemu_api: libvirt-qemu-api.xml libvirt-qemu-refs.xml lxc_api: libvirt-lxc-api.xml libvirt-lxc-refs.xml admin_api: libvirt-admin-api.xml libvirt-admin-refs.xml -web: $(dot_html) $(internals_html) $(kbase_html) \ - html/index.html - hvsupport.html: hvsupport.html.in hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \ @@ -325,56 +340,3 @@ $(APIBUILD_STAMP): $(srcdir)/apibuild.py \ $(AM_V_GEN)srcdir=$(srcdir) builddir=$(builddir) \ $(RUNUTF8) $(PYTHON) $(APIBUILD) touch $@ - - -check-local: all -dist-local: all - -rebuild: api qemu_api lxc_api admin_api all - -install-data-local: - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR) - for f in $(css) $(gif) $(png); do \ - $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR); done - for f in $(dot_html); do \ - $(INSTALL) -m 0644 $$f $(DESTDIR)$(HTML_DIR); done - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/js - for f in $(javascript); do \ - $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/js/; done - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/logos - for f in $(logofiles); do \ - $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/logos; done - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/html - for h in $(apihtml); do \ - $(INSTALL) -m 0644 $$h $(DESTDIR)$(HTML_DIR)/html; done - for p in $(apipng); do \ - $(INSTALL) -m 0644 $(srcdir)/$$p $(DESTDIR)$(HTML_DIR)/html; done - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/internals - for f in $(internals_html); do \ - $(INSTALL) -m 0644 $$f $(DESTDIR)$(HTML_DIR)/internals; done - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/kbase - for f in $(kbase_html); do \ - $(INSTALL) -m 0644 $$f $(DESTDIR)$(HTML_DIR)/kbase; done - $(mkinstalldirs) $(DESTDIR)$(HTML_DIR)/fonts - for f in $(fonts); do \ - $(INSTALL) -m 0644 $(srcdir)/$$f $(DESTDIR)$(HTML_DIR)/fonts; \ - done - -uninstall-local: - for f in $(css) $(dot_html) $(gif) $(png) $(fonts); do \ - rm -f $(DESTDIR)$(HTML_DIR)/$$f; \ - done - for f in $(logofiles); do \ - rm -f $(DESTDIR)$(HTML_DIR)/$$f; \ - done - for f in $(javascript); do \ - rm -f $(DESTDIR)$(HTML_DIR)/$$f; \ - done - for h in $(apihtml); do rm -f $(DESTDIR)$(HTML_DIR)/$$h; done - for p in $(apipng); do rm -f $(DESTDIR)$(HTML_DIR)/$$p; done - for f in $(internals_html); do \ - rm -f $(DESTDIR)$(HTML_DIR)/$$f; \ - done - for f in $(kbase_html); do \ - rm -f $(DESTDIR)$(HTML_DIR)/$$f; \ - done -- 2.23.0

The API cross reference files are not used since commit d3043afe5ceebd5002bff45db38bb33e090bb4af Author: Daniel Veillard <veillard@redhat.com> Date: Mon Jan 21 08:08:33 2008 +0000 Remove docs/API*.html * docs/API* docs/api.xsl docs/site.xsl docs/Makefile.am: remove the generation of the API*.html files as it's not really useful here Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 24 +++---- docs/apibuild.py | 170 ----------------------------------------------- 2 files changed, 8 insertions(+), 186 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 60ca6aba5b..5f59d057f1 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -147,20 +147,16 @@ htmldir = $(HTML_DIR) html_DATA = $(css) $(png) $(gif) $(dot_html) xml = \ - libvirt-api.xml \ - libvirt-refs.xml + libvirt-api.xml qemu_xml = \ - libvirt-qemu-api.xml \ - libvirt-qemu-refs.xml + libvirt-qemu-api.xml lxc_xml = \ - libvirt-lxc-api.xml \ - libvirt-lxc-refs.xml + libvirt-lxc-api.xml admin_xml = \ - libvirt-admin-api.xml \ - libvirt-admin-refs.xml + libvirt-admin-api.xml apidir = $(pkgdatadir)/api api_DATA = \ @@ -220,10 +216,10 @@ timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \ date -u; \ fi)" -api: libvirt-api.xml libvirt-refs.xml -qemu_api: libvirt-qemu-api.xml libvirt-qemu-refs.xml -lxc_api: libvirt-lxc-api.xml libvirt-lxc-refs.xml -admin_api: libvirt-admin-api.xml libvirt-admin-refs.xml +api: libvirt-api.xml +qemu_api: libvirt-qemu-api.xml +lxc_api: libvirt-lxc-api.xml +admin_api: libvirt-admin-api.xml hvsupport.html: hvsupport.html.in @@ -285,13 +281,9 @@ python_generated_files = \ html/libvirt-libvirt-admin.html \ html/libvirt-virterror.html \ libvirt-api.xml \ - libvirt-refs.xml \ libvirt-lxc-api.xml \ - libvirt-lxc-refs.xml \ libvirt-qemu-api.xml \ - libvirt-qemu-refs.xml \ libvirt-admin-api.xml \ - libvirt-admin-refs.xml \ $(NULL) APIBUILD=$(srcdir)/apibuild.py diff --git a/docs/apibuild.py b/docs/apibuild.py index dedeb86f3d..5a0224c1c6 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -2323,166 +2323,6 @@ class docBuilder: output.write(" <exports symbol='%s' type='function'/>\n" % (id)) output.write(" </file>\n") - def serialize_xrefs_files(self, output): - headers = sorted(self.headers.keys()) - for file in headers: - module = self.modulename_file(file) - output.write(" <file name='%s'>\n" % (module)) - dict = self.headers[file] - ids = uniq(list(dict.functions.keys()) + - list(dict.variables.keys()) + - list(dict.macros.keys()) + - list(dict.typedefs.keys()) + - list(dict.structs.keys()) + - list(dict.enums.keys())) - for id in ids: - output.write(" <ref name='%s'/>\n" % (id)) - output.write(" </file>\n") - pass - - def serialize_xrefs_functions(self, output): - funcs = {} - for name in self.idx.functions.keys(): - id = self.idx.functions[name] - try: - (ret, params, desc) = id.info - for param in params: - if param[0] == 'void': - continue - if param[0] in funcs: - funcs[param[0]].append(name) - else: - funcs[param[0]] = [name] - except Exception: - pass - typ = sorted(funcs.keys()) - for type in typ: - if type in ['', "void", "int", "char *", "const char *"]: - continue - output.write(" <type name='%s'>\n" % (type)) - ids = funcs[type] - ids.sort() - pid = '' # not sure why we have dups, but get rid of them! - for id in ids: - if id != pid: - output.write(" <ref name='%s'/>\n" % (id)) - pid = id - output.write(" </type>\n") - - def serialize_xrefs_constructors(self, output): - funcs = {} - for name in self.idx.functions.keys(): - id = self.idx.functions[name] - try: - (ret, params, desc) = id.info - if ret[0] == "void": - continue - if ret[0] in funcs: - funcs[ret[0]].append(name) - else: - funcs[ret[0]] = [name] - except Exception: - pass - typ = sorted(funcs.keys()) - for type in typ: - if type in ['', "void", "int", "char *", "const char *"]: - continue - output.write(" <type name='%s'>\n" % (type)) - ids = sorted(funcs[type]) - for id in ids: - output.write(" <ref name='%s'/>\n" % (id)) - output.write(" </type>\n") - - def serialize_xrefs_alpha(self, output): - letter = None - ids = sorted(self.idx.identifiers.keys()) - for id in ids: - if id[0] != letter: - if letter is not None: - output.write(" </letter>\n") - letter = id[0] - output.write(" <letter name='%s'>\n" % (letter)) - output.write(" <ref name='%s'/>\n" % (id)) - if letter is not None: - output.write(" </letter>\n") - - def serialize_xrefs_references(self, output): - typ = sorted(self.idx.identifiers.keys()) - for id in typ: - idf = self.idx.identifiers[id] - module = idf.header - output.write(" <reference name='%s' href='%s'/>\n" % - (id, 'html/' + self.basename + '-' + - self.modulename_file(module) + '.html#' + - id)) - - def serialize_xrefs_index(self, output): - index = self.xref - typ = sorted(index.keys()) - letter = None - count = 0 - chunk = 0 - chunks = [] - first_letter = None - for id in typ: - if len(index[id]) > 30: - continue - if id[0] != letter: - if letter is None or count > 200: - if letter is not None: - output.write(" </letter>\n") - output.write(" </chunk>\n") - count = 0 - chunks.append(["chunk%s" % (chunk - 1), first_letter, letter]) - output.write(" <chunk name='chunk%s'>\n" % (chunk)) - first_letter = id[0] - chunk = chunk + 1 - elif letter is not None: - output.write(" </letter>\n") - letter = id[0] - output.write(" <letter name='%s'>\n" % (letter)) - output.write(" <word name='%s'>\n" % (id)) - tokens = index[id] - tokens.sort() - tok = None - for token in tokens: - if tok == token: - continue - tok = token - output.write(" <ref name='%s'/>\n" % (token)) - count = count + 1 - output.write(" </word>\n") - if letter is not None: - output.write(" </letter>\n") - output.write(" </chunk>\n") - if count != 0: - chunks.append(["chunk%s" % (chunk - 1), first_letter, letter]) - output.write(" <chunks>\n") - for ch in chunks: - output.write(" <chunk name='%s' start='%s' end='%s'/>\n" % ( - ch[0], ch[1], ch[2])) - output.write(" </chunks>\n") - - def serialize_xrefs(self, output): - output.write(" <references>\n") - self.serialize_xrefs_references(output) - output.write(" </references>\n") - output.write(" <alpha>\n") - self.serialize_xrefs_alpha(output) - output.write(" </alpha>\n") - output.write(" <constructors>\n") - self.serialize_xrefs_constructors(output) - output.write(" </constructors>\n") - output.write(" <functions>\n") - self.serialize_xrefs_functions(output) - output.write(" </functions>\n") - output.write(" <files>\n") - self.serialize_xrefs_files(output) - output.write(" </files>\n") - output.write(" <index>\n") - self.serialize_xrefs_index(output) - output.write(" </index>\n") - def serialize(self): filename = "%s/%s-api.xml" % (self.path, self.name) if not quiet: @@ -2519,16 +2359,6 @@ class docBuilder: print("apibuild.py: %d error(s) encountered during generation" % self.errors, file=sys.stderr) sys.exit(3) - filename = "%s/%s-refs.xml" % (self.path, self.name) - if not quiet: - print("Saving XML Cross References %s" % (filename)) - output = open(filename, "w") - output.write('<?xml version="1.0" encoding="ISO-8859-1"?>\n') - output.write("<apirefs name='%s'>\n" % self.name) - self.serialize_xrefs(output) - output.write("</apirefs>\n") - output.close() - class app: def warning(self, msg): -- 2.23.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 5f59d057f1..a360b546d6 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -146,18 +146,6 @@ dot_html = \ htmldir = $(HTML_DIR) html_DATA = $(css) $(png) $(gif) $(dot_html) -xml = \ - libvirt-api.xml - -qemu_xml = \ - libvirt-qemu-api.xml - -lxc_xml = \ - libvirt-lxc-api.xml - -admin_xml = \ - libvirt-admin-api.xml - apidir = $(pkgdatadir)/api api_DATA = \ libvirt-api.xml \ @@ -202,10 +190,7 @@ CLEANFILES = \ $(apihtml) \ $(internals_html) \ $(kbase_html) \ - $(xml) \ - $(qemu_xml) \ - $(lxc_xml) \ - $(admin_xml) \ + $(api_DATA) \ $(dot_html_generated_in) \ aclperms.htmlinc @@ -280,10 +265,7 @@ python_generated_files = \ html/libvirt-libvirt-qemu.html \ html/libvirt-libvirt-admin.html \ html/libvirt-virterror.html \ - libvirt-api.xml \ - libvirt-lxc-api.xml \ - libvirt-qemu-api.xml \ - libvirt-admin-api.xml \ + $(api_DATA) \ $(NULL) APIBUILD=$(srcdir)/apibuild.py -- 2.23.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 44 +++++++++++++++++++++++++++++++++++++++++++- docs/docs.html.in | 4 ++++ docs/newapi.xsl | 13 +++++++------ 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index a360b546d6..db9470ae07 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -35,6 +35,10 @@ modules = \ virterror \ $(NULL) +modules_admin = libvirt-admin +modules_qemu = libvirt-qemu +modules_lxc = libvirt-lxc + apihtml = \ html/index.html \ $(apihtml_generated) @@ -43,6 +47,30 @@ apihtml_generated = \ $(addprefix html/libvirt-,$(addsuffix .html,$(modules))) \ $(NULL) +apiadminhtml = \ + html/index-admin.html \ + $(apiadminhtml_generated) + +apiadminhtml_generated = \ + $(addprefix html/libvirt-,$(addsuffix .html,$(modules_admin))) \ + $(NULL) + +apiqemuhtml = \ + html/index-qemu.html \ + $(apiqemuhtml_generated) + +apiqemuhtml_generated = \ + $(addprefix html/libvirt-,$(addsuffix .html,$(modules_qemu))) \ + $(NULL) + +apilxchtml = \ + html/index-lxc.html \ + $(apilxchtml_generated) + +apilxchtml_generated = \ + $(addprefix html/libvirt-,$(addsuffix .html,$(modules_lxc))) \ + $(NULL) + apipng = \ html/left.png \ html/up.png \ @@ -50,7 +78,7 @@ apipng = \ html/right.png apirefdir = $(HTML_DIR)/html -apiref_DATA = $(apihtml) $(apipng) +apiref_DATA = $(apihtml) $(apiadminhtml) $(apiqemuhtml) $(apilxchtml) $(apipng) css = \ generic.css \ @@ -188,6 +216,9 @@ aclperms.htmlinc: $(top_srcdir)/src/access/viraccessperm.h \ CLEANFILES = \ $(dot_html) \ $(apihtml) \ + $(apiadminhtml) \ + $(apiqemuhtml) \ + $(apilxchtml) \ $(internals_html) \ $(kbase_html) \ $(api_DATA) \ @@ -252,6 +283,9 @@ EXTRA_DIST += \ || { rm $@ && exit 1; } $(apihtml_generated): html/index.html +$(apiadminhtml_generated): html/index-admin.html +$(apiqemuhtml_generated): html/index-qemu.html +$(apilxchtml_generated): html/index-lxc.html html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP) $(AM_V_GEN)$(XSLTPROC) --nonet -o ./ \ @@ -260,6 +294,14 @@ html/index.html: libvirt-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP) $(srcdir)/newapi.xsl libvirt-api.xml && \ $(XMLLINT) --nonet --noout html/*.html +html/index-%.html: libvirt-%-api.xml newapi.xsl page.xsl $(APIBUILD_STAMP) + $(AM_V_GEN)$(XSLTPROC) --nonet -o ./ \ + --stringparam builddir '$(abs_top_builddir)' \ + --stringparam timestamp $(timestamp) \ + --stringparam indexfile $(@:html/%=%) \ + $(srcdir)/newapi.xsl $< && \ + $(XMLLINT) --nonet --noout html/*.html + python_generated_files = \ html/libvirt-libvirt-lxc.html \ html/libvirt-libvirt-qemu.html \ diff --git a/docs/docs.html.in b/docs/docs.html.in index 6cf09f51bc..268c16f3b3 100644 --- a/docs/docs.html.in +++ b/docs/docs.html.in @@ -106,6 +106,10 @@ <a href="html/libvirt-libvirt-secret.html">secret</a>, <a href="html/libvirt-libvirt-storage.html">storage</a>, <a href="html/libvirt-libvirt-stream.html">stream</a> + and + <a href="html/index-admin.html">admin</a>, + <a href="html/index-qemu.html">QEMU</a>, + <a href="html/index-lxc.html">LXC</a> libs </dd> <dt><a href="drivers.html">Drivers</a></dt> diff --git a/docs/newapi.xsl b/docs/newapi.xsl index ca8c703d5c..dd6169397b 100644 --- a/docs/newapi.xsl +++ b/docs/newapi.xsl @@ -23,6 +23,7 @@ <xsl:key name="symbols" match="/api/symbols/*" use="@name"/> <xsl:param name="builddir" select="'..'"/> + <xsl:param name="indexfile" select="'index.html'"/> <!-- the target directory for the HTML output --> <xsl:variable name="htmldir">html</xsl:variable> @@ -101,10 +102,10 @@ <td><a accesskey="p" href="libvirt-{$previous/@name}.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></img></a></td> <th align="left"><a href="libvirt-{$previous/@name}.html"><xsl:value-of select="$previous/@name"/></a></th> </xsl:if> - <td><a accesskey="u" href="index.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td> - <th align="left"><a href="index.html">API documentation</a></th> - <td><a accesskey="h" href="../index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td> - <th align="center"><a href="../index.html">The virtualization API</a></th> + <td><a accesskey="u" href="{$indexfile}"><img src="up.png" width="24" height="24" border="0" alt="Up"></img></a></td> + <th align="left"><a href="{$indexfile}">API documentation</a></th> + <td><a accesskey="h" href="../{$indexfile}"><img src="home.png" width="24" height="24" border="0" alt="Home"></img></a></td> + <th align="center"><a href="../{$indexfile}">The virtualization API</a></th> <xsl:if test="$next"> <th align="right"><a href="libvirt-{$next/@name}.html"><xsl:value-of select="$next/@name"/></a></th> <td><a accesskey="n" href="libvirt-{$next/@name}.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></img></a></td> @@ -830,12 +831,12 @@ <xsl:call-template name="mainpage"/> </xsl:variable> <xsl:document - href="{concat($htmldir, '/index.html')}" + href="{concat($htmldir, '/', $indexfile)}" method="xml" indent="yes" encoding="UTF-8"> <xsl:apply-templates select="exsl:node-set($mainpage)" mode="page"> - <xsl:with-param name="pagename" select="concat($htmldir, '/index.html')"/> + <xsl:with-param name="pagename" select="concat($htmldir, '', $indexfile)"/> <xsl:with-param name="timestamp" select="$timestamp"/> </xsl:apply-templates> </xsl:document> -- 2.23.0

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 5 ----- 1 file changed, 5 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index db9470ae07..50b2fd7066 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -232,11 +232,6 @@ timestamp="$(shell if test -n "$$SOURCE_DATE_EPOCH"; \ date -u; \ fi)" -api: libvirt-api.xml -qemu_api: libvirt-qemu-api.xml -lxc_api: libvirt-lxc-api.xml -admin_api: libvirt-admin-api.xml - hvsupport.html: hvsupport.html.in hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \ -- 2.23.0

Some of the web content is only present in the source tree, thus when viewing pages from the build tree they appear missing. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/Makefile.am b/docs/Makefile.am index 50b2fd7066..0c828102e1 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -39,6 +39,30 @@ modules_admin = libvirt-admin modules_qemu = libvirt-qemu modules_lxc = libvirt-lxc +all: vpathhack + +# This hack enables us to view the web pages +# from within the uninstalled build tree +vpathhack: + for dir in fonts js logos; \ + do \ + ln -s $(srcdir)/$$dir $$dir ; \ + done + for file in $(css); \ + do \ + ln -s $(srcdir)/$$file $$file ; \ + done + +clean-local: + for dir in fonts js logos; \ + do \ + rm -f $$dir ; \ + done + for file in $(css); \ + do \ + rm -f $$file ; \ + done + apihtml = \ html/index.html \ $(apihtml_generated) -- 2.23.0

On Wed, Nov 20, 2019 at 03:28:47PM +0000, Daniel P. Berrangé wrote:
Some of the web content is only present in the source tree, thus when viewing pages from the build tree they appear missing.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
diff --git a/docs/Makefile.am b/docs/Makefile.am index 50b2fd7066..0c828102e1 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -39,6 +39,30 @@ modules_admin = libvirt-admin modules_qemu = libvirt-qemu modules_lxc = libvirt-lxc
+all: vpathhack + +# This hack enables us to view the web pages +# from within the uninstalled build tree +vpathhack: + for dir in fonts js logos; \
This should be @for dir in fonts js logos; \ to make it quiet
+ do \ + ln -s $(srcdir)/$$dir $$dir ; \
This should be prefixed by 'test -e $$dir || '
+ done + for file in $(css); \
likewise
+ do \ + ln -s $(srcdir)/$$file $$file ; \
This should be prefixed by 'test -e $$file || '
+ done
I've made this change locally but won't post a v2 unless there are other changes needing a respin too. 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 :|

The XSL generator loads included HTML files relative to the source dir but we need to tell it to load them from the build dir instead. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> --- docs/Makefile.am | 1 + docs/newapi.xsl | 1 - docs/page.xsl | 4 +++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/Makefile.am b/docs/Makefile.am index 0c828102e1..d4633b5d2f 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -293,6 +293,7 @@ EXTRA_DIST += \ style=subsite.xsl; \ fi; \ $(XSLTPROC) --stringparam pagename $$name \ + --stringparam builddir '$(abs_top_builddir)' \ --stringparam timestamp $(timestamp) --nonet \ $(top_srcdir)/docs/$$style $< > $@ \ || { rm $@ && exit 1; } diff --git a/docs/newapi.xsl b/docs/newapi.xsl index dd6169397b..670879dc48 100644 --- a/docs/newapi.xsl +++ b/docs/newapi.xsl @@ -22,7 +22,6 @@ <!-- Build keys for all symbols --> <xsl:key name="symbols" match="/api/symbols/*" use="@name"/> - <xsl:param name="builddir" select="'..'"/> <xsl:param name="indexfile" select="'index.html'"/> <!-- the target directory for the HTML output --> diff --git a/docs/page.xsl b/docs/page.xsl index 65ddeb2bb7..6f429ae087 100644 --- a/docs/page.xsl +++ b/docs/page.xsl @@ -7,6 +7,8 @@ exclude-result-prefixes="xsl exsl html" version="1.0"> + <xsl:param name="builddir" select="'..'"/> + <xsl:template match="node() | @*" mode="content"> <xsl:copy> <xsl:apply-templates select="node() | @*" mode="content"/> @@ -168,7 +170,7 @@ <xsl:template name="include"> <xsl:variable name="inchtml"> - <xsl:copy-of select="document(@filename)"/> + <xsl:copy-of select="document(concat($builddir, '/docs/', @filename))"/> </xsl:variable> <xsl:apply-templates select="exsl:node-set($inchtml)/html:html/html:body/*" mode="content"/> -- 2.23.0

On Wed, Nov 20, 2019 at 03:28:41PM +0000, Daniel P. Berrangé wrote:
There were a few problems in the docs build from the vpath build
https://www.redhat.com/archives/libvir-list/2019-November/msg00308.html
- We can't browse the website from the build dir - Including of the acl permissions was broken
This series fixes those two problems and also fixes the generation of API reference docs for admin, qemu & lxc APIs.
Finally there's a bunch of cleanups / simplifications in build rules
Daniel P. Berrangé (7): docs: stop using custom rules for building / installing web pages Drop building of API -refs.xml files docs: use variable for referencing API XML filenames docs: generate API reference pages for admin, qemu & lxc libraries docs: remove unused make targets docs: fix ability to view web pages from build tree docs: fix include of ACL permissions files
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
participants (2)
-
Daniel P. Berrangé
-
Pavel Hrdina