]>
Commit | Line | Data |
---|---|---|
7dc35b94 | 1 | #!/bin/sh |
7dc35b94 | 2 | |
adaa3caf JH |
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. | |
7dc35b94 | 9 | |
adaa3caf | 10 | unset GIT_DIR |
7dc35b94 | 11 | |
10c78883 | 12 | : ${TOP=/srv/project/git} |
8dd9a93e JH |
13 | |
14 | MASTERREPO=$TOP/git.git/ | |
15 | MANREPO=$TOP/git-manpages.git/ | |
16 | HTMLREPO=$TOP/git-htmldocs.git/ | |
7dc35b94 | 17 | |
adaa3caf JH |
18 | target_repo () { |
19 | TARGETVAR=$(echo "$1"REPO | tr 'a-z' 'A-Z') && | |
20 | eval "echo \$$TARGETVAR" | |
21 | } | |
7dc35b94 | 22 | |
adaa3caf JH |
23 | DOCREPO=$(pwd) ;# "git-doc" |
24 | exec >:doc.log 2>&1 | |
7dc35b94 | 25 | |
adaa3caf | 26 | ID=$(cd "$MASTERREPO" && git rev-parse --verify refs/heads/master) || exit $? |
a825af06 | 27 | |
653c3f76 JH |
28 | tmp=`pwd`/.doctmp-$$ |
29 | trap 'rm -f "$tmp".*' 0 | |
30 | ||
29a0ea8c | 31 | ( |
adaa3caf | 32 | git pull --ff-only "$MASTERREPO" master && |
47c1fc15 | 33 | git fetch --tags --force "$MASTERREPO" |
adaa3caf JH |
34 | ) || exit $? |
35 | ||
36 | test $(git rev-parse --verify refs/heads/master) = "$ID" && | |
c6d71b2d | 37 | NID=$(git describe --abbrev=4 "$ID") && |
adaa3caf JH |
38 | test -n "$NID" || exit $? |
39 | ||
40 | git reset --hard | |
7dc35b94 JH |
41 | |
42 | # Set up subrepositories | |
653c3f76 JH |
43 | for type in man html |
44 | do | |
adaa3caf JH |
45 | test -d doc-${type}pages && continue |
46 | ( | |
47 | git init doc-${type}pages && | |
48 | cd doc-${type}pages || exit | |
49 | TARGETREPO=$(target_repo $type) && | |
50 | git pull "$TARGETREPO" master | |
51 | ) && | |
52 | rm -fr doc-$type-inst && | |
53 | mkdir -p doc-$type-inst && | |
54 | ( | |
55 | cd doc-${type}pages && git archive HEAD | |
56 | ) | | |
57 | ( | |
58 | cd doc-$type-inst && tar xf - | |
59 | ) | |
653c3f76 JH |
60 | done |
61 | ||
5053b9c1 JH |
62 | # The below used to contain this instead... |
63 | # MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/" | |
adaa3caf | 64 | dd=' |
5053b9c1 | 65 | MAN_BASE_URL="git-htmldocs/" |
adaa3caf JH |
66 | BLK_SHA1=YesPlease |
67 | GNU_ROFF=YesPlease | |
af1e5c2a | 68 | MAN_BOLD_LITERAL=YesPlease |
adaa3caf | 69 | ' |
cce1400a | 70 | |
e8f506d0 JH |
71 | if test -z "$DOC_FROM_SCRATCH" |
72 | then | |
73 | case "$NID" in | |
c88433dd | 74 | ?*-g*) ;; |
e8f506d0 JH |
75 | ?*) DOC_FROM_SCRATCH=yes ;; |
76 | esac | |
77 | fi | |
78 | if test -n "$DOC_FROM_SCRATCH" | |
79 | then | |
2a414fc9 JH |
80 | make clean && |
81 | rm -fr doc-html-inst doc-man-inst && | |
82 | mkdir doc-html-inst doc-man-inst || exit | |
e8f506d0 | 83 | fi |
2a414fc9 | 84 | |
93834fd3 JH |
85 | DIFF=diff |
86 | export DIFF | |
87 | ||
adaa3caf | 88 | make \ |
7865d183 | 89 | -C Documentation -j 2 $dd \ |
653c3f76 JH |
90 | WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit |
91 | ||
adaa3caf | 92 | make \ |
7865d183 | 93 | -C Documentation -j 2 $dd \ |
653c3f76 | 94 | man1="$DOCREPO/doc-man-inst/man1" \ |
626254d4 | 95 | man5="$DOCREPO/doc-man-inst/man5" \ |
653c3f76 JH |
96 | man7="$DOCREPO/doc-man-inst/man7" \ |
97 | man1dir="$DOCREPO/doc-man-inst/man1" \ | |
626254d4 | 98 | man5dir="$DOCREPO/doc-man-inst/man5" \ |
653c3f76 JH |
99 | man7dir="$DOCREPO/doc-man-inst/man7" install || exit |
100 | ||
101 | for type in html man | |
102 | do | |
103 | find doc-$type-inst -type f | | |
104 | while read path | |
105 | do | |
106 | it=$(expr "$path" : doc-$type-inst/'\(.*\)') || continue | |
107 | t="doc-${type}pages/$it" | |
108 | test -f "$t" && diff -q "$path" "$t" && continue | |
3d575ef7 | 109 | mkdir -p "$(dirname "$t")" && |
653c3f76 JH |
110 | echo ": $t" && rm -f "$t" && ln "$path" "$t" || exit |
111 | ( cd doc-${type}pages && git add "$it" ) | |
112 | done || exit | |
113 | ||
114 | find doc-$type-inst -type f | | |
115 | sed -e 's|^doc-'$type'-inst/||' | sort >"$tmp.1" && | |
116 | (cd doc-${type}pages && git ls-files | sort) >"$tmp.2" && | |
117 | comm -13 "$tmp.1" "$tmp.2" | | |
118 | ( cd doc-${type}pages && xargs rm -f -- ) || exit | |
119 | ||
120 | ( | |
121 | cd doc-${type}pages | |
122 | ||
89822eec JH |
123 | case "$type" in |
124 | html) | |
125 | TYPE='HTML docs' | |
126 | rm -f index.html | |
127 | ln -sf git.html index.html | |
128 | git add index.html | |
129 | ;; | |
130 | man) | |
131 | TYPE='manpages' | |
132 | ;; | |
133 | esac | |
134 | ||
135 | if git commit -a -m "Autogenerated $TYPE for $NID" | |
653c3f76 | 136 | then |
adaa3caf JH |
137 | TARGETREPO=$(target_repo $type) && |
138 | git push "$TARGETREPO" master:master | |
653c3f76 JH |
139 | else |
140 | echo "* No changes in $type docs" | |
141 | fi | |
142 | ) || exit | |
143 | done | |
7dc35b94 | 144 | |
fef78376 JH |
145 | echo ' |
146 | ||
147 | *** ALL DONE *** | |
adaa3caf | 148 | ' |