Skip to contentSkip to conversation

Provide support matrix generator

PATCH In review Ian Jackson 4 participants 17 messages Apr 12, 2018

lore
Share & tools
lore
#0 lore raw

v3 cover Provide support matrix generator

This series provides code to generate a feature support matrix, to replace the one on the wiki. You can see an example of the output here:
https://xenbits.xen.org/people/iwj/2018/support-matrix-example-v3a/t.html
https://xenbits.xen.org/people/iwj/2018/support-matrix-example-v3b/t.html
There is also an accompanying SUPPORT.html to make the links for 4.11 work. (The links into the 4.10 SUPPORT.html do not work in this example, but they should do when this makes it into stable-4.10.)

This is similar to v2, except that I have fixed the bug identified by Lars where the [*] annotation would be added onto the last applicable table row.

Fixing this produced some infelicitous output, which patch 10 fixes. Patch 11 is optional. I prefer it, but others may prefer without. Of the links above, v3a is without patch 11, and v3b is with it.

ar 01/11] SUPPORT.md: Syntax: Fix some bullet lists
ar 02/11] SUPPORT.md: Syntax: Fix a typo "States"
r 03/11] SUPPORT.md: Syntax: Provide a title rather than a r 04/11] docs/gen-html-index: Extract titles from HTML documents r 05/11] docs/gen-html-index: Support documents at the toplevel r 06/11] docs/Makefile: Introduce GENERATE_PANDOC_RULE_RAW r 07/11] docs/Makefile: Format SUPPORT.md into the toplevel
* r 08/11] docs: Provide parse-support-md
* r 09/11] docs: Provide support-matrix-generate, to generate a
+ 10/11] docs/parse-support-md: Unify identical [*] in footnotes
+ 11/11] docs/parse-support-md: Identical [*]: only use extra

a = acked (by a tools or REST maintainer)
r = release-acked for 4.11
* = amended patch
+ = new patch

As before, I think if the output is tolerably accurate, it would be valuable to get this set up as a cron job ASAP. Stylistic and formatting improvements etc. can be done on top.

FAOD, I think this series is blocked awaiting review from another tools or REST maintainer. That's not particularly surprising at this stage of the release...

My plan is that the cron job will use the matrix generator from xen.git#master.

For my reference, this was generated with
docs/support-matrix-generate -D HEAD SUPPORT.html refs/heads/wip.support-stmt-NN https://xenbits.xen.org/docs/NN-testing/SUPPORT.html 2>&1 >docs/html/t.html |less rsync -LvP docs/html/{t,SUPPORT}.html xenbits:public_html/2018/support-matrix-example-v3b

Thanks,
Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw

PATCH v3 2/11 SUPPORT.md: Syntax: Fix a typo "States"

---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
SUPPORT.md +1 -1
index 1c5220b..e447069 100644
@@ -360,7 +360,7 @@ Guest-side driver capable of speaking the Xen PV block protocol
     Status, FreeBSD: Supported, Security support external
     Status, NetBSD: Supported, Security support external
     Status, OpenBSD: Supported, Security support external
-    States, Windows: Supported
+    Status, Windows: Supported
 
 Guest-side driver capable of speaking the Xen PV networking protocol
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH v3 1/11 SUPPORT.md: Syntax: Fix some bullet lists

In reply to Ian Jackson

Continuations of bullet list items must be indented by exactly 4 spaces (according to pandoc_markdown(5) on Debian jessie).

