Meta/dodoc.sh: adjust to the new layout

As the mechanism to auto-generate the documentation from post-receive
hook at kernel.org is no longer available, update the script to make
it easier to manually and locally generate and maintain the preformatted
documentation repositories.
todo
Junio C Hamano 2011-11-15 12:31:06 -08:00
parent aadd6ba832
commit adaa3cafb3
1 changed files with 54 additions and 78 deletions

132
dodoc.sh
View File

@ -1,81 +1,70 @@
#!/bin/sh #!/bin/sh
#
# This script is called from the post-update hook, and when
# the master branch is updated, run in $HOME/git-doc, like
# this:
: <<\END_OF_COMMENTARY


$ cat >hooks/post-update # "git-doc" is a clone of the git.git repository and has the master
#!/bin/sh # branch checked out. We update the working tree and prepare
case " $* " in # preformatted documentation pages, and install them in doc-htmlpages
*' refs/heads/master '*) # and doc-manapges subdirectories. When they are updated, they are
echo $HOME/git-doc/dodoc.sh | at now # pushed back into their own repositories next to the git.git
;; # repository.
esac
exec git update-server-info
$ chmod +x hooks/post-update

END_OF_COMMENTARY

# $HOME/git-doc is a clone of the git.git repository and
# has the master branch checkd out. We update the working
# tree and build pre-formatted documentation pages, install
# in doc-htmlpages and doc-manapges subdirectory here.
# These two are their own git repository, and when they are
# updated the updates are pushed back into their own branches
# in git.git repository.

ID=`git rev-parse --verify refs/heads/master` || exit $?


unset GIT_DIR unset GIT_DIR


: ${PUBLIC=/pub/software/scm/git/docs} && MASTERREPO=/srv/project/git/git.git/
: ${MASTERREPO=`pwd`} && DOCREFHIER=refs/docs
: ${DOCREPO=`dirname "$0"`} && MANREPO=/srv/project/git/git-manpages.git/
test "$DOCREPO" != "" && HTMLREPO=/srv/project/git/git-htmldocs.git/
cd "$DOCREPO" || exit $?


DOCREPO=`pwd` target_repo () {
TARGETVAR=$(echo "$1"REPO | tr 'a-z' 'A-Z') &&
eval "echo \$$TARGETVAR"
}

DOCREPO=$(pwd) ;# "git-doc"
exec >:doc.log 2>&1

ID=$(cd "$MASTERREPO" && git rev-parse --verify refs/heads/master) || exit $?


tmp=`pwd`/.doctmp-$$ tmp=`pwd`/.doctmp-$$
trap 'rm -f "$tmp".*' 0 trap 'rm -f "$tmp".*' 0


( (
git pull "$MASTERREPO" master && git pull --ff-only "$MASTERREPO" master &&
git fetch --tags "$MASTERREPO" git fetch --tags "$MASTERREPO"
) >/dev/null 2>/dev/null || exit $? ) || exit $?
test $(git rev-parse --verify refs/heads/master) == "$ID" &&
test $(git rev-parse --verify refs/heads/master) = "$ID" &&
NID=$(git describe --abbrev=4 "$ID") && NID=$(git describe --abbrev=4 "$ID") &&
test '' != "$NID" || exit $? test -n "$NID" || exit $?

git reset --hard


# Set up subrepositories # Set up subrepositories
for type in man html for type in man html
do do
test -d doc-${type}pages || ( test -d doc-${type}pages && continue
mkdir doc-${type}pages && (
cd doc-${type}pages && git init doc-${type}pages &&
git init-db || exit $? cd doc-${type}pages || exit

TARGETREPO=$(target_repo $type) &&
git fetch-pack "$MASTERREPO" ${type} | git pull "$TARGETREPO" master
while read sha1 name ) &&
do rm -fr doc-$type-inst &&
case "$name" in mkdir -p doc-$type-inst &&
refs/heads/${type}) (
git update-ref HEAD $sha1 && cd doc-${type}pages && git archive HEAD
git checkout || exit $? ) |
break (
;; cd doc-$type-inst && tar xf -
esac )
done || exit $?
) || exit
rm -fr doc-$type-inst
done done


dd='ASCIIDOC_NO_ROFF=YesPlease dd='
ASCIIDOC8=YesPlease ASCIIDOC_NO_ROFF=YesPlease
MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/" ASCIIDOC8=YesPlease
BLK_SHA1=YesPlease MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
GNU_ROFF=YesPlease' BLK_SHA1=YesPlease
GNU_ROFF=YesPlease
'


case "$NID" in case "$NID" in
?*-?*) ;; ?*-?*) ;;
@ -89,11 +78,11 @@ esac
DIFF=diff DIFF=diff
export DIFF export DIFF


make >./:html.log 2>&1 \ make \
-C Documentation -j 2 $dd \ -C Documentation -j 2 $dd \
WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit


make >./:man.log 2>&1 \ make \
-C Documentation -j 2 $dd \ -C Documentation -j 2 $dd \
man1="$DOCREPO/doc-man-inst/man1" \ man1="$DOCREPO/doc-man-inst/man1" \
man5="$DOCREPO/doc-man-inst/man5" \ man5="$DOCREPO/doc-man-inst/man5" \
@ -138,28 +127,15 @@ do


if git commit -a -m "Autogenerated $TYPE for $NID" if git commit -a -m "Autogenerated $TYPE for $NID"
then then
git send-pack "$MASTERREPO" master:refs/heads/$type \ TARGETREPO=$(target_repo $type) &&
>/dev/null 2>&1 git push "$TARGETREPO" master:master
else else
echo "* No changes in $type docs" echo "* No changes in $type docs"
fi fi
) || exit ) || exit
done done


if test -d $PUBLIC
then
# This is iffy...
mv Documentation/git.html Documentation/saved-git-html
make >>./:html.log 2>&1 \
-C Documentation \
WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \
install-webdoc &&
mv Documentation/saved-git-html Documentation/git.html
else
echo "* No public html at $PUBLIC"
fi || exit $?

echo ' echo '


*** ALL DONE *** *** ALL DONE ***
' >>./:html.log '