Mercurial > hg > kdocs
changeset 81:6adf16f10d54
Split up make.sh so it's easier to call subsets of its functionality.
author | Rob Landley <rob@landley.net> |
---|---|
date | Tue, 23 Oct 2007 18:35:49 -0500 |
parents | fa8bf02e7cfa |
children | a80ed9124e61 |
files | make/do-gethg.sh make/do-master.sh make/do-menuconfig.sh make/do-mirror.sh make/do-readme.sh make/do-rfc.sh make/make.sh |
diffstat | 7 files changed, 182 insertions(+), 73 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/do-gethg.sh Tue Oct 23 18:35:49 2007 -0500 @@ -0,0 +1,26 @@ +#!/bin/sh + +# Clone or update mercurial Linux kernel repository from kernel.org + +if [ -z "$LNXDIR" ] +then + echo set LNXDIR + exit 1 +fi + +if [ ! -d "$LNXDIR" ] +then + echo "Clone Linux kernel repository from kernel.org" + + 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 && + echo "Update Linux kernel from kernel.org" + + hg pull -u +fi + +[ $? -ne 0 ] && exit 1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/do-master.sh Tue Oct 23 18:35:49 2007 -0500 @@ -0,0 +1,11 @@ +#!/bin/bash + +# Update master index + +if [ -z "$WEBDIR" ] +then + echo set WEBDIR + exit 1 +fi + +$WEBDIR/make/indexsections.py $WEBDIR/master.idx > $WEBDIR/index.html || exit 1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/do-menuconfig.sh Tue Oct 23 18:35:49 2007 -0500 @@ -0,0 +1,19 @@ +#!/bin/bash + +if [ -z "$WEBDIR" ] || [ -z "$LNXTAG" ] || [ -z "LNXDIR" ] +then + echo set WEBDIR, LNXTAG, and LNXDIR +fi + +rm -rf "$WEBDIR"/menuconfig/ +mkdir -p "$WEBDIR"/menuconfig +echo "<html><title>Menuconfig docs for Linux $LNXTAG</title><body><ul>" > $WEBDIR/menuconfig/index.html +cd "$LNXDIR"/hg +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/do-mirror.sh Tue Oct 23 18:35:49 2007 -0500 @@ -0,0 +1,32 @@ +#!/bin/bash + +# Mirror various documentation resources from out on the internet + +if [ -z "$WEBDIR" ] +then + echo set WEBDIR + exit 1 +fi + +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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/do-readme.sh Tue Oct 23 18:35:49 2007 -0500 @@ -0,0 +1,17 @@ +#!/bin/bash + +if [ -z "$WEBDIR" ] || [ -z "$LNXDIR" ] +then + echo set WEBDIR and LNXDIR + exit 1 +fi + +cd "$LNXDIR"/hg +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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/do-rfc.sh Tue Oct 23 18:35:49 2007 -0500 @@ -0,0 +1,56 @@ +#!/bin/bash + +if [ -z "$LNXDIR" ] +then + echo set LNXDIR + exit 1 +fi + +# Blank our temp file +> temp-linuxrfc.txt + +function findrfc() +{ + x=0 + # Iterate through *.c and *.h in the Linux source code. + for i in `find "$LNXDIR"/hg -name "*.[hc]"` + do + # Progress indicator + x=$[$x+1] + if [ $x -gt 250 ] + then + echo -n . >&2 + x=0 + fi + # Find each mention of an RFC, filtering out the more obvious false + # positives. + for j in `grep -io "rfc *[1-9][0-9]*" $i | grep -v " " | grep -v "@rfc822\.org" | sed -r 's/[Rr][Ff][Cc] *([0-9]*)/rfc\1/g'` + do + echo $i:$j + done + done +} + +# Find the RFC comments, with progress indicator. + +echo -n Finding RFC comments >&2 +findrfc > temp-linuxrfc.txt + +# Process the temporary directory into an html file. + +echo Converting to html... >&2 +echo "<html><head><title>RFCs used by the Linux kernel</title></head>" +echo "<ul>" +for i in $(sed 's/.*://' temp-linuxrfc.txt | sort -u | sort -t c -k 2,2 -n) +do + echo '<li><h2><a href="http://tools.ietf.org/html/'$i'">'$i'</a></h2><p>' + for j in $(sed -rn 's@\'"$LNXDIR"/hg'(.*):'$i'$@\1@p' temp-linuxrfc.txt) + do + echo '<a href="http://kernel.org/hg/linux-2.6/file/tip/'$j'">'$j'</a>' + done + echo "</p></li>" +done +echo "</ul></html>" + +# Remove the temporary file +rm temp-linuxrfc.txt
--- a/make/make.sh Tue Oct 23 04:33:46 2007 -0500 +++ b/make/make.sh Tue Oct 23 18:35:49 2007 -0500 @@ -1,87 +1,31 @@ #!/bin/bash -[ -z "$WEBDIR" ] && WEBDIR=~/www/kdocs -[ -z "$LNXDIR" ] && LNXDIR=~/linux - -echo $WEBDIR - -echo "Update master index." +# Set environment variables and call do-*.sh in sequence -$WEBDIR/make/indexsections.py $WEBDIR/master.idx > $WEBDIR/index.html || exit 1 - -echo "Mirror resources" +[ -z "$WEBDIR" ] && export WEBDIR=~/www/kdocs +[ -z "$LNXDIR" ] && export LNXDIR=~/linux -cd "$WEBDIR" -make/mirror.py -cat mirror/ols2002.pdf.gz | gunzip > mirror/ols2002.pdf -if [ -z "$(find mirror/ols2001 -name "*.pdf")" ] +# Update mercurial repository +if [ "$1" != "--nonet" ] 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 + "$WEBDIR"/make/do-gethg.sh || exit 1 fi -echo "Update Linux kernel from kernel.org" +echo -n "Grab version number..." +export LNXTAG="$(hg tags | head -n 2 | tail -n 1 | awk '{print $1}')" +echo $LNXTAG -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 +echo "Update master index." +"$WEBDIR"/make/do-master.sh || exit 1 -[ $? -ne 0 ] && exit 1 - -echo -n "Grab version number..." - -LNXTAG="$(hg tags | head -n 2 | tail -n 1 | awk '{print $1}')" -echo $LNXTAG +echo "Mirror resources" +"$WEBDIR"/make/do-mirror.sh || exit 1 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 +"$WEBDIR"/make/do-readme.sh || exit 1 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 +"$WEBDIR"/make/do-menuconfig.sh || exit 1 echo Install updated Documentation @@ -112,7 +56,7 @@ # while a script produces nochunks versions in the foreground. cd $LNXDIR/temp make -j 2 xmldocs -make -j 2 htmldocs & +[ "$1" != "--skimp" ] && make -j 2 htmldocs & cd Documentation/DocBook for i in *.xml do @@ -120,7 +64,7 @@ xmlto xhtml-nochunks $i -o xhtml-nochunks done # Wait for background task to finish before retrieving result -while [ $(jobs | wc -l) -ne 0 ] +[ "$1" != "--skimp" ] && while [ $(jobs | wc -l) -ne 0 ] do sleep 1 # Without this next line, bash never notices a change in the number of jobs. @@ -148,4 +92,8 @@ done echo "</ul>" >> index2.html mv index2.html index.html + +# Search for references to RFC documents +"$WEBDIR"/make/findrfc.sh > "$WEBDIR"/rfc-linux.html || exit 1 + echo "Done with kdocs"