]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Meta/dodoc.sh: adjust to the new layout
authorJunio C Hamano <gitster@pobox.com>
Tue, 15 Nov 2011 20:31:06 +0000 (12:31 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Nov 2011 21:59:11 +0000 (13:59 -0800)
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.

dodoc.sh

index e11bacd069bc2fe1c20d1621363b981420ceb7d0..75da9b70c164510943d730aba56781fd243baf1e 100755 (executable)
--- a/dodoc.sh
+++ b/dodoc.sh
@@ -1,81 +1,70 @@
 #!/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
-#!/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
+# "git-doc" is a clone of the git.git repository and has the master
+# branch checked out. We update the working tree and prepare
+# preformatted documentation pages, and install them in doc-htmlpages
+# and doc-manapges subdirectories. When they are updated, they are
+# pushed back into their own repositories next to the git.git
+# repository.
 
-# $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.
+unset GIT_DIR
 
-ID=`git rev-parse --verify refs/heads/master` || exit $?
+MASTERREPO=/srv/project/git/git.git/
+DOCREFHIER=refs/docs
+MANREPO=/srv/project/git/git-manpages.git/
+HTMLREPO=/srv/project/git/git-htmldocs.git/
 
-unset GIT_DIR
+target_repo () {
+       TARGETVAR=$(echo "$1"REPO | tr 'a-z' 'A-Z') &&
+       eval "echo \$$TARGETVAR"
+}
 
-: ${PUBLIC=/pub/software/scm/git/docs} &&
-: ${MASTERREPO=`pwd`} &&
-: ${DOCREPO=`dirname "$0"`} &&
-test "$DOCREPO" != "" &&
-cd "$DOCREPO" || exit $?
+DOCREPO=$(pwd) ;# "git-doc"
+exec >:doc.log 2>&1
 
-DOCREPO=`pwd`
+ID=$(cd "$MASTERREPO" && git rev-parse --verify refs/heads/master) || exit $?
 
 tmp=`pwd`/.doctmp-$$
 trap 'rm -f "$tmp".*' 0
 
 (
-       git pull "$MASTERREPO" master &&
-       git fetch --tags "$MASTERREPO" 
-) >/dev/null 2>/dev/null || exit $?
-test $(git rev-parse --verify refs/heads/master) == "$ID" &&
+       git pull --ff-only "$MASTERREPO" master &&
+       git fetch --tags "$MASTERREPO"
+) || exit $?
+
+test $(git rev-parse --verify refs/heads/master) = "$ID" &&
 NID=$(git describe --abbrev=4 "$ID") &&
-test '' != "$NID" ||  exit $?
+test -n "$NID" ||  exit $?
+
+git reset --hard
 
 # Set up subrepositories
 for type in man html
 do
-       test -d doc-${type}pages || (
-               mkdir doc-${type}pages &&
-               cd doc-${type}pages &&
-               git init-db || exit $?
-
-               git fetch-pack "$MASTERREPO" ${type} |
-               while read sha1 name
-               do
-                       case "$name" in
-                       refs/heads/${type})
-                               git update-ref HEAD $sha1 &&
-                               git checkout || exit $?
-                               break
-                               ;;
-                       esac
-               done || exit $?
-       ) || exit
-       rm -fr doc-$type-inst
+       test -d doc-${type}pages && continue
+       (
+               git init doc-${type}pages &&
+               cd doc-${type}pages || exit
+               TARGETREPO=$(target_repo $type) &&
+               git pull "$TARGETREPO" master
+       ) &&
+       rm -fr doc-$type-inst &&
+       mkdir -p doc-$type-inst &&
+       (
+               cd doc-${type}pages && git archive HEAD
+       ) |
+       (
+               cd doc-$type-inst && tar xf -
+       )
 done
 
-dd='ASCIIDOC_NO_ROFF=YesPlease
-ASCIIDOC8=YesPlease
-MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
-BLK_SHA1=YesPlease
-GNU_ROFF=YesPlease'
+dd='
+       ASCIIDOC_NO_ROFF=YesPlease
+       ASCIIDOC8=YesPlease
+       MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
+       BLK_SHA1=YesPlease
+       GNU_ROFF=YesPlease
+'
 
 case "$NID" in
 ?*-?*) ;;
@@ -89,11 +78,11 @@ esac
 DIFF=diff
 export DIFF
 
-make >./:html.log 2>&1 \
+make \
        -C Documentation -j 2 $dd \
        WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit
 
-make >./:man.log 2>&1 \
+make \
        -C Documentation -j 2 $dd \
        man1="$DOCREPO/doc-man-inst/man1" \
        man5="$DOCREPO/doc-man-inst/man5" \
@@ -138,28 +127,15 @@ do
 
                if git commit -a -m "Autogenerated $TYPE for $NID"
                then
-                       git send-pack "$MASTERREPO" master:refs/heads/$type \
-                       >/dev/null 2>&1
+                       TARGETREPO=$(target_repo $type) &&
+                       git push "$TARGETREPO" master:master
                else
                        echo "* No changes in $type docs"
                fi
        ) || exit
 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 '
 
 *** ALL DONE ***
-' >>./:html.log
+'