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.
Junio C Hamano committed
Nov 15, 2011 at 12:31 UTC
adaa3cafb346b9c00d7ff92a93f7c1231e66e1ee
1 file changed
+53
-77
dodoc.sh
+53
-77
@@ -1,81 +1,70 @@
1
#!/bin/sh
2
-#
3
-# This script is called from the post-update hook, and when
4
-# the master branch is updated, run in $HOME/git-doc, like
5
-# this:
6
-: <<\END_OF_COMMENTARY
2
8
-$ cat >hooks/post-update
9
-#!/bin/sh
10
-case " $* " in
11
-*' refs/heads/master '*)
12
- echo $HOME/git-doc/dodoc.sh | at now
13
- ;;
14
-esac
15
-exec git update-server-info
16
-$ chmod +x hooks/post-update
17
-
18
-END_OF_COMMENTARY
3
+# "git-doc" is a clone of the git.git repository and has the master
4
+# branch checked out. We update the working tree and prepare
5
+# preformatted documentation pages, and install them in doc-htmlpages
6
+# and doc-manapges subdirectories. When they are updated, they are
7
+# pushed back into their own repositories next to the git.git
8
+# repository.
9
20
-# $HOME/git-doc is a clone of the git.git repository and
21
-# has the master branch checkd out. We update the working
22
-# tree and build pre-formatted documentation pages, install
23
-# in doc-htmlpages and doc-manapges subdirectory here.
24
-# These two are their own git repository, and when they are
25
-# updated the updates are pushed back into their own branches
26
-# in git.git repository.
10
+unset GIT_DIR
11
28
-ID=`git rev-parse --verify refs/heads/master` || exit $?
12
+MASTERREPO=/srv/project/git/git.git/
13
+DOCREFHIER=refs/docs
14
+MANREPO=/srv/project/git/git-manpages.git/
15
+HTMLREPO=/srv/project/git/git-htmldocs.git/
16
30
-unset GIT_DIR
17
+target_repo () {
18
+ TARGETVAR=$(echo "$1"REPO | tr 'a-z' 'A-Z') &&
19
+ eval "echo \$$TARGETVAR"
20
+}
21
32
-: ${PUBLIC=/pub/software/scm/git/docs} &&
33
-: ${MASTERREPO=`pwd`} &&
34
-: ${DOCREPO=`dirname "$0"`} &&
35
-test "$DOCREPO" != "" &&
36
-cd "$DOCREPO" || exit $?
22
+DOCREPO=$(pwd) ;# "git-doc"
23
+exec >:doc.log 2>&1
24
38
-DOCREPO=`pwd`
25
+ID=$(cd "$MASTERREPO" && git rev-parse --verify refs/heads/master) || exit $?
26
27
tmp=`pwd`/.doctmp-$$
28
trap 'rm -f "$tmp".*' 0
29
30
(
44
- git pull "$MASTERREPO" master &&
45
- git fetch --tags "$MASTERREPO"
46
-) >/dev/null 2>/dev/null || exit $?
47
-test $(git rev-parse --verify refs/heads/master) == "$ID" &&
31
+ git pull --ff-only "$MASTERREPO" master &&
32
+ git fetch --tags "$MASTERREPO"
33
+) || exit $?
34
+
35
+test $(git rev-parse --verify refs/heads/master) = "$ID" &&
36
NID=$(git describe --abbrev=4 "$ID") &&
49
-test '' != "$NID" || exit $?
37
+test -n "$NID" || exit $?
38
+
39
+git reset --hard
40
41
# Set up subrepositories
42
for type in man html
43
do
54
- test -d doc-${type}pages || (
55
- mkdir doc-${type}pages &&
56
- cd doc-${type}pages &&
57
- git init-db || exit $?
58
-
59
- git fetch-pack "$MASTERREPO" ${type} |
60
- while read sha1 name
61
- do
62
- case "$name" in
63
- refs/heads/${type})
64
- git update-ref HEAD $sha1 &&
65
- git checkout || exit $?
66
- break
67
- ;;
68
- esac
69
- done || exit $?
70
- ) || exit
71
- rm -fr doc-$type-inst
44
+ test -d doc-${type}pages && continue
45
+ (
46
+ git init doc-${type}pages &&
47
+ cd doc-${type}pages || exit
48
+ TARGETREPO=$(target_repo $type) &&
49
+ git pull "$TARGETREPO" master
50
+ ) &&
51
+ rm -fr doc-$type-inst &&
52
+ mkdir -p doc-$type-inst &&
53
+ (
54
+ cd doc-${type}pages && git archive HEAD
55
+ ) |
56
+ (
57
+ cd doc-$type-inst && tar xf -
58
+ )
59
done
60
74
-dd='ASCIIDOC_NO_ROFF=YesPlease
75
-ASCIIDOC8=YesPlease
76
-MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
77
-BLK_SHA1=YesPlease
78
-GNU_ROFF=YesPlease'
61
+dd='
62
+ ASCIIDOC_NO_ROFF=YesPlease
63
+ ASCIIDOC8=YesPlease
64
+ MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
65
+ BLK_SHA1=YesPlease
66
+ GNU_ROFF=YesPlease
67
+'
68
69
case "$NID" in
70
?*-?*) ;;
@@ -89,11 +78,11 @@ esac
78
DIFF=diff
79
export DIFF
80
92
-make >./:html.log 2>&1 \
81
+make \
82
-C Documentation -j 2 $dd \
83
WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit
84
96
-make >./:man.log 2>&1 \
85
+make \
86
-C Documentation -j 2 $dd \
87
man1="$DOCREPO/doc-man-inst/man1" \
88
man5="$DOCREPO/doc-man-inst/man5" \
@@ -138,28 +127,15 @@ do
127
128
if git commit -a -m "Autogenerated $TYPE for $NID"
129
then
141
- git send-pack "$MASTERREPO" master:refs/heads/$type \
142
- >/dev/null 2>&1
130
+ TARGETREPO=$(target_repo $type) &&
131
+ git push "$TARGETREPO" master:master
132
else
133
echo "* No changes in $type docs"
134
fi
135
) || exit
136
done
137
149
-if test -d $PUBLIC
150
-then
151
- # This is iffy...
152
- mv Documentation/git.html Documentation/saved-git-html
153
- make >>./:html.log 2>&1 \
154
- -C Documentation \
155
- WEBDOC_DEST="$PUBLIC" ASCIIDOC_EXTRA='-a stalenotes' \
156
- install-webdoc &&
157
- mv Documentation/saved-git-html Documentation/git.html
158
-else
159
- echo "* No public html at $PUBLIC"
160
-fi || exit $?
161
-
138
echo '
139
140
*** ALL DONE ***
165
-' >>./:html.log
141
+'