This is most easily achieved by making the bullet list items have two spaces before the `*'.

---
 SUPPORT.md | 36 ++++++++++++++++++------------------
 1 file changed, 18 insertions(+), 18 deletions(-)
SUPPORT.md +18 -18
index c72a25b..1c5220b 100644
@@ -783,40 +783,40 @@ What is the risk of it exhibiting bugs?
 
 General answers to the above:
 
- * **Here be dragons**
+  * **Here be dragons**
 
-   Pretty likely to still crash / fail to work.
-   Not recommended unless you like life on the bleeding edge.
+    Pretty likely to still crash / fail to work.
+    Not recommended unless you like life on the bleeding edge.
 
- * **Quirky**
+  * **Quirky**
 
-   Mostly works but may have odd behavior here and there.
-   Recommended for playing around or for non-production use cases.
+    Mostly works but may have odd behavior here and there.
+    Recommended for playing around or for non-production use cases.
 
- * **Normal**
+  * **Normal**
 
-   Ready for production use
+    Ready for production use
 
 ### Interface stability
 
 If I build a system based on the current interfaces,
 will they still work when I upgrade to the next version?
 
- * **Not stable**
+  * **Not stable**
 
-   Interface is still in the early stages and
-   still fairly likely to be broken in future updates.
+    Interface is still in the early stages and
+    still fairly likely to be broken in future updates.
 
- * **Provisionally stable**
+  * **Provisionally stable**
 
-   We're not yet promising backwards compatibility,
-   but we think this is probably the final form of the interface.
-   It may still require some tweaks.
+    We're not yet promising backwards compatibility,
+    but we think this is probably the final form of the interface.
+    It may still require some tweaks.
 
- * **Stable**
+  * **Stable**
 
-   We will try very hard to avoid breaking backwards  compatibility,
-   and to fix any regressions that are reported.
+    We will try very hard to avoid breaking backwards  compatibility,
+    and to fix any regressions that are reported.
 
 ### Security supported
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#3 lore raw

PATCH v3 3/11 SUPPORT.md: Syntax: Provide a title rather than a spurious empty section

In reply to Ian Jackson

This commits (more or less) this file to be processed with pandoc, rather than other markdown processors. There is, unfortunately, no widely-accepted way to declare a title for the document.

I tested feeding the document to markdown(1) on Debian jessie and it reproduced the % line as if it were simple text. I guess many other markdown processors will do something similarly tolerable. My internet searches did not discover a markdown processor that used lines starting with % for something else.

---
v2: Discuss the compatibility problems with & in the commit message.

---
 SUPPORT.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
SUPPORT.md +1 -1
index e447069..264b23f 100644
@@ -1,4 +1,4 @@
-# Support statement for this release
+% Support statement for this release
 
 This document describes the support status
 and in particular the security support status of the Xen branch
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw

PATCH v3 4/11 docs/gen-html-index: Extract titles from HTML documents

In reply to Ian Jackson
---
 docs/gen-html-index | 13 +++++++++++++
 1 file changed, 13 insertions(+)
docs/gen-html-index +13 -0
index e9792bf..5b43b42 100644
@@ -10,6 +10,7 @@ use warnings;
 use Getopt::Long;
 use IO::File;
 use File::Basename;
+use HTML::TreeBuilder::XPath;
 
 Getopt::Long::Configure('bundling');
 
@@ -64,6 +65,18 @@ sub make_linktext ($) {
     return "$1($2)" if $l =~ m,^man/(.*)\.([0-9].*)\.html,;
     $l =~ s/.(?:html|txt)$//g;
     return $index{$l} if exists $index{$l};
+
+    my $from_html;
+    eval {
+        my $tree = new HTML::TreeBuilder::XPath;
+        my $f = "$outdir/$l.html";
+        open F, '<', $f or die "$l $f $!";
+        $tree->parse_file(\*F) or die;
+        close F;
+        $from_html = $tree->findvalue("/html/head/title");
+    };
+    return $from_html if $from_html;
+
     return basename($l);
 }
 
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#6 lore raw

PATCH v3 6/11 docs/Makefile: Introduce GENERATE_PANDOC_RULE_RAW

In reply to Ian Jackson

We are going to want to format SUPPORT.md which does not match the filename patterns in docs/. So provide a way to make an ad-hoc rule using pandoc with the standard options.

No functional change in this patch.

---
 docs/Makefile | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
docs/Makefile +6 -5
index 6743fa3..d82463f 100644
@@ -237,17 +237,18 @@ txt/%.txt: %.markdown
 	$(INSTALL_DATA) $< $@
 
 # Metarule for generating pandoc rules.
-define GENERATE_PANDOC_RULE
-# $(1) is the target documentation format. $(2) is the source format.
-
-$(1)/%.$(1): %.$(2)
+define GENERATE_PANDOC_RULE_RAW
+$(1): $(2)
 ifneq ($(PANDOC),)
 	@$(INSTALL_DIR) $$(@D)
 	$(PANDOC) --number-sections --toc --standalone $$< --output $$@
 else
 	@echo "pandoc not installed; skipping $$@"
 endif
-
+endef
+define GENERATE_PANDOC_RULE
+# $(1) is the target documentation format. $(2) is the source format.
+$(call GENERATE_PANDOC_RULE_RAW,$(1)/%.$(1),%.$(2))
 endef
 $(eval $(call GENERATE_PANDOC_RULE,pdf,pandoc))   # pdf/%.pdf: %.pandoc
 $(eval $(call GENERATE_PANDOC_RULE,txt,pandoc))   # txt/%.txt: %.pandoc
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#7 lore raw

PATCH v3 7/11 docs/Makefile: Format SUPPORT.md into the toplevel

In reply to Ian Jackson
---
 docs/Makefile | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
docs/Makefile +4 -1
index d82463f..b300bb6 100644
@@ -28,7 +28,8 @@ DOC_MAN7 := $(patsubst man/%.pod.7,man7/%.7,$(MAN7SRC-y)) \
 	        $(patsubst man/%.markdown.7,man7/%.7,$(MAN7SRC-y))
 DOC_MAN8 := $(patsubst man/%.pod.8,man8/%.8,$(MAN8SRC-y)) \
 	        $(patsubst man/%.markdown.8,man8/%.8,$(MAN8SRC-y))
-DOC_HTML := $(patsubst %.markdown,html/%.html,$(MARKDOWNSRC-y)) \
+DOC_HTML := html/SUPPORT.html \
+            $(patsubst %.markdown,html/%.html,$(MARKDOWNSRC-y)) \
             $(patsubst %.pandoc,html/%.html,$(PANDOCSRC-y)) \
             $(patsubst man/%.markdown.1,html/man/%.1.html,$(MAN1SRC-y)) \
             $(patsubst man/%.markdown.5,html/man/%.5.html,$(MAN5SRC-y)) \
@@ -255,6 +256,8 @@ $(eval $(call GENERATE_PANDOC_RULE,txt,pandoc))   # txt/%.txt: %.pandoc
 $(eval $(call GENERATE_PANDOC_RULE,html,pandoc))  # html/%.html: %.pandoc
 $(eval $(call GENERATE_PANDOC_RULE,pdf,markdown)) # pdf/%.pdf: %.markdown
 
+$(eval $(call GENERATE_PANDOC_RULE_RAW,html/SUPPORT.html,$(XEN_ROOT)/SUPPORT.md)) # pdf/%.pdf: %.markdown
+
 ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 $(XEN_ROOT)/config/Docs.mk:
 	$(error You have to run ./configure before building docs)
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#8 lore raw

PATCH v3 8/11 docs: Provide parse-support-md

In reply to Ian Jackson

This utility reads json format pandoc output, from parsing one or more SUPPORT.md files, and generates an HTML table element containing the principal version and feature information.

This is rather hairier than I anticipated when I started out; hence the 400-odd-line Perl script.

Machinery to assemble the appropriate inputs for parse-support-md will be in the next commit.

---
v2: New in this version of the series.
v3: Refactor to introduce RealSect
v3: Add [*] footnote to all applicable entries, not just the last

---
 docs/parse-support-md | 414 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 414 insertions(+)
 create mode 100755 docs/parse-support-md
docs/parse-support-md new file +414 -0
new file mode 100755
index 0000000..83768cf
@@ -0,0 +1,414 @@
+#!/usr/bin/perl -w
+#
+# Written with reference to pandoc_markdown from Debian jessie
+# We require atx-style headers
+#
+# usage:
+#   pandoc -t json SUPPORT.md >j-unstable
+#   git-cat-file ... | pandoc -t json >j-4.10
+#   docs/parse-support-md \
+#            j-unstable https://xenbits/unstable/SUPPORT.html
+#            j-4.10 https://xenbits/4.10/SUPPORT.html
+# or equivalent
+
+use strict;
+use JSON;
+use Tie::IxHash;
+use IO::File;
+use CGI qw(escapeHTML);
+use Data::Dumper;
+
+#---------- accumulating input/output ----------
+
+# This combines information from all of the input files.
+
+sub new_sectlist () { { } };
+our $toplevel_sectlist = new_sectlist();
+# an $sectlist is
+#   { }                 nothing seen yet
+#   a tied hashref      something seen
+# (tied $sectlist)    is an object of type Tie::IxHash
+# $sectlist->{KEY} a $sectnode:
+# $sectlist->{KEY}{Status}[VI] = absent or markdown content
+# $sectlist->{KEY}{Children} = a further $sectlist
+# $sectlist->{KEY}{Key} = KEY
+# $sectlist->{KEY}{RealSect} = containing real section in @insections, so
+# $sectlist->{KEY}{RealSect}{HasText}[VI] = trueish iff there was a Para
+# $sectlist->{KEY}{RealSect}{Anchor} = value for < id="" > in the pandoc html
+# A $sectnode represents a single section from the original markdown
+# document.  Its subsections are in Children.
+#
+# Also, the input syntax:
+#    Status, something or other: Supported
+# is treated as a $sectnode, is as if it were a subsection -
+# one called `something or other'.
+#
+# KEY is the Anchor, or derived from the `something or other'.
+# It is used to match up identical features in different versions.
+
+#---------- state for this input file ----------
+
+our $version_index;
+our @version_urls;
+
+our @insections;
+# $insections[]{Key} = string
+# $insections[]{Headline} = markdown content
+# these next are only defined for real sections, not Status elements
+# $insections[]{Anchor} = string
+# $insections[]{HasText} = array, $sectlist->{HasText} will refer to this
+
+our $had_unknown;
+# adding new variable ?  it must be reset in r_toplevel
+
+#---------- parsing ----------
+
+sub ri_Header {
+    my ($c) = @_;
+    my ($level, $infos, $hl) = @$c;
+#print STDERR 'RI_HEADER ', Dumper($c, \@c);
+    my ($id) = @$infos;
+    die unless $level >= 1;
+    die unless $level-2 <= $#insections;
+    $#insections = $level-2;
+    push @insections,
+        {
+         Key => $id,
+         Anchor => $id,
+         Headline => $hl,
+         HasText => [],
+        };
+#print STDERR Dumper(\@insections);
+}
+
+sub ri_Para {
+    if (@insections) {
+        $insections[$#insections]{HasText}[$version_index] = 1;
+    }
+};
+
+sub parse_feature_entry ($) {
+    my ($value) = @_;
+    die unless @insections;
+
+    my $sectnode;
+    my $realsect;
+    foreach my $s (@insections) {
+        my $sectlist = $sectnode
+            ? $sectnode->{Children} : $toplevel_sectlist;
+        my $key = $s->{Key};
+        $realsect = $s if $s->{Anchor};
+        tie %$sectlist, 'Tie::IxHash' unless tied %$sectlist;
+#print STDERR "PARSE_FEATURE_ENTRY ", Dumper($s);
+        $sectlist->{$key} //=
+            {
+             Children => new_sectlist(),
+             Headline => $s->{Headline},
+             Key => $key,
+             RealSect => $realsect,
+            };
+        $sectnode = $sectlist->{$key};
+    }
+    die unless $sectnode;
+    $sectnode->{Status}[$version_index] = $value;
+}
+
+sub ri_CodeBlock {
+    my ($c) = @_;
+    my ($infos, $text) = @$c;
+
+    if ($text =~ m{^(?: Functional\ completeness 
+                   | Functional\ stability
+                   | Interface\ stability
+                   | Security\ supported ) \:}x) {
+        # ignore this
+        return;
+    }
+    die "$had_unknown / $text ?" if $had_unknown;
+
+    my $toplevel = $text =~ m{^Xen-Version:};
+
+    foreach my $l (split /\n/, $text) {
+        $l =~ s/\s*$//;
+        next unless $l =~ m/\S/;
+
+        my ($descr, $value) =
+            $toplevel
+            ? $l =~ m{^([A-Z][-A-Z0-9a-z]+)\:\s+(\S.*)$}
+            : $l =~ m{^(?:Status|Supported)(?:\,\s*([^:]+))?\:\s+(\S.*)$}
+            or die ("$text\n^ cannot parse status codeblock line:".
+                    ($toplevel and 'top').
+                    "\n$l\n ?");
+
+        die unless @insections;
+        my $insection = $insections[$#insections];
+
+        if (length $descr) {
+            my $key = lc $descr;
+            $key =~ y/ /-/;
+            $key =~ y/-0-9A-Za-z//cd;
+            $key = $insection->{Anchor}.'--'.$key;
+            push @insections,
+                {
+                 Key => $key,
+                 Headline => [{ t => 'Str', c => $descr }],
+                };
+        }
+        parse_feature_entry $value;
+        if (length $descr) {
+            pop @insections;
+        }
+    }
+}
+
+sub process_unknown {
+    my ($c, $e) = @_;
+    $had_unknown = Dumper($e);
+}
+
+sub r_content ($) {
+    my ($i) = @_;
+    foreach my $e (@$i) {
+        my $f = ${*::}{"ri_$e->{t}"};
+        $f //= \&process_unknown;
+        $f->($e->{c}, $e);
+    }
+}
+
+sub r_toplevel ($) {
+    my ($i) = @_;
+
+    die unless defined $version_index;
+
+    @insections = ();
+    $had_unknown = undef;
+
+    foreach my $e (@$i) {
+        next unless ref $e eq 'ARRAY';
+        r_content $e;
+    }
+}
+
+sub read_inputs () {
+    $version_index = 0;
+
+    local $/;
+    undef $/;
+
+    while (my $f = shift @ARGV) {
+        push @version_urls, shift @ARGV;
+        eval {
+            open F, '<', $f or die $!;
+            my $input_toplevel = decode_json <F>;
+            r_toplevel $input_toplevel;
+        };
+        die "$@\nwhile processing input file $f\n" if $@;
+        $version_index++;
+    }
+}
+
+#---------- reprocessing ----------
+
+# variables generated by analyse_reprocess:
+our $maxdepth;
+
+sub pandoc2html_inline ($) {
+    my ($content) = @_;
+
+    my $json_fh = IO::File::new_tmpfile or die $!;
+    print $json_fh to_json([
+                            { unMeta => { } },
+                            [{ t => 'Para', c => $content }],
+                           ]) or die $!;
+    flush $json_fh or die $!;
+    seek $json_fh,0,0 or die $!;
+
+    my $c = open PD, "-|" // die $!;
+    if (!$c) {
+        open STDIN, "<&", $json_fh;
+        exec qw(pandoc -f json) or die $!;
+    }
+
+    local $/;
+    undef $/;
+    my $html = <PD>;
+    $?=$!=0;
+    if (!close PD) {
+        eval {
+            seek $json_fh,0,0 or die $!;
+            open STDIN, '<&', $json_fh or die $!;
+            system 'json_pp';
+        };
+        die "\n $? $!";
+    }
+
+    $html =~ s{^\<p\>}{} or die "$html ?";
+    $html =~ s{\</p\>$}{} or die "$html ?";
+    $html =~ s{\n$}{};
+    return $html;
+}
+
+sub reprocess_sectlist ($$);
+
+sub reprocess_sectnode ($$) {
+    my ($sectnode, $d) = @_;
+
+    $sectnode->{Depth} = $d;
+
+    if ($sectnode->{Status}) {
+        $maxdepth = $d if $d > $maxdepth;
+    }
+
+    if ($sectnode->{Headline}) {
+#            print STDERR Dumper($sectnode);
+        $sectnode->{Headline} =
+            pandoc2html_inline $sectnode->{Headline};
+    }
+
+    reprocess_sectlist $sectnode->{Children}, $d;
+}
+
+sub reprocess_sectlist ($$) {
+    my ($sectlist, $d) = @_;
+    $d++;
+
+    foreach my $sectnode (values %$sectlist) {
+        reprocess_sectnode $sectnode, $d;
+    }
+}
+
+sub count_rows_sectlist ($);
+
+sub count_rows_sectnode ($) {
+    my ($sectnode) = @_;
+    my $rows = 0;
+    $rows++ if $sectnode->{Status};
+    $rows += count_rows_sectlist $sectnode->{Children};
+    $sectnode->{Rows} = $rows;
+    return $rows;
+}
+
+sub count_rows_sectlist ($) {
+    my ($sectlist) = @_;
+    my $rows = 0;
+    foreach my $sectnode (values %$sectlist) {
+        $rows += count_rows_sectnode $sectnode;
+    }
+    return $rows;
+}
+
+# After reprocess_sectlist,
+#    ->{Headline}   is in html
+#    ->{Status}     is in plain text
+
+sub analyse_reprocess () {
+    $maxdepth = 0;
+    reprocess_sectlist $toplevel_sectlist, 0;
+}
+
+#---------- output ----------
+
+sub o { print @_ or die $!; }
+
+our @pending_headings;
+
+sub write_output_row ($) {
+    my ($sectnode) = @_;
+#    print STDERR 'WOR ', Dumper($d, $sectnode);
+    o('<tr>');
+    my $span = sub {
+        my ($rowcol, $n) = @_;
+        o(sprintf ' %sspan="%d"', $rowcol, $n) if $n != 1;
+    };
+    # This is all a bit tricky because (i) the input is hierarchical
+    # with variable depth, whereas the output has to have a fixed
+    # number of heading columns on the LHS; (ii) the HTML
+    # colspan/rowspan system means that when we are writing out, we
+    # have to not write table elements for table entries which have
+    # already been written with a span instruction that covers what we
+    # would write now.
+    while (my $heading = shift @pending_headings) {
+        o('<th valign="top"');
+        o(sprintf ' id="%s"', $heading->{Key});
+        $span->('row', $heading->{Rows});
+        $span->('col', $maxdepth - $heading->{Depth} + 1)
+            if !%{ $heading->{Children} };
+        o(' align="left">');
+        o($heading->{Headline});
+        o('</th>');
+    }
+    if (%{ $sectnode->{Children} }) {
+        # we suppressed the colspan above, but we do need to make the gap
+        my $n = $maxdepth - $sectnode->{Depth};
+        die 'XX '. Dumper($n, $sectnode) if $n<0;
+        if ($n) {
+            o('<td');
+            $span->('col', $n);
+            o('></td>');
+        }
+    }
+    for (my $i=0; $i<@version_urls; $i++) {
+        my $st = $sectnode->{Status}[$i];
+        $st //= '-';
+        o('<td>');
+        my $end_a = '';
+        if ($sectnode->{Key} eq 'release-support--xen-version') {
+            o(sprintf '<a href="%s">', $version_urls[$i]);
+            $end_a = '</a>';
+        }
+        o(escapeHTML($st));
+        if ($sectnode->{RealSect}{HasText}[$i]
+            && $sectnode->{Status}[$i]
+            && $sectnode->{RealSect}{Anchor}) {
+            o(sprintf '<a href="%s#%s">[*]</a>',
+              $version_urls[$i], $sectnode->{RealSect}{Anchor});
+        }
+        o($end_a);
+        o('</td>');
+    }
+    o("</tr>\n");
+}      
+
+sub write_output_sectlist ($);
+sub write_output_sectlist ($) {
+    my ($sectlist) = @_;
+    foreach my $key (keys %$sectlist) {
+        my $sectnode = $sectlist->{$key};
+        push @pending_headings, $sectnode;
+        write_output_row $sectnode if $sectnode->{Status};
+        write_output_sectlist $sectnode->{Children};
+    }
+}
+
+sub write_output () {
+    o('<table rules="all">');
+    write_output_sectlist $toplevel_sectlist;
+    o('</table>');
+}
+
+#---------- main program ----------
+
+open DEBUG, '>', '/dev/null' or die $!;
+if (@ARGV && $ARGV[0] eq '-D') {
+    shift @ARGV;
+    open DEBUG, '>&2' or die $!;
+}
+
+die unless @ARGV;
+die if $ARGV[0] =~ m/^-/;
+die if @ARGV % 2;
+
+read_inputs();
+
+#use Data::Dumper;
+#print DEBUG Dumper($toplevel_sectlist);
+
+analyse_reprocess();
+# Now Headline is in HTML
+
+count_rows_sectlist($toplevel_sectlist);
+
+#use Data::Dumper;
+print DEBUG Dumper($toplevel_sectlist);
+
+write_output();
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#9 lore raw

PATCH v3 9/11 docs: Provide support-matrix-generate, to generate a support matrix in HTML

In reply to Ian Jackson

This archaeology script:
- figures out what the current and previous Xen versions were
- looks for appropriate git branches for them
- finds SUPPORT.md for each one
- feeds its findings to parse-support-md

We do not intend to integrate this into docs/Makefile, because it relies on the git history. Instead, we will take the rune provided in the head comment and paste a variant of it into an appropriate cronjob on xenbits.

---
v3: Provide -D option.

---
 .gitignore                         |   1 +
 docs/misc/support-matrix-head.html |  41 ++++++++
 docs/support-matrix-generate       | 186 +++++++++++++++++++++++++++++++++++++
 3 files changed, 228 insertions(+)
 create mode 100644 docs/misc/support-matrix-head.html
 create mode 100755 docs/support-matrix-generate
.gitignore +1 -0
index cd57530..7004349 100644
@@ -43,6 +43,7 @@ config/Paths.mk
 
 build-*
 dist/*
+docs/tmp.*
 docs/html/
 docs/man/xl.cfg.pod.5
 docs/man/xl.pod.1
docs/misc/support-matrix-head.html new file +41 -0

41 lines not on this page · raw message

docs/support-matrix-generate new file +186 -0

186 lines not on this page · raw message

Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#10 lore raw

PATCH v3 10/11 docs/parse-support-md: Unify identical [*] in footnotes

In reply to Ian Jackson

A section in the SUPPORT.md may mention multiple
Status, something: Supported
and then have some text. The text is linked to from [*] footnotes in the table. But, this means that each bit of text needs to apply to multiple rows.

Before this commit this was a separate [*] after each applicable item. But multiple apparently-different links to the same thing are annoying for the reader.

So, in this commit we combine them. Formatting the result is not entirely trivial.

---
v3: New patch

---
 docs/parse-support-md | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)
docs/parse-support-md +27 -7
index 83768cf..38c8326 100755
@@ -17,6 +17,7 @@ use Tie::IxHash;
 use IO::File;
 use CGI qw(escapeHTML);
 use Data::Dumper;
+use POSIX;
 
 #---------- accumulating input/output ----------
 
@@ -285,9 +286,14 @@ sub count_rows_sectnode ($) {
     $rows++ if $sectnode->{Status};
     $rows += count_rows_sectlist $sectnode->{Children};
     $sectnode->{Rows} = $rows;
+    $sectnode->{RealSect}{Rows} = $rows;
     return $rows;
 }
 
+# Now we have
+#   $sectnode->{Rows}
+#   $sectnode->{RealSect}{Rows}
+
 sub count_rows_sectlist ($) {
     my ($sectlist) = @_;
     my $rows = 0;
@@ -349,22 +355,36 @@ sub write_output_row ($) {
     }
     for (my $i=0; $i<@version_urls; $i++) {
         my $st = $sectnode->{Status}[$i];
+
+        my $colspan = $sectnode->{RealSect}{ColSpan}[$i];
+        my $nextcell = '';
+        if (!defined $colspan) { # first row of this RealSect
+            $colspan= ' colspan="2"';
+            if ($sectnode->{RealSect}{HasText}[$i] && $st
+                && $sectnode->{RealSect}{Anchor}) {
+                my $rows = $sectnode->{RealSect}{Rows};
+                $nextcell = sprintf '<td rowspan=%d>', $rows;
+                my @nce = ($rows>1 ? ('}') : ('')) x $rows;
+                $nce[floor(($rows-1)/2)] .= sprintf '<a href="%s#%s">[*]</a>',
+                    $version_urls[$i], $sectnode->{RealSect}{Anchor};
+                $nextcell .= join '<br>', @nce;
+                $nextcell .= '</td>';
+                $colspan = '';
+            }
+            $sectnode->{RealSect}{ColSpan}[$i] = $colspan;
+        }
+
         $st //= '-';
-        o('<td>');
+        o("<td$colspan>");
         my $end_a = '';
         if ($sectnode->{Key} eq 'release-support--xen-version') {
             o(sprintf '<a href="%s">', $version_urls[$i]);
             $end_a = '</a>';
         }
         o(escapeHTML($st));
-        if ($sectnode->{RealSect}{HasText}[$i]
-            && $sectnode->{Status}[$i]
-            && $sectnode->{RealSect}{Anchor}) {
-            o(sprintf '<a href="%s#%s">[*]</a>',
-              $version_urls[$i], $sectnode->{RealSect}{Anchor});
-        }
         o($end_a);
         o('</td>');
+        o($nextcell);
     }
     o("</tr>\n");
 }      
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#12 lore raw

PATCH v3 11/11 docs/parse-support-md: Identical [*]: only use extra table cell if necessary

In reply to Ian Jackson

Otherwise paste [*] right onto the end.

I'm not sure if this is desirable.

---
v3: New patch

---
 docs/parse-support-md | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
docs/parse-support-md +15 -6
index 38c8326..f91adca 100755
@@ -358,18 +358,26 @@ sub write_output_row ($) {
 
         my $colspan = $sectnode->{RealSect}{ColSpan}[$i];
         my $nextcell = '';
+        my $suffix = $sectnode->{RealSect}{AlwaysSuffix};
         if (!defined $colspan) { # first row of this RealSect
             $colspan= ' colspan="2"';
             if ($sectnode->{RealSect}{HasText}[$i] && $st
                 && $sectnode->{RealSect}{Anchor}) {
                 my $rows = $sectnode->{RealSect}{Rows};
-                $nextcell = sprintf '<td rowspan=%d>', $rows;
-                my @nce = ($rows>1 ? ('}') : ('')) x $rows;
-                $nce[floor(($rows-1)/2)] .= sprintf '<a href="%s#%s">[*]</a>',
+                my $asterisk = sprintf '<a href="%s#%s">[*]</a>',
                     $version_urls[$i], $sectnode->{RealSect}{Anchor};
-                $nextcell .= join '<br>', @nce;
-                $nextcell .= '</td>';
-                $colspan = '';
+                if ($rows > 1) {
+                    $nextcell = sprintf '<td rowspan="%d">', $rows;
+                    my @nce = ($rows>1 ? ('}') : ('')) x $rows;
+                    $nce[floor(($rows-1)/2)] .= $asterisk;
+                    $nextcell .= join '<br>', @nce;
+                    $nextcell .= '</td>';
+                    $suffix = '[*]';
+                    $sectnode->{RealSect}{AlwaysSuffix} = $suffix;
+                    $colspan = '';
+                } else {
+                    $suffix = $asterisk;
+                }
             }
             $sectnode->{RealSect}{ColSpan}[$i] = $colspan;
         }
@@ -383,6 +391,7 @@ sub write_output_row ($) {
         }
         o(escapeHTML($st));
         o($end_a);
+        o($suffix // '');
         o('</td>');
         o($nextcell);
     }
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#5 lore raw

PATCH v3 5/11 docs/gen-html-index: Support documents at the toplevel

In reply to Ian Jackson

There are none yet.

---
 docs/gen-html-index | 4 ++++
 1 file changed, 4 insertions(+)
docs/gen-html-index +4 -0
index 5b43b42..8258e2b 100644
@@ -137,6 +137,10 @@ sub dirs($)
     return @dirs;
 }
 
+foreach my $of (grep { !m{/} } @docs) {
+    $top .= make_link($of,'');
+}
+
 foreach my $od (sort { $a cmp $b } uniq map { dirs($_) } @docs) {
     my @d = (grep /^\Q$od\E/, @docs);
     if ( @d == 1 and $d[0] eq "$od/index.html" )
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#11 lore raw

Re: [PATCH 10/11] docs/parse-support-md: Unify identical [*] in footnotes

In reply to Ian Jackson
Quoted 6 lines · Ian Jackson

A section in the SUPPORT.md may mention multiple
Status, something: Supported
and then have some text. The text is linked to from [*] footnotes in the table. But, this means that each bit of text needs to apply to multiple rows.

Quoted 8 lines

Before this commit this was a separate [*] after each applicable item. But multiple apparently-different links to the same thing are annoying for the reader.

So, in this commit we combine them. Formatting the result is not entirely trivial.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#13 lore raw

Re: [PATCH 11/11] docs/parse-support-md: Identical [*]: only use extra table cell if necessary

In reply to Ian Jackson
Quoted 5 lines · Ian Jackson

Otherwise paste [*] right onto the end.

I'm not sure if this is desirable.

Juergen

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#14 lore raw
In reply to Ian Jackson

Ian Jackson writes ("[PATCH for-4.11 v3 0/11] Provide support matrix generator"):

Quoted 3 lines

This series provides code to generate a feature support matrix, to replace the one on the wiki. You can see an example of the output here:

I spoke to Wei IRL and he expressed a disinclination to review my matrix generation machinery :-) and said I should commit it.

So I have pushed patches 1-7 to staging right away. When they are through to master, I intend to push them to staging-4.10, unless someone objects.

For 8-11 I'm awaiting any opinions about the output and in particular whether to include

Quoted 2 lines

+ 11/11] docs/parse-support-md: Identical [*]: only use extra
table cell if necessary

Ian.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#16 lore raw
In reply to Ian Jackson

On 12/04/2018, 13:28, "Ian Jackson" <[email protected]> wrote:

This series provides code to generate a feature support matrix, to replace the one on the wiki. You can see an example of the output here:
https://xenbits.xen.org/people/iwj/2018/support-matrix-example-v3a/t.html

I prefer this one. It's cleaner and easier to navigate. I would leave out the "}" in the navigation though.

I suppose, we also need to add "Supported-Until" and "Security-Support-Until" for the 4.10 stuff and roll this into the format changes for SUPPORT.md

Let me know when committed and the page is there, such that I can commit "[PATCH governance.git] Make Security Policy Doc ready to become a CNA" That probably needs a couple of ACKs though, but it doesn't change the policy substance, so maybe it doesn't

I am proposing not to repost just to change the URL (once generated)

Lars

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#15 lore raw
In reply to Ian Jackson

Ian Jackson writes ("Re: [PATCH for-4.11 v3 0/11] Provide support matrix generator"):

Quoted 4 lines

For 8-11 I'm awaiting any opinions about the output and in particular whether to include

Quoted 2 lines

+ 11/11] docs/parse-support-md: Identical [*]: only use extra
table cell if necessary

AFter IRL discussions with Lars and George I have dropped 11/11. I have also amended 10/11 to drop the `}' in the multi-row [*] cells. v4 is below, and I am about to push it and its two predecessors.

FAOD, these three do not want to go to 4.10.

Thanks,
Ian.

From 6bd34dc33a237df1af0b4bfec212b5c9e8705745 Mon Sep 17 00:00:00 2001
From: Ian Jackson <[email protected]>
Date: Thu, 12 Apr 2018 12:59:24 +0100
Subject: [PATCH v4 3/3] docs/parse-support-md: Unify identical [*] in footnotes

A section in the SUPPORT.md may mention multiple
Status, something: Supported
and then have some text. The text is linked to from [*] footnotes in the table. But, this means that each bit of text needs to apply to multiple rows.

Before this commit this was a separate [*] after each applicable item. But multiple apparently-different links to the same thing are annoying for the reader.

So, in this commit we combine them. Formatting the result is not entirely trivial.

---
v3: New patch
v3.1: Drop `}' in multi-row [*] notes. I put this in to help work
around firefox bugs eg

     https://bugzilla.mozilla.org/show_bug.cgi?id=244135

but I have been convinced it is not generally wanted.

---
 docs/parse-support-md | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)
docs/parse-support-md +25 -7
index 83768cf..decda33 100755
@@ -17,6 +17,7 @@ use Tie::IxHash;
 use IO::File;
 use CGI qw(escapeHTML);
 use Data::Dumper;
+use POSIX;
 
 #---------- accumulating input/output ----------
 
@@ -285,9 +286,14 @@ sub count_rows_sectnode ($) {
     $rows++ if $sectnode->{Status};
     $rows += count_rows_sectlist $sectnode->{Children};
     $sectnode->{Rows} = $rows;
+    $sectnode->{RealSect}{Rows} = $rows;
     return $rows;
 }
 
+# Now we have
+#   $sectnode->{Rows}
+#   $sectnode->{RealSect}{Rows}
+
 sub count_rows_sectlist ($) {
     my ($sectlist) = @_;
     my $rows = 0;
@@ -349,22 +355,34 @@ sub write_output_row ($) {
     }
     for (my $i=0; $i<@version_urls; $i++) {
         my $st = $sectnode->{Status}[$i];
+
+        my $colspan = $sectnode->{RealSect}{ColSpan}[$i];
+        my $nextcell = '';
+        if (!defined $colspan) { # first row of this RealSect
+            $colspan= ' colspan="2"';
+            if ($sectnode->{RealSect}{HasText}[$i] && $st
+                && $sectnode->{RealSect}{Anchor}) {
+                my $rows = $sectnode->{RealSect}{Rows};
+                $nextcell = sprintf '<td rowspan=%d>', $rows;
+                $nextcell .= sprintf '<a href="%s#%s">[*]</a>',
+                    $version_urls[$i], $sectnode->{RealSect}{Anchor};
+                $nextcell .= '</td>';
+                $colspan = '';
+            }
+            $sectnode->{RealSect}{ColSpan}[$i] = $colspan;
+        }
+
         $st //= '-';
-        o('<td>');
+        o("<td$colspan>");
         my $end_a = '';
         if ($sectnode->{Key} eq 'release-support--xen-version') {
             o(sprintf '<a href="%s">', $version_urls[$i]);
             $end_a = '</a>';
         }
         o(escapeHTML($st));
-        if ($sectnode->{RealSect}{HasText}[$i]
-            && $sectnode->{Status}[$i]
-            && $sectnode->{RealSect}{Anchor}) {
-            o(sprintf '<a href="%s#%s">[*]</a>',
-              $version_urls[$i], $sectnode->{RealSect}{Anchor});
-        }
         o($end_a);
         o('</td>');
+        o($nextcell);
     }
     o("</tr>\n");
 }      
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel