2011-03-25 19:56:25 +00:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# 2011 Nico Schottelius (nico-cdist at schottelius.org)
|
|
|
|
#
|
|
|
|
# This file is part of cdist.
|
|
|
|
#
|
|
|
|
# cdist is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# cdist is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Push a directory to a target, both sides have the same name (i.e. explorers)
|
|
|
|
# or
|
|
|
|
# Pull a directory from a target, both sides have the same name (i.e. explorers)
|
|
|
|
#
|
2011-03-20 02:23:13 +00:00
|
|
|
|
2011-03-29 14:51:11 +00:00
|
|
|
# exit on any error
|
2011-03-29 16:12:19 +00:00
|
|
|
#set -e
|
2011-03-29 14:51:11 +00:00
|
|
|
|
2012-10-26 04:55:01 +00:00
|
|
|
basedir=${0%/*}
|
2011-11-16 07:10:50 +00:00
|
|
|
version=$(git describe)
|
|
|
|
|
2011-03-20 02:23:13 +00:00
|
|
|
# Manpage and HTML
|
2011-09-26 18:14:04 +00:00
|
|
|
A2XM="a2x -f manpage --no-xmllint -a encoding=UTF-8"
|
2011-09-26 22:12:11 +00:00
|
|
|
A2XH="a2x -f xhtml --no-xmllint -a encoding=UTF-8"
|
2011-02-26 10:46:52 +00:00
|
|
|
|
2011-03-25 19:49:09 +00:00
|
|
|
# Developer webbase
|
2011-03-25 20:04:26 +00:00
|
|
|
WEBDIR=$HOME/niconetz
|
2011-11-16 07:10:50 +00:00
|
|
|
WEBBASE=$WEBDIR/software/cdist
|
2011-11-17 12:25:47 +00:00
|
|
|
WEBMAN=$WEBBASE/man/$version
|
2011-03-25 20:04:26 +00:00
|
|
|
WEBPAGE=${WEBBASE}.mdwn
|
2011-03-21 13:00:00 +00:00
|
|
|
|
2011-03-16 09:21:10 +00:00
|
|
|
# Documentation
|
2012-10-25 15:17:52 +00:00
|
|
|
MANDIR=docs/man
|
2011-03-25 20:04:26 +00:00
|
|
|
MAN1DSTDIR=${MANDIR}/man1
|
|
|
|
MAN7DSTDIR=${MANDIR}/man7
|
2012-10-25 15:17:52 +00:00
|
|
|
SPEECHESDIR=docs/speeches
|
2011-03-09 07:53:19 +00:00
|
|
|
|
2012-10-26 04:55:01 +00:00
|
|
|
# Change to checkout directory
|
|
|
|
cd "$basedir"
|
|
|
|
|
2011-03-25 20:04:26 +00:00
|
|
|
case "$1" in
|
2012-10-25 17:07:50 +00:00
|
|
|
man)
|
|
|
|
set -e
|
|
|
|
"$0" mangen
|
|
|
|
"$0" mantype
|
|
|
|
"$0" manbuild
|
|
|
|
;;
|
2012-10-25 16:44:05 +00:00
|
|
|
|
|
|
|
manbuild)
|
|
|
|
trap abort INT
|
|
|
|
abort() {
|
|
|
|
kill 0
|
|
|
|
}
|
|
|
|
for section in 1 7; do
|
|
|
|
for src in ${MANDIR}/man${section}/*.text; do
|
|
|
|
manpage="${src%.text}.$section"
|
|
|
|
if [ ! -f "$manpage" -o "$manpage" -ot "$src" ]; then
|
|
|
|
echo "Compiling man page for $src"
|
|
|
|
$A2XM "$src"
|
|
|
|
fi
|
|
|
|
htmlpage="${src%.text}.html"
|
|
|
|
if [ ! -f "$htmlpage" -o "$htmlpage" -ot "$src" ]; then
|
|
|
|
echo "Compiling html page for $src"
|
|
|
|
$A2XH "$src"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
2012-10-25 16:28:19 +00:00
|
|
|
;;
|
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
mantype)
|
2012-10-25 20:35:20 +00:00
|
|
|
for mansrc in conf/type/*/man.text; do
|
2012-10-25 16:44:05 +00:00
|
|
|
dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;docs/man/man7/;')"
|
|
|
|
ln -sf "../../../$mansrc" "$dst"
|
|
|
|
done
|
|
|
|
;;
|
2012-10-25 16:28:19 +00:00
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
mangen)
|
|
|
|
${MANDIR}/cdist-reference.text.sh
|
2012-10-25 16:28:19 +00:00
|
|
|
;;
|
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
release)
|
2012-10-26 10:19:41 +00:00
|
|
|
./docs/dev/releasehelper
|
2012-10-25 16:28:19 +00:00
|
|
|
;;
|
2011-03-25 21:10:52 +00:00
|
|
|
|
2012-10-25 17:07:50 +00:00
|
|
|
pypi)
|
2012-10-25 21:43:12 +00:00
|
|
|
#$0 very-clean
|
|
|
|
#$0 man
|
2012-10-26 05:37:18 +00:00
|
|
|
$0 version
|
2012-10-25 21:43:12 +00:00
|
|
|
$0 sdist
|
|
|
|
;;
|
|
|
|
sdist)
|
2012-10-25 17:07:50 +00:00
|
|
|
python3 setup.py sdist
|
|
|
|
;;
|
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
speeches)
|
|
|
|
cd "$SPEECHESDIR"
|
|
|
|
for speech in *tex; do
|
|
|
|
pdflatex "$speech"
|
|
|
|
pdflatex "$speech"
|
|
|
|
pdflatex "$speech"
|
2012-05-14 16:32:45 +00:00
|
|
|
done
|
2012-10-25 16:44:05 +00:00
|
|
|
;;
|
2012-10-25 16:28:19 +00:00
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
webmain)
|
|
|
|
cp README ${WEBPAGE}
|
|
|
|
cd ${WEBDIR} && git commit -m "cdist main update" ${WEBPAGE}
|
|
|
|
cd ${WEBDIR} && make pub
|
|
|
|
;;
|
2012-10-25 16:29:49 +00:00
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
web)
|
|
|
|
cp README ${WEBPAGE}
|
|
|
|
rm -rf ${WEBMAN}
|
|
|
|
mkdir -p ${WEBMAN}/man1 ${WEBMAN}/man7
|
|
|
|
|
|
|
|
cp ${MAN1DSTDIR}/*.html ${MAN1DSTDIR}/*.css ${WEBMAN}/man1
|
|
|
|
cp ${MAN7DSTDIR}/*.html ${MAN7DSTDIR}/*.css ${WEBMAN}/man7
|
|
|
|
|
|
|
|
cd ${WEBDIR} && git add ${WEBBASE}
|
|
|
|
cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE}
|
|
|
|
cd ${WEBDIR} && make pub
|
|
|
|
|
|
|
|
# Fix ikiwiki, which does not like symlinks for pseudo security
|
|
|
|
ssh tee.schottelius.org \
|
|
|
|
"cd /home/services/www/nico/www.nico.schottelius.org/www/software/cdist/man &&
|
|
|
|
rm -f latest && ln -sf "$version" latest"
|
|
|
|
;;
|
|
|
|
|
|
|
|
p|pu|pub)
|
|
|
|
for remote in "" github sf ethz; do
|
|
|
|
echo "Pushing to $remote"
|
|
|
|
git push --mirror $remote
|
|
|
|
done
|
|
|
|
;;
|
|
|
|
|
2012-10-25 17:07:50 +00:00
|
|
|
clean)
|
|
|
|
rm -f ${MAN7DSTDIR}/cdist-reference.text
|
2012-10-25 21:49:22 +00:00
|
|
|
|
2012-10-25 17:07:50 +00:00
|
|
|
find "${MANDIR}" -mindepth 2 -type l \
|
|
|
|
-o -name "*.1" \
|
|
|
|
-o -name "*.7" \
|
|
|
|
-o -name "*.html" \
|
|
|
|
-o -name "*.xml" \
|
|
|
|
| xargs rm -f
|
|
|
|
|
|
|
|
find * -name __pycache__ | xargs rm -rf
|
|
|
|
;;
|
2012-10-26 05:37:18 +00:00
|
|
|
clean-dist)
|
|
|
|
rm -f cdist/version.py MANIFEST
|
|
|
|
rm -rf cache/ dist/
|
|
|
|
;;
|
|
|
|
|
2012-10-25 17:07:50 +00:00
|
|
|
very-clean)
|
|
|
|
$0 clean
|
2012-10-26 05:37:18 +00:00
|
|
|
$0 clean-dist
|
2012-10-25 17:07:50 +00:00
|
|
|
;;
|
2012-10-25 16:44:05 +00:00
|
|
|
|
|
|
|
test)
|
|
|
|
shift # skip t
|
|
|
|
|
|
|
|
if [ $# -lt 1 ]; then
|
|
|
|
python3 -m cdist.test
|
|
|
|
else
|
|
|
|
python3 -m unittest "$@"
|
|
|
|
fi
|
2012-10-25 16:28:19 +00:00
|
|
|
;;
|
2011-03-25 21:10:52 +00:00
|
|
|
|
2012-10-25 21:45:56 +00:00
|
|
|
version)
|
|
|
|
echo "VERSION=\"$version\"" > cdist/version.py
|
2012-10-25 21:43:12 +00:00
|
|
|
;;
|
|
|
|
|
2012-10-25 16:44:05 +00:00
|
|
|
*)
|
|
|
|
echo ''
|
|
|
|
echo 'Welcome to cdist!'
|
|
|
|
echo ''
|
|
|
|
echo 'Here are the possible targets:'
|
|
|
|
echo ''
|
2012-10-25 20:35:20 +00:00
|
|
|
echo ' clean: Remove build stuff'
|
|
|
|
echo ' man: Build manpages (requires Asciidoc)'
|
|
|
|
echo ' test: Run tests'
|
2012-10-25 16:44:05 +00:00
|
|
|
echo ''
|
|
|
|
echo ''
|
|
|
|
echo "Unknown target, \"$1\"" >&2
|
|
|
|
exit 1
|
|
|
|
;;
|
2011-10-02 13:56:27 +00:00
|
|
|
|
2011-03-25 20:04:26 +00:00
|
|
|
esac
|