[libvirt] [PATCH 0/3] Improve release notes process

The release note process we have had in place since v2.5.0 was never meant to be anything more than a stop-gap measure until a better solution was devised. I believe this series implements exactly that better solution :) Andrea Bolognani (3): NEWS: Improve building pipeline NEWS: Reformat at generation time docs: Document the release notes process for contributors .gitignore | 1 + Makefile.am | 16 ++-- docs/Makefile.am | 22 ++++- docs/NEWS.xsl | 61 +++++++++++++ docs/hacking.html.in | 8 ++ docs/news.html.in | 157 -------------------------------- docs/news.xml | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++ docs/news.xsl | 103 ++++++++++++++------- docs/reformat-news.py | 111 +++++++++++++++++++++++ 9 files changed, 521 insertions(+), 199 deletions(-) create mode 100644 docs/NEWS.xsl delete mode 100644 docs/news.html.in create mode 100644 docs/news.xml create mode 100755 docs/reformat-news.py -- 2.7.4

Currently, building the NEWS file involves using a XSLT stylesheet to extract information from the same HTML file that's used on the libvirt website. The process works, but it's quite fiddly in that it requires the source HTML to be formatted in a very precise way, and a single missing newline can mess up the resulting plain text considerably. Moreover, the XSLT stylesheet itself encodes a lot of the details of converting to plain text in a way that's not necessarily easy to understand, tweak or fix. To improve the process, move all existing entries to a new XML file that contains exactly the information we care about in a simple structured format, and start generating both the HTML and plain text versions of the release notes using XSLT stylesheets that can now afford to be almost trivial. --- With this patch applied, the generated NEWS file is actually much worse off. That's fixed by the next one. .gitignore | 1 + Makefile.am | 6 +- docs/Makefile.am | 20 ++++- docs/NEWS.xsl | 61 ++++++++++++++ docs/news.html.in | 157 ----------------------------------- docs/news.xml | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/news.xsl | 103 ++++++++++++++++------- 7 files changed, 395 insertions(+), 194 deletions(-) create mode 100644 docs/NEWS.xsl delete mode 100644 docs/news.html.in create mode 100644 docs/news.xml diff --git a/.gitignore b/.gitignore index 984ad07..7b71bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ /docs/libvirt-lxc-*.xml /docs/libvirt-qemu-*.xml /docs/libvirt-refs.xml +/docs/news.html.in /docs/search.php /docs/todo.html.in /examples/admin/client_close diff --git a/Makefile.am b/Makefile.am index 50c358c..445e35e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,10 +46,10 @@ EXTRA_DIST = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc -NEWS: $(top_srcdir)/docs/news.xsl $(top_srcdir)/docs/news.html.in +NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet $(top_srcdir)/docs/news.xsl \ - $(top_srcdir)/docs/news.html.in \ + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl \ + $(srcdir)/docs/news.xml \ | perl -0777 -pe 's/\n\n+$$/\n/' \ | perl -pe 's/[ \t]+$$//' \ > $@-t && mv $@-t $@ ; fi diff --git a/docs/Makefile.am b/docs/Makefile.am index 790c0a2..6c1eb1f 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -106,9 +106,10 @@ internals_html = $(internals_html_in:%.html.in=%.html) # Since we ship pre-built html in the tarball, we must also # ship the sources, even when those sources are themselves # generated. -# Generate hvsupport.html first, since it takes one extra step. +# Generate hvsupport.html and news.html first, since they take one extra step. dot_html_in = \ hvsupport.html.in \ + news.html.in \ $(notdir $(wildcard $(srcdir)/*.html.in)) dot_html = $(dot_html_in:%.html.in=%.html) @@ -156,7 +157,7 @@ schema_DATA = $(wildcard $(srcdir)/schemas/*.rng) EXTRA_DIST= \ apibuild.py genaclperms.pl \ - site.xsl subsite.xsl newapi.xsl news.xsl page.xsl \ + site.xsl subsite.xsl newapi.xsl NEWS.xsl news.xsl page.xsl \ hacking1.xsl hacking2.xsl wrapstring.xsl \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ $(devhelphtml) $(devhelppng) $(devhelpcss) $(devhelpxsl) \ @@ -179,7 +180,7 @@ MAINTAINERCLEANFILES = \ $(addprefix $(srcdir)/,$(devhelphtml)) \ $(addprefix $(srcdir)/,$(internals_html)) \ $(addprefix $(srcdir)/,$(dot_php)) \ - $(srcdir)/hvsupport.html.in $(srcdir)/aclperms.htmlinc + $(srcdir)/hvsupport.html.in $(srcdir)/news.html.in $(srcdir)/aclperms.htmlinc all-am: web @@ -200,6 +201,19 @@ $(srcdir)/hvsupport.html.in: $(srcdir)/hvsupport.pl $(api_DATA) \ $(AM_V_GEN)$(PERL) $(srcdir)/hvsupport.pl $(top_srcdir)/src > $@ \ || { rm $@ && exit 1; } +# xsltproc seems to add the xmlns="" attribute to random output elements: +# use sed to strip it out, as leaving it there triggers XML errors during +# further transformation steps +news.html.in: $(srcdir)/news.xsl $(srcdir)/news.xml + $(AM_V_GEN) \ + if [ -x $(XSLTPROC) ]; then \ + $(XSLTPROC) --nonet $(srcdir)/news.xsl $(srcdir)/news.xml >$@-tmp \ + || { rm -f $@-tmp; exit 1; }; \ + sed 's/ xmlns=""//g' $@-tmp >$@ \ + || { rm -f $@-tmp; exit 1; }; \ + rm -f $@-tmp; \ + fi + %.png: %.fig convert -rotate 90 $< $@ diff --git a/docs/NEWS.xsl b/docs/NEWS.xsl new file mode 100644 index 0000000..0f1ca2a --- /dev/null +++ b/docs/NEWS.xsl @@ -0,0 +1,61 @@ +<?xml version="1.0"?> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="text" encoding="UTF-8"/> + + <!-- This XSLT stylesheet can be applied to the XML version of the release + notes to produce a plain text document. The output document is not + formatted properly and needs to be processed further --> + + <!-- Document --> + <xsl:template match="/releases"> + <xsl:text>libvirt releases +================ +</xsl:text> + <xsl:apply-templates select="release"/> + </xsl:template> + + <!-- Release --> + <xsl:template match="release"> + <xsl:text> +# </xsl:text> + <xsl:value-of select="@version"/> + <xsl:text> (</xsl:text> + <xsl:value-of select="@date"/> + <xsl:text>) +</xsl:text> + <xsl:apply-templates select="section"/> + </xsl:template> + + <!-- Section --> + <xsl:template match="section"> + <xsl:text> +* </xsl:text> + <xsl:value-of select="@title"/> + <xsl:text> +</xsl:text> + <xsl:apply-templates select="item"/> + </xsl:template> + + <!-- Item --> + <xsl:template match="item"> + <xsl:text> +- </xsl:text> + <xsl:apply-templates select="summary"/> + <xsl:apply-templates select="description"/> + </xsl:template> + + <!-- Item summary --> + <xsl:template match="summary"> + <xsl:value-of select="normalize-space()"/> + <xsl:text> +</xsl:text> + </xsl:template> + + <!-- Item description --> + <xsl:template match="description"> + <xsl:value-of select="normalize-space()"/> + <xsl:text> +</xsl:text> + </xsl:template> + +</xsl:stylesheet> diff --git a/docs/news.html.in b/docs/news.html.in deleted file mode 100644 index e544cfa..0000000 --- a/docs/news.html.in +++ /dev/null @@ -1,157 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml"> - <head> - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> - </head> - <body> - <h1>Releases</h1> - <p>This is the list of official releases for libvirt, along with an - overview of the changes introduced by each of them.</p> - <p>For a more fine-grained view, use the - <a href="http://libvirt.org/git/?p=libvirt.git;a=log">git log</a>. - </p> - - <h3>v3.0.0 (<i>unreleased</i>)</h3> - <ul> - <li><strong>New features</strong> - <ul> - <li>New localPtr attribute for "ip" element in network XML - </li> - <li>qemu: Support QEMU group I/O throttling<br/> - Add the capability to allow group I/O throttling via a new - domain <disk> <iotune> subelement "group_name" - to allow sharing I/O throttling quota between multiple drives - </li> - <li>nss: Introduce <code>libvirt-guest</code><br/> - New <code>libvirt-guest</code> nss module that translates libvirt - guest names into IP addresses - </li> - <li>daemon: Add support for runtime logging settings adjustment<br/> - Logging-related settings like log outputs and filters can now be - adjusted during runtime using the admin interface without the - necessity of the daemon's restart - </li> - <li>storage: Add virStorageVolInfoFlags API<br/> - Add the API to support using the VIR_STORAGE_VOL_GET_PHYSICAL - flag in order to return the host physical size in bytes - of the image container in the allocation field of the - _virStorageVolInfo structure. The --physical flag has been - added to the virsh vol-info command to access the data - </li> - </ul> - </li> - <li><strong>Improvements</strong> - <ul> - <li>perf: Add more perf statistics<br/> - Add support to get the count of branch instructions - executed, branch misses, bus cycles, stalled frontend - cpu cycles, stalled backend cpu cycles, and ref cpu - cycles by applications running on the platform - </li> - <li>conf: Display <physical> for volume xml<br/> - Add a display of the <physical> size of a disk - volume in the output of the volume XML - </li> - </ul> - </li> - <li><strong>Bug fixes</strong> - <ul> - <li>qemu: Correct GetBlockInfo values<br/> - For an active domain, correct the physical value provided for - a raw sparse file backed storage and the allocation value provided - for a qcow2 file backed storage that hasn't yet been opened on - the domain - </li> - <li>qemu: Make virtio console usable on ppc64 guests<br/> - The chardev detection code has been improved and can now handle this - configuration properly - </li> - <li>qemu: Enable mount namespace<br/> - To avoid funny races with udev relabelling devices under our hands and - to enhance security, libvirt now spawns each qemu process with its own - <code>/dev</code>.</li> - </ul> - </li> - </ul> - - <h3>v2.5.0 (2016-12-04)</h3> - <ul> - <li><strong>New features</strong> - <ul> - <li>shmem: Add support for additional models<br/> - The shmem device can now utilize QEMU's ivshmem-plain and - ivshmem-doorbell, more modern versions of ivshmem - </li> - <li>vbox: Add VirtualBox 5.1 support - </li> - <li>libssh: New transport<br/> - The new libssh transport allows one to connect to a running - libvirtd via SSH, using the libssh library; for example: - <tt>qemu+libssh://<i>server</i>/system</tt> - </li> - <li>vhost-scsi: Add support scsi_host hostdev passthrough<br/> - Add the capability to pass through a scsi_host HBA and the - associated LUNs to the guest - </li> - <li>qemu: Users can now enable debug logging for native gluster - volumes in qemu using the "gluster_debug_level" option in qemu.conf - </li> - <li>memory hotplug: Slot numbers for memory devices are now - automatically allocated and thus persistent. In addition slot numbers - can be specified without providing a base address, which simplifies - user configuration - </li> - <li>qemu: Express devices will be placed on PCIe bus by default<br/> - For machine types that use a PCI Express root bus - (e.g. x86_64/Q35 and aarch64/virt), any unaddressed PCI - device that is an Express device (all virtio-1.0 devices, - e1000e, nec-xhci, vfio assigned devices) will be placed on - an Express controller (i.e. a pcie-root-port) instead of a - legacy PCI controller (i.e. pci-bridge) with the root ports - added as needed - </li> - </ul> - </li> - <li><strong>Improvements</strong> - <ul> - <li>docs: Better documentation for migration APIs and flags - </li> - <li>vbox: Address thread safety issues - </li> - <li>virsh: Add support for passing an alternative persistent XML - to migrate command - </li> - <li>vhostuser: Allow hotplug of multiqueue devices - </li> - <li>NEWS: Switch to an improved format<br/> - List user-visible changes instead of single commits for a better - high-level overview of differences between libvirt releases - </li> - <li>website: Modernize layout and branding<br/> - The libvirt website looked very cluttered and outdated; it has now - been completely overhauled, resulting in a design that's better - organized and more pleasant to look at - </li> - </ul> - </li> - <li><strong>Bug fixes</strong> - <ul> - <li>vz: Fix migration in P2P mode - </li> - <li>Forbid newline character in names of some libvirt objects - </li> - <li>Fix compilation on macOS - </li> - </ul> - </li> - </ul> - - <p>Releases earlier than v2.5.0 detailed their changes using a different - format and as such are excluded from the list above. - You can read about those older release, starting from those made in - <a href="news-2016.html">2016</a>. - </p> - - </body> -</html> diff --git a/docs/news.xml b/docs/news.xml new file mode 100644 index 0000000..fab74b2 --- /dev/null +++ b/docs/news.xml @@ -0,0 +1,241 @@ +<?xml version="1.0"?> + +<!-- libvirt release notes + + This file will be processed to produce both HTML and plain text versions + of the release notes. + + Please keep the style consistent with existing entries as much as + possible: each item should have a short, one-sentence summary and + optionally a description where the change is explained in more detail --> + +<releases> + <release version="v3.0.0" date="unreleased"> + <section title="New features"> + <item> + <summary> + New localPtr attribute for "ip" element in network XML + </summary> + </item> + <item> + <summary> + qemu: Support QEMU group I/O throttling + </summary> + <description> + Add the capability to allow group I/O throttling via a new + domain <disk> <iotune> subelement "group_name" + to allow sharing I/O throttling quota between multiple drives + </description> + </item> + <item> + <summary> + nss: Introduce <code>libvirt-guest</code> + </summary> + <description> + New <code>libvirt-guest</code> nss module that translates libvirt + guest names into IP addresses + </description> + </item> + <item> + <summary> + daemon: Add support for runtime logging settings adjustment + </summary> + <description> + Logging-related settings like log outputs and filters can now be + adjusted during runtime using the admin interface without the + necessity of the daemon's restart + </description> + </item> + <item> + <summary> + storage: Add virStorageVolInfoFlags API + </summary> + <description> + Add the API to support using the VIR_STORAGE_VOL_GET_PHYSICAL + flag in order to return the host physical size in bytes + of the image container in the allocation field of the + _virStorageVolInfo structure. The --physical flag has been + added to the virsh vol-info command to access the data + </description> + </item> + </section> + <section title="Improvements"> + <item> + <summary> + perf: Add more perf statistics + </summary> + <description> + Add support to get the count of branch instructions + executed, branch misses, bus cycles, stalled frontend + cpu cycles, stalled backend cpu cycles, and ref cpu + cycles by applications running on the platform + </description> + </item> + <item> + <summary> + conf: Display <physical> for volume xml + </summary> + <description> + Add a display of the <physical> size of a disk + volume in the output of the volume XML + </description> + </item> + </section> + <section title="Bug fixes"> + <item> + <summary> + qemu: Correct GetBlockInfo values + </summary> + <description> + For an active domain, correct the physical value provided for + a raw sparse file backed storage and the allocation value provided + for a qcow2 file backed storage that hasn't yet been opened on + the domain + </description> + </item> + <item> + <summary> + qemu: Make virtio console usable on ppc64 guests + </summary> + <description> + The chardev detection code has been improved and can now handle this + configuration properly + </description> + </item> + <item> + <summary> + qemu: Enable mount namespace + </summary> + <description> + To avoid funny races with udev relabelling devices under our hands and + to enhance security, libvirt now spawns each qemu process with its own + <code>/dev</code>. + </description> + </item> + </section> + </release> + <release version="v2.5.0" date="2016-12-04"> + <section title="New features"> + <item> + <summary> + shmem: Add support for additional models + </summary> + <description> + The shmem device can now utilize QEMU's ivshmem-plain and + ivshmem-doorbell, more modern versions of ivshmem + </description> + </item> + <item> + <summary> + vbox: Add VirtualBox 5.1 support + </summary> + </item> + <item> + <summary> + libssh: New transport + </summary> + <description> + The new libssh transport allows one to connect to a running + libvirtd via SSH, using the libssh library; for example: + <tt>qemu+libssh://<i>server</i>/system</tt> + </description> + </item> + <item> + <summary> + vhost-scsi: Add support scsi_host hostdev passthrough + </summary> + <description> + Add the capability to pass through a scsi_host HBA and the + associated LUNs to the guest + </description> + </item> + <item> + <summary> + qemu: Users can now enable debug logging for native gluster + volumes in qemu using the "gluster_debug_level" option in qemu.conf + </summary> + </item> + <item> + <summary> + memory hotplug: Slot numbers for memory devices are now + automatically allocated and thus persistent. In addition slot numbers + can be specified without providing a base address, which simplifies + user configuration + </summary> + </item> + <item> + <summary> + qemu: Express devices will be placed on PCIe bus by default + </summary> + <description> + For machine types that use a PCI Express root bus + (e.g. x86_64/Q35 and aarch64/virt), any unaddressed PCI + device that is an Express device (all virtio-1.0 devices, + e1000e, nec-xhci, vfio assigned devices) will be placed on + an Express controller (i.e. a pcie-root-port) instead of a + legacy PCI controller (i.e. pci-bridge) with the root ports + added as needed + </description> + </item> + </section> + <section title="Improvements"> + <item> + <summary> + docs: Better documentation for migration APIs and flags + </summary> + </item> + <item> + <summary> + vbox: Address thread safety issues + </summary> + </item> + <item> + <summary> + virsh: Add support for passing an alternative persistent XML + to migrate command + </summary> + </item> + <item> + <summary> + vhostuser: Allow hotplug of multiqueue devices + </summary> + </item> + <item> + <summary> + NEWS: Switch to an improved format + </summary> + <description> + List user-visible changes instead of single commits for a better + high-level overview of differences between libvirt releases + </description> + </item> + <item> + <summary> + website: Modernize layout and branding + </summary> + <description> + The libvirt website looked very cluttered and outdated; it has now + been completely overhauled, resulting in a design that's better + organized and more pleasant to look at + </description> + </item> + </section> + <section title="Bug fixes"> + <item> + <summary> + vz: Fix migration in P2P mode + </summary> + </item> + <item> + <summary> + Forbid newline character in names of some libvirt objects + </summary> + </item> + <item> + <summary> + Fix compilation on macOS + </summary> + </item> + </section> + </release> +</releases> diff --git a/docs/news.xsl b/docs/news.xsl index 33506a9..a940026 100644 --- a/docs/news.xsl +++ b/docs/news.xsl @@ -1,50 +1,91 @@ <?xml version="1.0"?> -<xsl:stylesheet version="1.0" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> - <xsl:output method="text" encoding="UTF-8"/> - - <xsl:template match="/"> - <xsl:text>libvirt releases -================ -</xsl:text> - <xsl:apply-templates select="html:html/html:body/*"/> - </xsl:template> +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="xml" indent="yes" encoding="UTF-8"/> - <xsl:template match="html:h1"/> - <xsl:template match="html:p"/> + <!-- This XSLT stylesheet can be applied to the XML version of the release + notes to produce an HTML document suitable for further processing. + In particular, the final output will end up on the libvirt website --> - <xsl:template match="html:h3"> - <xsl:text> + <!-- Document --> + <xsl:template match="/releases"> + <xsl:text disable-output-escaping="yes"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> </xsl:text> - <xsl:text># </xsl:text> - <xsl:apply-templates/> - <xsl:text> + <html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> + </head> + <body> + <h1>Releases</h1> + <p>This is the list of official releases for libvirt, along with an + overview of the changes introduced by each of them.</p> + <p>For a more fine-grained view, use the + <a href="http://libvirt.org/git/?p=libvirt.git;a=log">git log</a>. + </p> + <xsl:apply-templates select="release"/> + <p>Releases earlier than v2.5.0 detailed their changes using a + different format and as such are excluded from the list above. + You can read about those older release, starting from those made in + <a href="news-2016.html">2016</a>. + </p> + </body> + </html> + </xsl:template> -</xsl:text> + <!-- Release --> + <xsl:template match="release"> + <h3> + <strong> + <xsl:value-of select="@version"/> + <xsl:text> (</xsl:text> + <xsl:value-of select="@date"/> + <xsl:text>)</xsl:text> + </strong> + </h3> + <ul> + <xsl:apply-templates select="section"/> + </ul> </xsl:template> - <xsl:template match="html:ul"> - <xsl:apply-templates select="html:li"/> + <!-- Section --> + <xsl:template match="section"> + <li> + <strong> + <xsl:value-of select="@title"/> + </strong> + <ul> + <xsl:apply-templates select="item"/> + </ul> + </li> </xsl:template> - <xsl:template match="html:li"> - <xsl:text> * </xsl:text> - <xsl:apply-templates select="html:strong|*/html:li"/> + <!-- Item --> + <xsl:template match="item"> + <li> + <xsl:apply-templates select="summary"/> + <xsl:apply-templates select="description"/> + </li> </xsl:template> - <xsl:template match="html:li/*/html:li"> - <xsl:text> - </xsl:text> + <!-- Item summary --> + <xsl:template match="summary"> <xsl:apply-templates/> - <xsl:text> -</xsl:text> </xsl:template> - <xsl:template match="html:strong"> + <!-- Item description --> + <xsl:template match="description"> + <br/> <xsl:apply-templates/> - <xsl:text> + </xsl:template> -</xsl:text> + <!-- Misc HTML tags, add more as they are needed --> + <xsl:template match="code|i|tt"> + <xsl:text disable-output-escaping="yes"><</xsl:text> + <xsl:value-of select="name()"/> + <xsl:text disable-output-escaping="yes">></xsl:text> + <xsl:apply-templates/> + <xsl:text disable-output-escaping="yes"></</xsl:text> + <xsl:value-of select="name()"/> + <xsl:text disable-output-escaping="yes">></xsl:text> </xsl:template> </xsl:stylesheet> -- 2.7.4

On Wed, Jan 04, 2017 at 04:49:07PM +0100, Andrea Bolognani wrote:
Currently, building the NEWS file involves using a XSLT stylesheet to extract information from the same HTML file that's used on the libvirt website.
The process works, but it's quite fiddly in that it requires the source HTML to be formatted in a very precise way, and a single missing newline can mess up the resulting plain text considerably.
Moreover, the XSLT stylesheet itself encodes a lot of the details of converting to plain text in a way that's not necessarily easy to understand, tweak or fix.
To improve the process, move all existing entries to a new XML file that contains exactly the information we care about in a simple structured format, and start generating both the HTML and plain text versions of the release notes using XSLT stylesheets that can now afford to be almost trivial. --- With this patch applied, the generated NEWS file is actually much worse off. That's fixed by the next one.
.gitignore | 1 + Makefile.am | 6 +- docs/Makefile.am | 20 ++++- docs/NEWS.xsl | 61 ++++++++++++++ docs/news.html.in | 157 ----------------------------------- docs/news.xml | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/news.xsl | 103 ++++++++++++++++-------
NEWS.xsl and news.xsl will be the same file on some filesystems. I seem to recall that we are trying to "support" such filesystems, so there should be different naming.
7 files changed, 395 insertions(+), 194 deletions(-) create mode 100644 docs/NEWS.xsl delete mode 100644 docs/news.html.in create mode 100644 docs/news.xml
diff --git a/.gitignore b/.gitignore index 984ad07..7b71bd1 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,7 @@ /docs/libvirt-lxc-*.xml /docs/libvirt-qemu-*.xml /docs/libvirt-refs.xml +/docs/news.html.in
Since this is ignored now, it should have the "do not edit this file" somewhere inside the file, in a comment.
diff --git a/docs/news.xsl b/docs/news.xsl index 33506a9..a940026 100644 --- a/docs/news.xsl +++ b/docs/news.xsl
[...]
+ <p>Releases earlier than v2.5.0 detailed their changes using a + different format and as such are excluded from the list above. + You can read about those older release, starting from those made in + <a href="news-2016.html">2016</a>. + </p>
Maybe something similar would fit the NEWS file as well? Not required, though. Summary: The XSLT looks cleaner, although it's still XSL. The result is easier to read than the diff as well (just a hint for someone looking at it as well).

