Debian Codegraph @

scripts/update-docs

raw
1 #!/usr/bin/bash
2 # This script regenerates the prebuilt documentation
3 # checked into the source tree.
4
5 set -e
6
7 echo "Generating documentation"
8 SCRIPT=$(readlink -f $0)
9 BASE=$(dirname $SCRIPT)/..
10 TEMP=$(mktemp -d -p /tmp) && pushd $TEMP
11
12 SBG=SystemTap_Beginners_Guide
13 STR=SystemTap_Tapset_Reference
14 DOCS=$BASE/doc
15
16 # Beginners Guide documentation
17
18 echo "Generating beginner pdf"
19 xmlto --with-fop --skip-validation -o $DOCS/$SBG/en-US/ -x $DOCS/$SBG/en-US/xsl/pdf.xsl pdf $DOCS/$SBG/en-US/$SBG.xml
20
21 # Tapset Reference documentation
22
23 ###
24 # The build process is as follows (targets):
25 # (xmldocs) [by docproc]
26 # file.tmpl --> file.xml +--> file.ps (psdocs) [by xmlto]
27 # +--> file.pdf (pdfdocs) [by xmlto]
28 # +--> DIR=file (htmldocs) [by xmlto]
29 # +--> man/ (mandocs) [by xmlto]
30
31 # Update syscalls docs
32 $(dirname $SCRIPT)/update-syscall-docs
33
34 echo "Generating tapsets.xml"
35 gcc -o docproc $DOCS/$STR/docproc.c
36 sed -e '/^!Syscalls/{r $DOCS/$STR/syscalls.xmlpart' -e 'd}' $DOCS/$STR/tapsets.tmpl > tapsets.tmpl.new
37 SRCTREE=$BASE/ ./docproc doc tapsets.tmpl.new > tapsets.xml.new
38 python $DOCS/$STR/overload.py tapsets.xml.new > tapsets.xml.new1
39 if [ $? -ne 0 ]; then echo "FAILED: python lxml library required"; exit 1; fi
40 xsltproc $DOCS/$STR/sort-tapsets.xslt tapsets.xml.new1 > tapsets.xml.new2
41 rm tapsets.xml.new tapsets.xml.new1 tapsets.tmpl.new
42 if test -s tapsets.xml && cmp tapsets.xml.new2 tapsets.xml >/dev/null ; then
43 echo tapsets.xml unchanged;
44 rm tapsets.xml.new2;
45 else
46 mv tapsets.xml.new2 tapsets.xml;
47 fi
48
49 # Publicanize
50 cp tapsets.xml $DOCS/$STR/
51 $DOCS/$STR/publicanize.sh
52
53 echo "Generating tapsets pdf"
54 env pool_size=6000000 hash_extra=6000000 xmlto --with-fop --stringparam refentry.generate.name=0 --stringparam refentry.generate.title=1 pdf -o $DOCS/$STR/ tapsets.xml
55
56 echo "Generating tapsets man pages"
57 xmlto --stringparam man.authors.section.enabled=0 --stringparam man.copyright.section.enabled=0 man -o man3 tapsets.xml
58 SRCTREE=$BASE $DOCS/$STR/manpager # generate tapset::* pages
59 cp $DOCS/$STR/syscalls.3stap man_pages/tapset\:\:syscalls.3stap # use cached syscall page
60 cp -R man3 $DOCS/$STR/
61 cp -R man_pages $DOCS/$STR/
62
63 popd && rm -rf $TEMP
64 echo "Finished generating documentation"