From 653c3f766994a9cb64278a8da6d4b574d441dfe3 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 26 Mar 2007 02:04:42 -0700 Subject: [PATCH] dodoc updates. --- dodoc.sh | 141 +++++++++++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 66 deletions(-) diff --git a/dodoc.sh b/dodoc.sh index 7869dac5be..ca9893ae2e 100755 --- a/dodoc.sh +++ b/dodoc.sh @@ -29,12 +29,15 @@ ID=`git-rev-parse --verify refs/heads/master` || exit $? unset GIT_DIR -PUBLIC=/pub/software/scm/git/docs && -MASTERREPO=`pwd` && -DOCREPO=`dirname "$0"` && +: ${PUBLIC=/pub/software/scm/git/docs} && +: ${MASTERREPO=`pwd`} && +: ${DOCREPO=`dirname "$0"`} && test "$DOCREPO" != "" && cd "$DOCREPO" || exit $? +tmp=`pwd`/.doctmp-$$ +trap 'rm -f "$tmp".*' 0 + git pull "$MASTERREPO" master && git fetch --tags "$MASTERREPO" || exit $? test $(git-rev-parse --verify refs/heads/master) == "$ID" && @@ -42,74 +45,80 @@ NID=$(git-describe --abbrev=4 "$ID") && test '' != "$NID" || exit $? # Set up subrepositories -test -d doc-htmlpages || ( - mkdir doc-htmlpages && - cd doc-htmlpages && - git init-db || exit $? - - if SID=$(git fetch-pack "$MASTERREPO" html) - then - git update-ref HEAD `expr "$SID" : '\(.*\) .*'` && - git checkout || exit $? - fi -) -test -d doc-manpages || ( - mkdir doc-manpages && - cd doc-manpages && - git init-db || exit $? - - if SID=$(git fetch-pack "$MASTERREPO" man) - then - git update-ref HEAD `expr "$SID" : '\(.*\) .*'` && - 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 && +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 +done + +make >../:html.log 2>&1 \ + -C Documentation -j 2 \ + WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit + +make >../:man.log 2>&1 \ + -C Documentation -j 2 \ + man1="$DOCREPO/doc-man-inst/man1" \ + man7="$DOCREPO/doc-man-inst/man7" \ + man1dir="$DOCREPO/doc-man-inst/man1" \ + man7dir="$DOCREPO/doc-man-inst/man7" install || exit + +for type in html man +do + find doc-$type-inst -type f | + while read path + do + it=$(expr "$path" : doc-$type-inst/'\(.*\)') || continue + t="doc-${type}pages/$it" + test -f "$t" && diff -q "$path" "$t" && continue + + echo ": $t" && rm -f "$t" && ln "$path" "$t" || exit + ( cd doc-${type}pages && git add "$it" ) + done || exit + + find doc-$type-inst -type f | + sed -e 's|^doc-'$type'-inst/||' | sort >"$tmp.1" && + (cd doc-${type}pages && git ls-files | sort) >"$tmp.2" && + comm -13 "$tmp.1" "$tmp.2" | + ( cd doc-${type}pages && xargs rm -f -- ) || exit + + ( + cd doc-${type}pages + + if git commit -a -m "Autogenerated docs for $NID" + then + git send-pack "$MASTERREPO" master:refs/heads/$type + else + echo "* No changes in $type docs" + fi + ) || exit +done if test -d $PUBLIC then # This is iffy... - mv git.html saved-git-html && - make WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \ - install-webdoc >>../:html.log 2>&1 && - mv saved-git-html git.html + 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 $? -cd ../doc-htmlpages && - (git add . || echo no new files -- not a big deal) && - if git commit -a -m "Autogenerated HTML docs for $NID" - 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" \ - install >../:man.log 2>&1 && - -cd ../doc-manpages && - (git add . || echo no new files -- not a big deal) && - if git commit -a -m "Autogenerated man pages for $NID" - then - git-send-pack "$MASTERREPO" master:refs/heads/man || { - echo "* man failure" - exit 1 - } - else - echo "* No changes in manual pages" - fi - -- 2.32.0.93.g670b81a890