On Thu, 2017-01-05 at 10:39 +0100, Martin Kletzander wrote: [...]
docs/NEWS.xsl | 61 ++++++++++++++ docs/news.html.in | 157 --------------------------
docs/news.xml | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ docs/news.xsl | 103 ++++++++++++++++------- NEWS.xsl and news.xsl will be the same file on some filesystems. I seem to recall that we are trying to "support" such filesystems, so there should be different naming.
Good point. The names were rubbish anyway, I've changed them to news-ascii.xsl and news-html.xsl now. [...]
+/docs/news.html.in Since this is ignored now, it should have the "do not edit this file" somewhere inside the file, in a comment.
Done. [...]
+ <p>Releases earlier than v2.5.0 detailed their changes using a + different format and as such are excluded from the list above. + You can read about those older release, starting from those made in + <a href="news-2016.html">2016</a>. + </p> Maybe something similar would fit the NEWS file as well? Not required, though.
Again, good point. I'll come up with something. -- Andrea Bolognani / Red Hat / Virtualization

Instead of encoding formatting information inside the corresponding XSLT stylesheet, use a Python script to reformat the text appropriately based on a few simple markers. Splitting the task between the XSLT stylesheet and the Python script allows us to keep both parts very simple. --- Yeah, I'm not great at Python. Makefile.am | 16 ++++---- docs/Makefile.am | 2 +- docs/reformat-news.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 8 deletions(-) create mode 100755 docs/reformat-news.py diff --git a/Makefile.am b/Makefile.am index 445e35e..bb63993 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,13 +46,15 @@ EXTRA_DIST = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc -NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml - $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl \ - $(srcdir)/docs/news.xml \ - | perl -0777 -pe 's/\n\n+$$/\n/' \ - | perl -pe 's/[ \t]+$$//' \ - > $@-t && mv $@-t $@ ; fi +NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml $(srcdir)/docs/reformat-news.py + $(AM_V_GEN) \ + if [ -x $(XSLTPROC) ]; then \ + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml >$@-tmp \ + || { rm -f $@-tmp; exit 1; }; \ + $(srcdir)/docs/reformat-news.py $@-tmp >$@ \ + || { rm -f $@-tmp; exit 1; }; \ + rm -f $@-tmp; \ + fi $(top_srcdir)/HACKING: $(top_srcdir)/docs/hacking1.xsl \ $(top_srcdir)/docs/hacking2.xsl \ diff --git a/docs/Makefile.am b/docs/Makefile.am index 6c1eb1f..57e59ef 100644 --- a/docs/Makefile.am +++ b/docs/Makefile.am @@ -156,7 +156,7 @@ schemadir = $(pkgdatadir)/schemas schema_DATA = $(wildcard $(srcdir)/schemas/*.rng) EXTRA_DIST= \ - apibuild.py genaclperms.pl \ + apibuild.py reformat-news.py genaclperms.pl \ site.xsl subsite.xsl newapi.xsl NEWS.xsl news.xsl page.xsl \ hacking1.xsl hacking2.xsl wrapstring.xsl \ $(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \ diff --git a/docs/reformat-news.py b/docs/reformat-news.py new file mode 100755 index 0000000..bad845b --- /dev/null +++ b/docs/reformat-news.py @@ -0,0 +1,111 @@ +#!/usr/bin/env python + +# reformat-news.py: Reformat the NEWS file properly +# +# Copyright (C) 2017 Red Hat, Inc. +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library. If not, see +# <http://www.gnu.org/licenses/>. +# +# Authors: +# Andrea Bolognani <abologna@redhat.com> + +import sys + +COLUMNS = 80 + +def reformat_with_indent(text, initial_indent, indent): + + res = "" + line = initial_indent + + for word in text.split(): + + # If adding one more word (plus a whitespace, plus a newline) + # to the current line would push us over the desired number + # of columns we start a new line instead + if len(line) + len(word) > (COLUMNS - 2): + res = res + line + "\n" + line = indent + + # We need to take care when we've just started a new line, + # as we don't want to add any additional leading whitespace + # in that case + if line == indent or line == initial_indent: + line = line + word + else: + line = line + " " + word + + # Append whatever's left + res = res + line + "\n" + + return res + + +def reformat(line): + + # Empty lines don't need to be reformatted or even inspected + if len(line) == 0: + return "\n" + + # For all non-empty lines, we decide the indentation level based + # on the first character + marker = line[0] + + # Heading or release + if marker == '=' or marker == '#': + initial_indent = 0 + indent = 2 + # Section + elif marker == '*': + initial_indent = 2 + indent = 4 + # Item summary + elif marker == '-': + initial_indent = 4 + indent = 6 + # Item description + else: + initial_indent = 8 + indent = 8 + + return reformat_with_indent(line, " " * initial_indent, " " * indent) + + +def main(args): + + if len(args) < 2: + sys.stdout.write("Usage: " + args[0] + " FILE\n") + sys.exit(1) + + with open(args[1], 'r') as f: + + started = False + + for line in f: + + # We don't actually start reformatting until we hit this + # specific marker so we can have some pre-formatted text, + # such as the title, at the start of the file + if line[0] == '=': + started = True + + if not started: + sys.stdout.write(line) + else: + sys.stdout.write(reformat(line.strip())) + + +if __name__ == "__main__": + main(sys.argv) -- 2.7.4

