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

[Xen-devel] [PATCH] docs: fix documentation index for hypercalls



This was broken by 118104e5eaf2 "docs: Build docs for ARM as well as x86_64".

Move docs to hypercall/ARCH instead of hypercall-ARCH.

Support mulitple levels of subdirectories in gen-html-index tool.

This removes the need for a symlink hypercall->hypercall-x86_64 since there is
now a proper index at hypercall/index.html.

Update INDEX to human readable names for the architecture specific hypercalls.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
---
 docs/INDEX          |    5 ++++-
 docs/Makefile       |   12 ++++--------
 docs/gen-html-index |   33 ++++++++++++++++++++++++---------
 3 files changed, 32 insertions(+), 18 deletions(-)

diff --git a/docs/INDEX b/docs/INDEX
index f5ccae2..fdf0ad8 100644
--- a/docs/INDEX
+++ b/docs/INDEX
@@ -1,4 +1,7 @@
-hypercall/index                        Hypercall Interfaces
+hypercall                      Hypercall Interfaces
+hypercall/arm/index            ARM
+hypercall/x86_32/index         x86_32
+hypercall/x86_64/index         x86_64
 
 man                            Man Pages
 
diff --git a/docs/Makefile b/docs/Makefile
index f480171..8d5d48e 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -15,8 +15,7 @@ DOC_HTML      := $(patsubst 
%.markdown,html/%.html,$(DOC_MARKDOWN)) \
                   $(patsubst man/%.pod.1,html/man/%.1.html,$(DOC_MAN1SRC)) \
                   $(patsubst man/%.pod.5,html/man/%.5.html,$(DOC_MAN5SRC)) \
                   $(patsubst %.txt,html/%.txt,$(wildcard misc/*.txt)) \
-                  html/hypercall/index.html \
-                  $(patsubst %,html/hypercall-%/index.html,$(DOC_ARCHES))
+                  $(patsubst %,html/hypercall/%/index.html,$(DOC_ARCHES))
 DOC_TXT         := $(patsubst %.txt,txt/%.txt,$(wildcard misc/*.txt)) \
                   $(patsubst %.markdown,txt/%.txt,$(DOC_MARKDOWN)) \
                   $(patsubst man/%.pod.1,txt/man/%.1.txt,$(DOC_MAN1SRC)) \
@@ -125,9 +124,9 @@ else
 endif
 
 # For non-x86 arches exclude the subarch whole x86 arch.
-$(foreach i,$(filter-out x86_32 
x86_64,$(DOC_ARCHES)),html/hypercall-$(i)/index.html): EXTRA_EXCLUDE := -X 
arch-x86
+$(foreach i,$(filter-out x86_32 
x86_64,$(DOC_ARCHES)),html/hypercall/$(i)/index.html): EXTRA_EXCLUDE := -X 
arch-x86
 
-html/hypercall-%/index.html: $(CURDIR)/xen-headers Makefile
+html/hypercall/%/index.html: $(CURDIR)/xen-headers Makefile
        rm -rf $(@D)
        $(INSTALL_DIR) $(@D)
        $(PERL) -w $(CURDIR)/xen-headers -O $(@D) \
@@ -137,10 +136,7 @@ html/hypercall-%/index.html: $(CURDIR)/xen-headers Makefile
                $(EXTRA_EXCLUDE) \
                $(XEN_ROOT)/xen include/public include/xen/errno.h
 
-html/hypercall/index.html: html/hypercall-x86_64/index.html
-       ln -nfs hypercall-x86_64 html/hypercall
-
--include $(wildcard html/hypercall-*/.deps)
+-include $(wildcard html/hypercall/*/.deps)
 
 txt/%.txt: %.txt
        $(INSTALL_DIR) $(@D)
diff --git a/docs/gen-html-index b/docs/gen-html-index
index 7b36a19..e9792bf 100644
--- a/docs/gen-html-index
+++ b/docs/gen-html-index
@@ -71,16 +71,16 @@ sub make_link ($$) {
     my ($ref,$base) = @_;
 
     my $txt = make_linktext($ref);
-    $ref = basename($ref) if $base;
+    $ref =~ s,^$base/,, if $base; #/
 
     return "<li><a href=\"$ref\">$txt</a></li>\n";
 }
 
-sub make_links ($$@) {
-    my ($dir,$base,@docs) = @_;
+sub make_links ($@) {
+    my ($dir,@docs) = @_;
     my $idx = '';
     foreach my $of (sort { make_linktext($a) cmp make_linktext($b) } @docs) {
-        $idx .= make_link($of,$base);
+        $idx .= make_link($of,$dir);
     }
     return $idx;
 }
@@ -103,22 +103,37 @@ sub uniq (@) {
     foreach (@_) { $h{$_} = 1; }
     return keys %h;
 }
-    
+
 for (@docs) { s,^\Q$outdir\E/,, }
 
 @docs = grep { -e "$outdir/$_" && (make_linktext($_) ne "NO-INDEX") } @docs;
 
 my $top = '';
 
-foreach my $od (sort { $a cmp $b } uniq map { dirname($_) } @docs) {
+# Return a list of all directories leading to $path
+sub dirs($)
+{
+    my ($path) = @_;
+    my @dirs;
+    while ( $path =~ m,/, )
+    {
+       $path =~ m,/([^/]+)$,;
+       push @dirs, $`;#`
+       $path = $`;#`
+    }
+    return @dirs;
+}
+
+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" )
     {
+        next if $d[0] =~ m,/,;#/ linked to from the subdirectory entry.
         $top .= make_link("$od/index.html", 0);
     }
     else
     {
-       my $links = make_links($od,0,@d);
+       my $links = make_links(undef,@d);
        my $secttitle = make_linktext($od);
        $top .= <<END;
 <li><a href=\"${od}/index.html\">$secttitle</a></li>
@@ -127,8 +142,8 @@ $links
 </ul>
 END
 
-       $links = make_links($od,1,@d);
-        my $idx = '';
+       $links = make_links($od,@d);
+       my $idx = '';
        $idx .= <<END;
 <li>$secttitle</li>
 <ul>
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.