dodoc updates.

Junio C Hamano committed Mar 26, 2007 at 02:04 UTC 653c3f766994a9cb64278a8da6d4b574d441dfe3
1 file changed +75 -66
dodoc.sh
+75 -66
@@ -29,12 +29,15 @@ ID=`git-rev-parse --verify refs/heads/master` || exit $?
29
30 unset GIT_DIR
31
32 -PUBLIC=/pub/software/scm/git/docs &&
33 -MASTERREPO=`pwd` &&
34 -DOCREPO=`dirname "$0"` &&
32 +: ${PUBLIC=/pub/software/scm/git/docs} &&
33 +: ${MASTERREPO=`pwd`} &&
34 +: ${DOCREPO=`dirname "$0"`} &&
35 test "$DOCREPO" != "" &&
36 cd "$DOCREPO" || exit $?
37
38 +tmp=`pwd`/.doctmp-$$
39 +trap 'rm -f "$tmp".*' 0
40 +
41 git pull "$MASTERREPO" master &&
42 git fetch --tags "$MASTERREPO" || exit $?
43 test $(git-rev-parse --verify refs/heads/master) == "$ID" &&
@@ -42,74 +45,80 @@ NID=$(git-describe --abbrev=4 "$ID") &&
45 test '' != "$NID" || exit $?
46
47 # Set up subrepositories
45 -test -d doc-htmlpages || (
46 - mkdir doc-htmlpages &&
47 - cd doc-htmlpages &&
48 - git init-db || exit $?
49 -
50 - if SID=$(git fetch-pack "$MASTERREPO" html)
51 - then
52 - git update-ref HEAD `expr "$SID" : '\(.*\) .*'` &&
53 - git checkout || exit $?
54 - fi
55 -)
56 -test -d doc-manpages || (
57 - mkdir doc-manpages &&
58 - cd doc-manpages &&
59 - git init-db || exit $?
60 -
61 - if SID=$(git fetch-pack "$MASTERREPO" man)
62 - then
63 - git update-ref HEAD `expr "$SID" : '\(.*\) .*'` &&
64 - git checkout || exit $?
65 - fi
66 -)
67 -find doc-htmlpages doc-manpages -type d -name '.git' -prune -o \
68 - -type f -print0 | xargs -0 rm -f
69 -
70 -cd Documentation &&
71 -make WEBDOC_DEST="$DOCREPO/doc-htmlpages" install-webdoc >../:html.log 2>&1 &&
48 +for type in man html
49 +do
50 + test -d doc-${type}pages || (
51 + mkdir doc-${type}pages &&
52 + cd doc-${type}pages &&
53 + git init-db || exit $?
54 +
55 + git fetch-pack "$MASTERREPO" ${type} |
56 + while read sha1 name
57 + do
58 + case "$name" in
59 + refs/heads/${type})
60 + git update-ref HEAD $sha1 &&
61 + git checkout || exit $?
62 + break
63 + ;;
64 + esac
65 + done || exit $?
66 + ) || exit
67 + rm -fr doc-$type-inst
68 +done
69 +
70 +make >../:html.log 2>&1 \
71 + -C Documentation -j 2 \
72 + WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit
73 +
74 +make >../:man.log 2>&1 \
75 + -C Documentation -j 2 \
76 + man1="$DOCREPO/doc-man-inst/man1" \
77 + man7="$DOCREPO/doc-man-inst/man7" \
78 + man1dir="$DOCREPO/doc-man-inst/man1" \
79 + man7dir="$DOCREPO/doc-man-inst/man7" install || exit
80 +
81 +for type in html man
82 +do
83 + find doc-$type-inst -type f |
84 + while read path
85 + do
86 + it=$(expr "$path" : doc-$type-inst/'\(.*\)') || continue
87 + t="doc-${type}pages/$it"
88 + test -f "$t" && diff -q "$path" "$t" && continue
89 +
90 + echo ": $t" && rm -f "$t" && ln "$path" "$t" || exit
91 + ( cd doc-${type}pages && git add "$it" )
92 + done || exit
93 +
94 + find doc-$type-inst -type f |
95 + sed -e 's|^doc-'$type'-inst/||' | sort >"$tmp.1" &&
96 + (cd doc-${type}pages && git ls-files | sort) >"$tmp.2" &&
97 + comm -13 "$tmp.1" "$tmp.2" |
98 + ( cd doc-${type}pages && xargs rm -f -- ) || exit
99 +
100 + (
101 + cd doc-${type}pages
102 +
103 + if git commit -a -m "Autogenerated docs for $NID"
104 + then
105 + git send-pack "$MASTERREPO" master:refs/heads/$type
106 + else
107 + echo "* No changes in $type docs"
108 + fi
109 + ) || exit
110 +done
111
112 if test -d $PUBLIC
113 then
114 # This is iffy...
76 - mv git.html saved-git-html &&
77 - make WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \
78 - install-webdoc >>../:html.log 2>&1 &&
79 - mv saved-git-html git.html
115 + mv Documentation/git.html Documentation/saved-git-html
116 + make >>../:html.log 2>&1 \
117 + -C Documentation \
118 + WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \
119 + install-webdoc &&
120 + mv Documentation/saved-git-html Documentation/git.html
121 else
122 echo "* No public html at $PUBLIC"
123 fi || exit $?
124
84 -cd ../doc-htmlpages &&
85 - (git add . || echo no new files -- not a big deal) &&
86 - if git commit -a -m "Autogenerated HTML docs for $NID"
87 - then
88 - git-send-pack "$MASTERREPO" master:refs/heads/html || {
89 - echo "* HTML failure"
90 - exit 1
91 - }
92 - else
93 - echo "* No changes in html docs"
94 - fi
95 -
96 -cd ../Documentation &&
97 -make \
98 - man1="$DOCREPO/doc-manpages/man1" \
99 - man7="$DOCREPO/doc-manpages/man7" \
100 - man1dir="$DOCREPO/doc-manpages/man1" \
101 - man7dir="$DOCREPO/doc-manpages/man7" \
102 - install >../:man.log 2>&1 &&
103 -
104 -cd ../doc-manpages &&
105 - (git add . || echo no new files -- not a big deal) &&
106 - if git commit -a -m "Autogenerated man pages for $NID"
107 - then
108 - git-send-pack "$MASTERREPO" master:refs/heads/man || {
109 - echo "* man failure"
110 - exit 1
111 - }
112 - else
113 - echo "* No changes in manual pages"
114 - fi
115 -