On Wed, Jan 04, 2017 at 04:49:08PM +0100, Andrea Bolognani wrote:
Instead of encoding formatting information inside the corresponding XSLT stylesheet, use a Python script to reformat the text appropriately based on a few simple markers.
Splitting the task between the XSLT stylesheet and the Python script allows us to keep both parts very simple. --- Yeah, I'm not great at Python.
Oh, so that's why there's not print(), just sys.stdout.write()... =) I'm not going to comment on the python style, for me it's enough that it works now, it can be made more python-ish later on.
Makefile.am | 16 ++++---- docs/Makefile.am | 2 +- docs/reformat-news.py | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 8 deletions(-) create mode 100755 docs/reformat-news.py
diff --git a/Makefile.am b/Makefile.am index 445e35e..bb63993 100644 --- a/Makefile.am +++ b/Makefile.am @@ -46,13 +46,15 @@ EXTRA_DIST = \ pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = libvirt.pc libvirt-qemu.pc libvirt-lxc.pc libvirt-admin.pc
-NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml - $(AM_V_GEN)if [ -x $(XSLTPROC) ] ; then \ - $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl \ - $(srcdir)/docs/news.xml \ - | perl -0777 -pe 's/\n\n+$$/\n/' \ - | perl -pe 's/[ \t]+$$//' \ - > $@-t && mv $@-t $@ ; fi +NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml $(srcdir)/docs/reformat-news.py
This ^^ and
+ $(AM_V_GEN) \ + if [ -x $(XSLTPROC) ]; then \ + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml >$@-tmp \
^^ this fails (. Do you even) syntax-check.

