OLD | NEW |
1 #!/bin/bash -e | 1 #!/bin/bash -e |
2 shopt -s nullglob | 2 shopt -s nullglob |
3 | 3 |
4 cd $(dirname "$0") | 4 cd $(dirname "$0") |
5 | 5 |
6 # Script which takes all the asciidoc git-*.txt files in this directory, renders | 6 # Script which takes all the asciidoc git-*.txt files in this directory, renders |
7 # them to html + manpage format using git 1.9's doc toolchain, then puts | 7 # them to html + manpage format using git 1.9's doc toolchain, then puts |
8 # them in depot_tools to be committed. | 8 # them in depot_tools to be committed. |
9 | 9 |
10 ensure_in_path() { | 10 ensure_in_path() { |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 # Replace the 'source' and 'package' strings. | 56 # Replace the 'source' and 'package' strings. |
57 ed git/Documentation/asciidoc.conf <<EOF | 57 ed git/Documentation/asciidoc.conf <<EOF |
58 H | 58 H |
59 81 | 59 81 |
60 s/Git/depot_tools | 60 s/Git/depot_tools |
61 +2 | 61 +2 |
62 s/Git Manual/Chromium depot_tools Manual | 62 s/Git Manual/Chromium depot_tools Manual |
63 wq | 63 wq |
64 EOF | 64 EOF |
65 | 65 |
66 # fix Makefile to include non-_-prefixed files as MAN1 entries | 66 # fix Makefile to include non-_-prefixed files as MAN7 entries |
67 { | 67 { |
68 shopt -s extglob | 68 shopt -s extglob |
69 echo H | 69 echo H |
70 echo 16 | 70 echo 35 |
71 for x in "$(echo !(git-*|_*).txt)" | 71 for x in "$(echo !(git-*|_*).txt)" |
72 do | 72 do |
73 echo i | 73 echo i |
74 echo MAN1_TXT += $x | 74 echo MAN7_TXT += $x |
75 echo . | 75 echo . |
76 done | 76 done |
77 echo wq | 77 echo wq |
78 } | ed git/Documentation/Makefile | 78 } | ed git/Documentation/Makefile |
79 | 79 |
80 # fix build-docdep.perl to ignore attributes on include::[] macros | 80 # fix build-docdep.perl to ignore attributes on include::[] macros |
81 ed git/Documentation/build-docdep.perl <<EOF | 81 ed git/Documentation/build-docdep.perl <<EOF |
82 H | 82 H |
83 12 | 83 12 |
84 c | 84 c |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 # \tinclude::_git-tool_desc.category.txt[] | 138 # \tinclude::_git-tool_desc.category.txt[] |
139 PLAIN_PATH=${x%%_desc.*.txt} | 139 PLAIN_PATH=${x%%_desc.*.txt} |
140 PLAIN_PATH=${PLAIN_PATH:1} | 140 PLAIN_PATH=${PLAIN_PATH:1} |
141 echo "linkgit:$PLAIN_PATH[1]::" | 141 echo "linkgit:$PLAIN_PATH[1]::" |
142 echo -e "include::${x}[]" | 142 echo -e "include::${x}[]" |
143 echo | 143 echo |
144 done | 144 done |
145 } > __${category}.txt | 145 } > __${category}.txt |
146 done | 146 done |
147 | 147 |
| 148 JOBS=0 |
148 HTML_TARGETS=() | 149 HTML_TARGETS=() |
149 MAN_TARGETS=() | 150 MAN_TARGETS=() |
150 for x in *.txt *.css | 151 for x in *.txt *.css |
151 do | 152 do |
152 TO="git/Documentation/$x" | 153 TO="git/Documentation/$x" |
153 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO" | 154 if [[ ! -f "$TO" ]] || ! cmp --silent "$x" "$TO" |
154 then | 155 then |
155 echo \'$x\' differs | 156 echo \'$x\' differs |
156 cp $x "$TO" | 157 cp $x "$TO" |
157 fi | 158 fi |
158 # Exclude files beginning with _ from the target list. This is useful to have | 159 # Exclude files beginning with _ from the target list. This is useful to have |
159 # includable snippet files. | 160 # includable snippet files. |
160 if [[ ${x:0:1} != _ && ${x:(-4)} == .txt ]] | 161 if [[ ${x:0:1} != _ && ${x:(-4)} == .txt ]] |
161 then | 162 then |
162 HTML_TARGETS+=("${x%%.txt}.html") | 163 HTML_TARGETS+=("${x%%.txt}.html") |
163 MAN_TARGETS+=("${x%%.txt}.1") | 164 if [[ ${x:0:3} == git ]] |
| 165 then |
| 166 MAN1_TARGETS+=("${x%%.txt}.1") |
| 167 else |
| 168 MAN7_TARGETS+=("${x%%.txt}.7") |
| 169 fi |
| 170 JOBS=$[$JOBS + 2] |
164 fi | 171 fi |
165 done | 172 done |
166 | 173 |
167 VER="v$(git rev-parse --short HEAD)" | 174 VER="v$(git rev-parse --short HEAD)" |
168 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER") | 175 if [[ ! -f git/version ]] || ! cmp --silent git/version <(echo "$VER") |
169 then | 176 then |
170 echo Version changed, cleaning. | 177 echo Version changed, cleaning. |
171 echo "$VER" > git/version | 178 echo "$VER" > git/version |
172 (cd git/Documentation && make clean) | 179 (cd git/Documentation && make clean) |
173 fi | 180 fi |
174 | 181 |
175 # This export is so that asciidoc sys snippets which invoke git run relative to | 182 # This export is so that asciidoc sys snippets which invoke git run relative to |
176 # depot_tools instead of the git clone. | 183 # depot_tools instead of the git clone. |
177 ( | 184 ( |
178 export GIT_DIR="$(git rev-parse --git-dir)" && | 185 export GIT_DIR="$(git rev-parse --git-dir)" && |
179 cd git/Documentation && | 186 cd git/Documentation && |
180 make -j"$[${#MAN_TARGETS} + ${#HTML_TARGETS}]" "${MAN_TARGETS[@]}" "${HTML_TAR
GETS[@]}" | 187 make -j"$JOBS" "${MAN1_TARGETS[@]}" "${MAN7_TARGETS[@]}" "${HTML_TARGETS[@]}" |
181 ) | 188 ) |
182 | 189 |
183 for x in "${HTML_TARGETS[@]}" | 190 for x in "${HTML_TARGETS[@]}" |
184 do | 191 do |
185 echo Copying ../html/$x | 192 echo Copying ../html/$x |
186 tr -d '\015' <"git/Documentation/$x" >"../html/$x" | 193 tr -d '\015' <"git/Documentation/$x" >"../html/$x" |
187 done | 194 done |
188 | 195 |
189 for x in "${MAN_TARGETS[@]}" | 196 for x in "${MAN1_TARGETS[@]}" |
190 do | 197 do |
191 echo Copying ../man1/$x | 198 echo Copying ../man1/$x |
192 cp "git/Documentation/$x" ../man1 | 199 cp "git/Documentation/$x" ../man1 |
| 200 done |
| 201 |
| 202 for x in "${MAN7_TARGETS[@]}" |
| 203 do |
| 204 echo Copying ../man7/$x |
| 205 cp "git/Documentation/$x" ../man7 |
193 done | 206 done |
OLD | NEW |