Mercurial > hg > kdocs
view make/make.sh @ 80:fa8bf02e7cfa
Script to search Linux kernel for mentions of ietf RFC documents and make a
page linking to the files and the appropriate RFC.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 23 Oct 2007 04:33:46 -0500 |
parents | 3232f421c770 |
children | 6adf16f10d54 |
line wrap: on
line source
#!/bin/bash [ -z "$WEBDIR" ] && WEBDIR=~/www/kdocs [ -z "$LNXDIR" ] && LNXDIR=~/linux echo $WEBDIR echo "Update master index." $WEBDIR/make/indexsections.py $WEBDIR/master.idx > $WEBDIR/index.html || exit 1 echo "Mirror resources" cd "$WEBDIR" make/mirror.py cat mirror/ols2002.pdf.gz | gunzip > mirror/ols2002.pdf if [ -z "$(find mirror/ols2001 -name "*.pdf")" ] then mkdir -p mirror/ols2001 && cd mirror/ols2001 && wget -r -l 1 -nd http://lwn.net/2001/features/OLS/pdf/pdf/ && cd ../.. [ $? -ne 0 ] && exit 1 fi if [ -z "$(find ols/2007 -name "*.pdf")" ] then echo "Split ols files" mkdir -p ols/{1999,2000,2001,2002,2003,2004,2005,2006,2007} && cp mirror/ols2001/*.pdf ols/2001 && make/splitols.py mirror ols [ $? -ne 0 ] && exit 1 fi echo "Update Linux kernel from kernel.org" if [ ! -d "$LNXDIR" ] then # Clone repository if we haven't got one yet. mkdir -p "$LNXDIR"/hg && cd "$LNXDIR"/hg && hg clone http://kernel.org/hg/linux-2.6 hg else # Update kernel mercurial repository. cd "$LNXDIR"/hg && if [ "$1" != "--short" ] then hg pull -u fi fi [ $? -ne 0 ] && exit 1 echo -n "Grab version number..." LNXTAG="$(hg tags | head -n 2 | tail -n 1 | awk '{print $1}')" echo $LNXTAG echo Copy readme files from Linux kernel rm -rf $WEBDIR/readme mkdir $WEBDIR/readme for i in $(find . -name "*[Rr][Ee][Aa][Dd][Mm][Ee]*" | grep -v "Documentation/") do OUT=$(echo $i | sed -e 's@\./@@' -e 's@/@-@g') cp $i $WEBDIR/readme/$OUT done make help > $WEBDIR/makehelp.txt echo Convert kconfig to html for all architectures echo $WEBDIR/menuconfig/ rm -rf $WEBDIR/menuconfig/ mkdir -p $WEBDIR/menuconfig echo "<html><title>Menuconfig docs for Linux $LNXTAG</title><body><ul>" > $WEBDIR/menuconfig/index.html for i in $(find arch -maxdepth 2 -name Kconfig | sort) do echo Converting "$i" ARCH=$(echo $i | sed -r 's@.*/(.*)/.*@\1@') echo "<li><a href=${ARCH}.html>${ARCH}</a></li>" >> $WEBDIR/menuconfig/index.html $WEBDIR/make/menuconfig2html.py $i $WEBDIR/menuconfig "$LNXTAG" > $WEBDIR/menuconfig/$ARCH.html done echo "</ul></body></html>" >> $WEBDIR/menuconfig/index.html echo Install updated Documentation rm -rf $WEBDIR/Documentation/ cp -a $LNXDIR/hg/Documentation $WEBDIR/Documentation cd $WEBDIR for i in make/patches/*.patch do echo $i patch -p1 -i $i || exit 1 done make/docdiridx.py [ "$1" == "--short" ] && exit 1 echo Build htmldocs and xhtml-nochunks rm -rf $LNXDIR/temp cd $LNXDIR/hg mkdir $LNXDIR/temp make allnoconfig O=$LNXDIR/temp # Adjust to use the patched Documentation directory ln -s $WEBDIR/Documentation $LNXDIR/temp # I have a dual processor laptop, so overlap work here. Generate the xml # first, then have make htmldocs produce split-up versions in the background # while a script produces nochunks versions in the foreground. cd $LNXDIR/temp make -j 2 xmldocs make -j 2 htmldocs & cd Documentation/DocBook for i in *.xml do echo "Converting $i" xmlto xhtml-nochunks $i -o xhtml-nochunks done # Wait for background task to finish before retrieving result while [ $(jobs | wc -l) -ne 0 ] do sleep 1 # Without this next line, bash never notices a change in the number of jobs. # Bug noticed in Ubuntu 7.04 jobs > /dev/null done mv xhtml-nochunks/*.html . rmdir xhtml-nochunks echo Install htmldocs and update index rm -f $WEBDIR/htmldocs ln -s Documentation/DocBook $WEBDIR/htmldocs cd $WEBDIR/htmldocs # Work around a bug in xmlto: it puts an incorrect code page into the converted # html documents, which produces line noise in the output. find . -name "*.html" | xargs sed -i -e 's/.*ISO-8859-1.*//' head -n 2 index.html > index2.html echo "<ul>" >> index2.html for i in $(ls -p | sed -n 's@/$@@p') do echo "<li>(<a href=\"$i\">chunks</a>) (<a href=\"${i}.html\">nochunks</a>) " >> index2.html sed -nr 's@.*<title>(.*)</title>.*@\1@p' ${i}.xml | head -n 1 >> index2.html echo "</li>" >> index2.html done echo "</ul>" >> index2.html mv index2.html index.html echo "Done with kdocs"