On Thu, 2017-01-05 at 10:54 +0100, Martin Kletzander wrote:
Yeah, I'm not great at Python. Oh, so that's why there's not print(), just sys.stdout.write()... =)
AFAIK Python 2's print statement and Python 3's print() function are not entirely comparable, eg. there's no obvious way to use print to display a string that's already newline-terminated without Python adding one extra newline and still have the code run on both major Python versions, whereas sys.stdout.write() doesn't have the same issue. I could be entirely wrong though :)
I'm not going to comment on the python style, for me it's enough that it works now, it can be made more python-ish later on.
Works for me ;) [...]
+NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml $(srcdir)/docs/reformat-news.py This ^^ and + $(AM_V_GEN) \ + if [ -x $(XSLTPROC) ]; then \ + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml >$@-tmp \ ^^ this fails (. Do you even) syntax-check.
I quite clearly didn't. Will fix. -- Andrea Bolognani / Red Hat / Virtualization

On Thu, Jan 05, 2017 at 12:23:29PM +0100, Andrea Bolognani wrote:
On Thu, 2017-01-05 at 10:54 +0100, Martin Kletzander wrote:
Yeah, I'm not great at Python. Oh, so that's why there's not print(), just sys.stdout.write()... =)
AFAIK Python 2's print statement and Python 3's print() function are not entirely comparable, eg. there's no obvious way to use print to display a string that's already newline-terminated without Python adding one extra newline and still have the code run on both major Python versions, whereas sys.stdout.write() doesn't have the same issue.
I could be entirely wrong though :)
You are not. This is solved by "from __future__ import print_function" which makes the print work as in python3. What I find totally baffling is that we use python2's statement and even though I have python3 as default, it doesn't fail. Even if I use --with-python=python3, we still have PYTHON=python2 in the Makefiles. I'm totally not in the mood for finding out the cause as I'm currently dealing with yet another unexplainable problem I'm facing and I'm getting exhausted pretty quickly. sys.*.write is perfectly fine
I'm not going to comment on the python style, for me it's enough that it works now, it can be made more python-ish later on.
Works for me ;)
[...]
+NEWS: $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml $(srcdir)/docs/reformat-news.py This ^^ and + $(AM_V_GEN) \ + if [ -x $(XSLTPROC) ]; then \ + $(XSLTPROC) --nonet $(srcdir)/docs/NEWS.xsl $(srcdir)/docs/news.xml >$@-tmp \ ^^ this fails (. Do you even) syntax-check.
I quite clearly didn't. Will fix.
-- Andrea Bolognani / Red Hat / Virtualization

