changeset 1:34a037d461f9

Some random infrastructure to build documentation from source.
author Rob Landley <rob@landley.net>
date Wed, 20 Jun 2007 00:26:29 -0400
parents 93c7869166a0
children 8f8135aaaffb
files make/make.sh make/manlifter.patch make/mkxmlman.sh
diffstat 3 files changed, 128 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/make.sh	Wed Jun 20 00:26:29 2007 -0400
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Update website from kernel tarball.
+# usage: cd kerneldir; make.sh kdocsdir
+
+if [ ! -f "MAINTAINERS" ]
+then
+  echo $1 Not in kernel source dir
+  exit 1
+fi
+
+if [ ! -d "$1" ]
+then
+  echo $1 not directory
+  exit 1
+fi
+
+# Delete old copies, create empty directories.
+
+rm -rf $1/{Documentation,htmldocs}
+mkdir -p $1/{Documentation,htmldocs}
+
+# The list of architectures supported by this kernel
+# echo include/asm-* | sed 's@include/asm-@@g'
+
+# Run this in the linux kernel source directory
+
+make distclean
+tar c Documentation | tar xvC $1
+make htmldocs
+cat Documentation/DocBook/index.html | sed -re 's@HREF=".*/(.*)"@HREF="\1"@' > $1/htmldocs/index.html &&
+cp `find Documentation/DocBook -name "*.html" | grep "Documentation/DocBook/.*/.*\.html"` $1/htmldocs/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/manlifter.patch	Wed Jun 20 00:26:29 2007 -0400
@@ -0,0 +1,70 @@
+--- doclifter-2.3/manlifter	2006-12-25 02:43:35.000000000 -0500
++++ new/manlifter	2007-05-24 22:38:22.000000000 -0400
+@@ -359,6 +359,7 @@
+     for (root, dirs, files) in os.walk('xmlman'):
+         for file in files:
+             try:
++                if not file.endswith(".xml"): continue
+                 # Extract the manual section
+                 m = section_re.search(root)
+                 if m:
+@@ -367,7 +368,7 @@
+                     continue
+                 section_dict[section] = []
+                 # Extract the manual page name
+-                name = ".".join(file.split(".")[:-2])
++                name = ".".join(file.split(".")[:-1])
+                 # Extract the description
+                 file = os.path.join(root, file)
+                 fp = open(file)
+@@ -379,21 +380,21 @@
+                 else:
+                     description = "(no description)"
+                 # Build an index entry
+-                filelist.append((section, file, name, description))
++                filelist.append((section, name, description))
+             except IOError:
+                 pass
+     filelist.sort()	# In case the directory was pieced together by several runs
+-    for (section, file, name, description) in filelist:
+-        section_dict[section].append((file, name, description))
++    for (section, name, description) in filelist:
++        section_dict[section].append((name, description))
+     keys = section_dict.keys()
+     keys.sort()
+ 
+     for section in keys:
+         ofp.write(htmlheader)
+         ofp.write("<h1>%s:</h1>\n<dl>\n" % section)
+-        for (file, name, description) in section_dict[section]:
+-            ofp.write("<dt><a href='%s'>%s</a></dt><dd>%s</dd>\n" \
+-                  % (file, name, description))
++        for (name, description) in section_dict[section]:
++            ofp.write("<dt><a href='man%s/%s.html'>%s</a></dt><dd>%s</dd>\n" \
++                  % (section, name, name, description))
+         ofp.write("</dl>\n")
+         ofp.write(htmltrailer)
+ 
+@@ -503,7 +504,7 @@
+ 
+ def doclifter_driver(options, arguments):
+     "Lift old markup to new."
+-    global makehtml, outdir, xslfragment, patchdir
++    global mandir, makehtml, outdir, xslfragment, patchdir
+     filelist = []
+     sections = []
+     callopts = ""
+@@ -567,9 +568,10 @@
+             fp.close()
+             massrun(filelist, callopts)
+         else:
+-            global processed 
+-            processed = sets.Set(map(lambda x: x.replace(".patch", "").replace(".correction", ""), os.listdir(patchdir)))
+-            massrun(sectionfiles(sections), callopts)
++            global processed
++            if os.path.exists(patchdir):
++                processed = sets.Set(map(lambda x: x.replace(".patch", "").replace(".correction", ""), os.listdir(patchdir)))
++                massrun(sectionfiles(sections), callopts)
+             if processed:
+                 print "# Patches not used:"
+                 for file in processed:
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/mkxmlman.sh	Wed Jun 20 00:26:29 2007 -0400
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+mkdir -p source
+[ -f source/man-pages-2.55.tar.gz ] ||
+  (cd source && wget ftp://ftp.win.tue.nl/pub/linux-local/manpages/man-pages-2.55.tar.gz)
+[ -f source/doclifter-2.3.tar.gz ] ||
+  (cd source && wget http://www.catb.org/~esr/doclifter/doclifter-2.3.tar.gz)
+
+rm -rf mantemp
+
+rm -rf man-pages-* &&
+tar xvzf source/man-pages-*.tar.gz &&
+cd man-pages-* &&
+make MANDIR=../mantemp allgz &&
+cd .. &&
+rm -rf man-pages-* &&
+
+rm -rf doclifter-* &&
+tar xvzf source/doclifter-*.tar.gz &&
+cd doclifter-2.3 &&
+# Manlifter is buggy, we have to fix it up.
+chmod +w manlifter &&
+patch -p1 -i ../manlifter.patch &&
+mkdir prepatch &&
+# Run it
+./manlifter -I `pwd`/../mantemp `cd ..;ls mantemp | sed -re 's/man([0-9]p?)/-s \1/g'` -h