mirror of
https://github.com/git/git.git
synced 2026-01-19 07:04:49 +00:00
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.
142 lines
3.0 KiB
Bash
Executable File
142 lines
3.0 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# "git-doc" is a clone of the git.git repository and has the master
|
|
# branch checked out. We update the working tree and prepare
|
|
# preformatted documentation pages, and install them in doc-htmlpages
|
|
# and doc-manapges subdirectories. When they are updated, they are
|
|
# pushed back into their own repositories next to the git.git
|
|
# repository.
|
|
|
|
unset GIT_DIR
|
|
|
|
MASTERREPO=/srv/project/git/git.git/
|
|
DOCREFHIER=refs/docs
|
|
MANREPO=/srv/project/git/git-manpages.git/
|
|
HTMLREPO=/srv/project/git/git-htmldocs.git/
|
|
|
|
target_repo () {
|
|
TARGETVAR=$(echo "$1"REPO | tr 'a-z' 'A-Z') &&
|
|
eval "echo \$$TARGETVAR"
|
|
}
|
|
|
|
DOCREPO=$(pwd) ;# "git-doc"
|
|
exec >:doc.log 2>&1
|
|
|
|
ID=$(cd "$MASTERREPO" && git rev-parse --verify refs/heads/master) || exit $?
|
|
|
|
tmp=`pwd`/.doctmp-$$
|
|
trap 'rm -f "$tmp".*' 0
|
|
|
|
(
|
|
git pull --ff-only "$MASTERREPO" master &&
|
|
git fetch --tags "$MASTERREPO"
|
|
) || exit $?
|
|
|
|
test $(git rev-parse --verify refs/heads/master) = "$ID" &&
|
|
NID=$(git describe --abbrev=4 "$ID") &&
|
|
test -n "$NID" || exit $?
|
|
|
|
git reset --hard
|
|
|
|
# Set up subrepositories
|
|
for type in man html
|
|
do
|
|
test -d doc-${type}pages && continue
|
|
(
|
|
git init doc-${type}pages &&
|
|
cd doc-${type}pages || exit
|
|
TARGETREPO=$(target_repo $type) &&
|
|
git pull "$TARGETREPO" master
|
|
) &&
|
|
rm -fr doc-$type-inst &&
|
|
mkdir -p doc-$type-inst &&
|
|
(
|
|
cd doc-${type}pages && git archive HEAD
|
|
) |
|
|
(
|
|
cd doc-$type-inst && tar xf -
|
|
)
|
|
done
|
|
|
|
dd='
|
|
ASCIIDOC_NO_ROFF=YesPlease
|
|
ASCIIDOC8=YesPlease
|
|
MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
|
|
BLK_SHA1=YesPlease
|
|
GNU_ROFF=YesPlease
|
|
'
|
|
|
|
case "$NID" in
|
|
?*-?*) ;;
|
|
?*)
|
|
make clean &&
|
|
rm -fr doc-html-inst doc-man-inst &&
|
|
mkdir doc-html-inst doc-man-inst || exit
|
|
;;
|
|
esac
|
|
|
|
DIFF=diff
|
|
export DIFF
|
|
|
|
make \
|
|
-C Documentation -j 2 $dd \
|
|
WEBDOC_DEST="$DOCREPO/doc-html-inst" install-webdoc || exit
|
|
|
|
make \
|
|
-C Documentation -j 2 $dd \
|
|
man1="$DOCREPO/doc-man-inst/man1" \
|
|
man5="$DOCREPO/doc-man-inst/man5" \
|
|
man7="$DOCREPO/doc-man-inst/man7" \
|
|
man1dir="$DOCREPO/doc-man-inst/man1" \
|
|
man5dir="$DOCREPO/doc-man-inst/man5" \
|
|
man7dir="$DOCREPO/doc-man-inst/man7" install || exit
|
|
|
|
for type in html man
|
|
do
|
|
find doc-$type-inst -type f |
|
|
while read path
|
|
do
|
|
it=$(expr "$path" : doc-$type-inst/'\(.*\)') || continue
|
|
t="doc-${type}pages/$it"
|
|
test -f "$t" && diff -q "$path" "$t" && continue
|
|
mkdir -p "$(dirname "$t")" &&
|
|
echo ": $t" && rm -f "$t" && ln "$path" "$t" || exit
|
|
( cd doc-${type}pages && git add "$it" )
|
|
done || exit
|
|
|
|
find doc-$type-inst -type f |
|
|
sed -e 's|^doc-'$type'-inst/||' | sort >"$tmp.1" &&
|
|
(cd doc-${type}pages && git ls-files | sort) >"$tmp.2" &&
|
|
comm -13 "$tmp.1" "$tmp.2" |
|
|
( cd doc-${type}pages && xargs rm -f -- ) || exit
|
|
|
|
(
|
|
cd doc-${type}pages
|
|
|
|
case "$type" in
|
|
html)
|
|
TYPE='HTML docs'
|
|
rm -f index.html
|
|
ln -sf git.html index.html
|
|
git add index.html
|
|
;;
|
|
man)
|
|
TYPE='manpages'
|
|
;;
|
|
esac
|
|
|
|
if git commit -a -m "Autogenerated $TYPE for $NID"
|
|
then
|
|
TARGETREPO=$(target_repo $type) &&
|
|
git push "$TARGETREPO" master:master
|
|
else
|
|
echo "* No changes in $type docs"
|
|
fi
|
|
) || exit
|
|
done
|
|
|
|
echo '
|
|
|
|
*** ALL DONE ***
|
|
'
|