Now that we have built a fairly solid process for dealing with release notes, we should start pushing for contributors to provide the relevant information along with their code: documenting the process is clearly a requirement for this to happen. --- docs/hacking.html.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 47475a2..f6e9d7a 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -293,6 +293,14 @@ <li> <p>Update tests and/or documentation, particularly if you are adding a new feature or changing the output of a program.</p> + + <p>If your changes are significant, you should also document them + in the <a href="news.html">release notes</a>. The rule of thumb is + that user-visible changes, such as adding new XML elements or fixing + all but the most obscure bugs, should be documented properly; changes + that are only relevant to other libvirt developers, such as code + refactoring, should not. + </p> </li> </ol> -- 2.7.4

On Wed, Jan 04, 2017 at 04:49:09PM +0100, Andrea Bolognani wrote:
Now that we have built a fairly solid process for dealing with release notes, we should start pushing for contributors to provide the relevant information along with their code: documenting the process is clearly a requirement for this to happen. --- docs/hacking.html.in | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 47475a2..f6e9d7a 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -293,6 +293,14 @@ <li> <p>Update tests and/or documentation, particularly if you are adding a new feature or changing the output of a program.</p> + + <p>If your changes are significant, you should also document them + in the <a href="news.html">release notes</a>. The rule of thumb is + that user-visible changes, such as adding new XML elements or fixing + all but the most obscure bugs, should be documented properly; changes
"documented" doesn't necessarily mean "documented in release notes", I would like to have this clarified here.
+ that are only relevant to other libvirt developers, such as code + refactoring, should not. + </p>
Don't be afraid of "must" here, as in RFC 2119, or just do what the previous paragraph does and say: "Update release notes when ..." Maybe this can be in its own list item.
</li> </ol>
-- 2.7.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Thu, Jan 05, 2017 at 11:03:51AM +0100, Martin Kletzander wrote:
On Wed, Jan 04, 2017 at 04:49:09PM +0100, Andrea Bolognani wrote:
Now that we have built a fairly solid process for dealing with release notes, we should start pushing for contributors to provide the relevant information along with their code: documenting the process is clearly a requirement for this to happen. --- docs/hacking.html.in | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/docs/hacking.html.in b/docs/hacking.html.in index 47475a2..f6e9d7a 100644 --- a/docs/hacking.html.in +++ b/docs/hacking.html.in @@ -293,6 +293,14 @@ <li> <p>Update tests and/or documentation, particularly if you are adding a new feature or changing the output of a program.</p> + + <p>If your changes are significant, you should also document them + in the <a href="news.html">release notes</a>. The rule of thumb is + that user-visible changes, such as adding new XML elements or fixing + all but the most obscure bugs, should be documented properly; changes
"documented" doesn't necessarily mean "documented in release notes", I would like to have this clarified here.
+ that are only relevant to other libvirt developers, such as code + refactoring, should not. + </p>
Don't be afraid of "must" here, as in RFC 2119, or just do what the previous paragraph does and say: "Update release notes when ..."
Maybe this can be in its own list item.
</li> </ol>
Oh, and you forgot to regenerate HACKING again ;)

