git/dodoc.sh

116 lines
2.9 KiB
Bash
Raw Normal View History

2005-12-27 08:04:15 +00:00
#!/bin/sh
#
# This script is called from the post-update hook, and when
2006-01-08 06:18:12 +00:00
# the master branch is updated, run in $HOME/git-doc, like
2005-12-27 08:04:15 +00:00
# this:
: <<\END_OF_COMMENTARY
$ cat >hooks/post-update
#!/bin/sh
case " $* " in
*' refs/heads/master '*)
echo $HOME/git-doc/dodoc.sh | at now
;;
esac
exec git-update-server-info
$ chmod +x hooks/post-update
END_OF_COMMENTARY
2006-01-08 06:18:12 +00:00
# $HOME/git-doc is a clone of the git.git repository and
2005-12-27 08:04:15 +00:00
# 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
PUBLIC=/pub/software/scm/git/docs &&
MASTERREPO=`pwd` &&
DOCREPO=`dirname "$0"` &&
test "$DOCREPO" != "" &&
cd "$DOCREPO" || exit $?
git pull "$MASTERREPO" master &&
git fetch --tags "$MASTERREPO" || exit $?
2006-01-09 01:18:32 +00:00
test $(git-rev-parse --verify refs/heads/master) == "$ID" &&
NID=$(git-describe --abbrev=4 "$ID") &&
test '' != "$NID" || exit $?
2005-12-27 08:04:15 +00:00
# Set up subrepositories
test -d doc-htmlpages || (
mkdir doc-htmlpages &&
cd doc-htmlpages &&
git init-db || exit $?
2006-01-08 06:18:12 +00:00
if SID=$(git fetch-pack "$MASTERREPO" html)
2005-12-27 08:04:15 +00:00
then
2006-01-08 06:18:12 +00:00
git update-ref HEAD `expr "$SID" : '\(.*\) .*'` &&
2005-12-27 08:04:15 +00:00
git checkout || exit $?
fi
)
test -d doc-manpages || (
mkdir doc-manpages &&
cd doc-manpages &&
git init-db || exit $?
2006-01-08 06:18:12 +00:00
if SID=$(git fetch-pack "$MASTERREPO" man)
2005-12-27 08:04:15 +00:00
then
2006-01-08 06:18:12 +00:00
git update-ref HEAD `expr "$SID" : '\(.*\) .*'` &&
2005-12-27 08:04:15 +00:00
git checkout || exit $?
fi
)
find doc-htmlpages doc-manpages -type d -name '.git' -prune -o \
-type f -print0 | xargs -0 rm -f
cd Documentation &&
make WEBDOC_DEST="$DOCREPO/doc-htmlpages" install-webdoc >../:html.log 2>&1 &&
if test -d $PUBLIC
then
2007-02-14 06:15:29 +00:00
# This is iffy...
mv git.html saved-git-html &&
make WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \
install-webdoc >>../:html.log 2>&1 &&
2007-02-14 06:15:29 +00:00
mv saved-git-html git.html
2005-12-27 08:04:15 +00:00
else
echo "* No public html at $PUBLIC"
fi || exit $?
cd ../doc-htmlpages &&
(git add . || echo no new files -- not a big deal) &&
2006-01-09 01:18:32 +00:00
if git commit -a -m "Autogenerated HTML docs for $NID"
2005-12-27 08:04:15 +00:00
then
git-send-pack "$MASTERREPO" master:refs/heads/html || {
echo "* HTML failure"
exit 1
}
else
echo "* No changes in html docs"
fi
cd ../Documentation &&
make \
man1="$DOCREPO/doc-manpages/man1" \
man7="$DOCREPO/doc-manpages/man7" \
man1dir="$DOCREPO/doc-manpages/man1" \
man7dir="$DOCREPO/doc-manpages/man7" \
2005-12-27 08:04:15 +00:00
install >../:man.log 2>&1 &&
cd ../doc-manpages &&
(git add . || echo no new files -- not a big deal) &&
2006-01-09 01:18:32 +00:00
if git commit -a -m "Autogenerated man pages for $NID"
2005-12-27 08:04:15 +00:00
then
git-send-pack "$MASTERREPO" master:refs/heads/man || {
echo "* man failure"
exit 1
}
else
echo "* No changes in manual pages"
fi