Skip to content

Commit adaa3ca

Browse files
committed
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.
1 parent aadd6ba commit adaa3ca

File tree

1 file changed

+53
-77
lines changed

1 file changed

+53
-77
lines changed

dodoc.sh

Lines changed: 53 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,70 @@
11
#!/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
72

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.
199

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
2711

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/
2916

30-
unset GIT_DIR
17+
target_repo () {
18+
TARGETVAR=$(echo "$1"REPO | tr 'a-z' 'A-Z') &&
19+
eval "echo \$$TARGETVAR"
20+
}
3121

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
3724

38-
DOCREPO=`pwd`
25+
ID=$(cd "$MASTERREPO" && git rev-parse --verify refs/heads/master) || exit $?
3926

4027
tmp=`pwd`/.doctmp-$$
4128
trap 'rm -f "$tmp".*' 0
4229

4330
(
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" &&
4836
NID=$(git describe --abbrev=4 "$ID") &&
49-
test '' != "$NID" || exit $?
37+
test -n "$NID" || exit $?
38+
39+
git reset --hard
5040

5141
# Set up subrepositories
5242
for type in man html
5343
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+
)
7259
done
7360

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+
'
7968

8069
case "$NID" in
8170
?*-?*) ;;
@@ -89,11 +78,11 @@ esac
8978
DIFF=diff
9079
export DIFF
9180

92-
make >./:html.log 2>&1 \
81+
make \
9382
-C Documentation -j 2 $dd \
9483
WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit
9584

96-
make >./:man.log 2>&1 \
85+
make \
9786
-C Documentation -j 2 $dd \
9887
man1="$DOCREPO/doc-man-inst/man1" \
9988
man5="$DOCREPO/doc-man-inst/man5" \
@@ -138,28 +127,15 @@ do
138127

139128
if git commit -a -m "Autogenerated $TYPE for $NID"
140129
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
143132
else
144133
echo "* No changes in $type docs"
145134
fi
146135
) || exit
147136
done
148137

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-
162138
echo '
163139
164140
*** ALL DONE ***
165-
' >>./:html.log
141+
'

0 commit comments

Comments
 (0)