On Wed, Jan 04, 2017 at 04:49:06PM +0100, Andrea Bolognani wrote:
The release note process we have had in place since v2.5.0 was never meant to be anything more than a stop-gap measure until a better solution was devised. I believe this series implements exactly that better solution :)
I quite like it, so from me, I'd say ACK with some fixes (the things I pointed out), but I'll leave it to you whether you want v2 or wait for more people to express their opinions.
Andrea Bolognani (3): NEWS: Improve building pipeline NEWS: Reformat at generation time docs: Document the release notes process for contributors
.gitignore | 1 + Makefile.am | 16 ++-- docs/Makefile.am | 22 ++++- docs/NEWS.xsl | 61 +++++++++++++ docs/hacking.html.in | 8 ++ docs/news.html.in | 157 -------------------------------- docs/news.xml | 241 ++++++++++++++++++++++++++++++++++++++++++++++++++ docs/news.xsl | 103 ++++++++++++++------- docs/reformat-news.py | 111 +++++++++++++++++++++++ 9 files changed, 521 insertions(+), 199 deletions(-) create mode 100644 docs/NEWS.xsl delete mode 100644 docs/news.html.in create mode 100644 docs/news.xml create mode 100755 docs/reformat-news.py
-- 2.7.4
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Thu, 2017-01-05 at 11:05 +0100, Martin Kletzander wrote:
The release note process we have had in place since v2.5.0 was never meant to be anything more than a stop-gap measure until a better solution was devised. I believe this series implements exactly that better solution :) I quite like it, so from me, I'd say ACK with some fixes (the things I pointed out), but I'll leave it to you whether you want v2 or wait for more people to express their opinions.
I think your ACK is enough, and I'd rather avoid keeping this on the list longer than necessary. If there's any detail that needs to be smoothed out we can deal with it after merge. I've just posted v2. -- Andrea Bolognani / Red Hat / Virtualization
participants (2)
-
Andrea Bolognani
-
Martin Kletzander