partial transformation

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-03-25 21:04:26 +01:00
parent 4d33e524a1
commit 8b9b95f984

156
build.sh Normal file → Executable file
View file

@ -24,57 +24,98 @@
# #
# Manpage and HTML # Manpage and HTML
A2XM=a2x -f manpage --no-xmllint A2XM="a2x -f manpage --no-xmllint"
A2XH=a2x -f xhtml --no-xmllint A2XH="a2x -f xhtml --no-xmllint"
# Developer webbase # Developer webbase
WEBDIR=$$HOME/niconetz WEBDIR=$HOME/niconetz
WEBBASE=software/cdist WEBBASE=software/cdist
WEBPAGE=$(WEBBASE).mdwn WEBPAGE=${WEBBASE}.mdwn
# Documentation # Documentation
MANDIR=doc/man MANDIR=doc/man
MAN1DSTDIR=${MANDIR}/man1
MAN1DSTDIR=$(MANDIR)/man1 MAN7DSTDIR=${MANDIR}/man7
MAN7DSTDIR=$(MANDIR)/man7
MANOUTDIRS=$(MAN1DSTDIR) $(MAN7DSTDIR)
MAN1SRC= \ MAN1SRC= \
$(MANDIR)/cdist-code-run.text \ ${MANDIR}/cdist-code-run.text \
$(MANDIR)/cdist-code-run-all.text \ ${MANDIR}/cdist-code-run-all.text \
$(MANDIR)/cdist-config.text \ ${MANDIR}/cdist-config.text \
$(MANDIR)/cdist-dir.text \ ${MANDIR}/cdist-dir.text \
$(MANDIR)/cdist-env.text \ ${MANDIR}/cdist-env.text \
$(MANDIR)/cdist-explorer-run-global.text \ ${MANDIR}/cdist-explorer-run-global.text \
$(MANDIR)/cdist-deploy-to.text \ ${MANDIR}/cdist-deploy-to.text \
$(MANDIR)/cdist-explorer.text \ ${MANDIR}/cdist-explorer.text \
$(MANDIR)/cdist-manifest.text \ ${MANDIR}/cdist-manifest.text \
$(MANDIR)/cdist-manifest-run.text \ ${MANDIR}/cdist-manifest-run.text \
$(MANDIR)/cdist-manifest-run-init.text \ ${MANDIR}/cdist-manifest-run-init.text \
$(MANDIR)/cdist-manifest-run-all.text \ ${MANDIR}/cdist-manifest-run-all.text \
$(MANDIR)/cdist-object-explorer-all.text \ ${MANDIR}/cdist-object-explorer-all.text \
$(MANDIR)/cdist-object-gencode.text \ ${MANDIR}/cdist-object-gencode.text \
$(MANDIR)/cdist-object-gencode-all.text \ ${MANDIR}/cdist-object-gencode-all.text \
$(MANDIR)/cdist-remote-explorer-run.text \ ${MANDIR}/cdist-remote-explorer-run.text \
$(MANDIR)/cdist-run-remote.text \ ${MANDIR}/cdist-run-remote.text \
$(MANDIR)/cdist-type-build-emulation.text \ ${MANDIR}/cdist-type-build-emulation.text \
$(MANDIR)/cdist-type-emulator.text \ ${MANDIR}/cdist-type-emulator.text \
$(MANDIR)/cdist-type-template.text \ ${MANDIR}/cdist-type-template.text
MAN7SRC=${MANDIR}/cdist.text \
${MANDIR}/cdist-best-practise.text \
${MANDIR}/cdist-hacker.text \
${MANDIR}/cdist-quickstart.text \
${MANDIR}/cdist-reference.text \
${MANDIR}/cdist-stages.text \
${MANDIR}/cdist-type.text \
case "$1" in
man)
for mansrc in ${MAN1SRC} ${MAN7SRC}; do
ln -sf ../../../$mansrc ${MAN1DSTDIR};
done
for mansrc in ${MAN7TYPESRC}; do
dst="$(echo $mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"
ln -sf ../../../$$mansrc $$dst
done
;;
web)
cp README ${WEBDIR}/${WEBPAGE}
rm -rf ${WEBDIR}/${WEBBASE}/man && mkdir ${WEBDIR}/${WEBBASE}/man
cp -r $(MANHTMLDIR)/* ${WEBDIR}/${WEBBASE}/man
cd ${WEBDIR} && git add ${WEBBASE}/man
cd ${WEBDIR} && git commit -m "cdist update" ${WEBBASE} ${WEBPAGE}
cd ${WEBDIR} && make pub
;;
pub)
git push --mirror
git push --mirror github
;;
*)
echo ''
echo 'Welcome to cdist!'
echo ''
echo 'Here are the possible targets:'
echo ''
echo ' man: Build manpages (requires Asciidoc)'
echo ' manhtml: Build html-manpages (requires Asciidoc)'
echo ' clean: Remove build stuff'
echo ''
echo ''
echo "Unknown target, \"$1\"" >&2
exit 1
;;
esac
MAN7SRC=$(MANDIR)/cdist.text \
$(MANDIR)/cdist-best-practise.text \
$(MANDIR)/cdist-hacker.text \
$(MANDIR)/cdist-quickstart.text \
$(MANDIR)/cdist-reference.text \
$(MANDIR)/cdist-stages.text \
$(MANDIR)/cdist-type.text \
# Manpages from types # Manpages from types
MAN7TYPESRC=$(shell ls conf/type/*/man.text) MAN7TYPESRC=$(ls conf/type/*/man.text)
# Source files after linking them # Source files after linking them
MAN1TMPSRC=$(shell ls $(MAN1DSTDIR)/*.text) MAN1TMPSRC=$(shell ls ${MAN1DSTDIR}/*.text)
MAN7TMPSRC=$(shell ls $(MAN7DSTDIR)/*.text) MAN7TMPSRC=$(shell ls ${MAN7DSTDIR}/*.text)
# Destination files based on linked files, not static list # Destination files based on linked files, not static list
MAN1DST=$(MAN1TMPSRC:.text=.1) MAN1DST=$(MAN1TMPSRC:.text=.1)
@ -85,18 +126,6 @@ MANHTML=$(MAN1TMPSRC:.text=.html) $(MAN7TMPSRC:.text=.html)
# User targets # User targets
# #
all:
@echo ''
@echo 'Welcome to cdist!'
@echo ''
@echo 'Here are the possible targets:'
@echo ''
@echo ' man: Build manpages (requires Asciidoc)'
@echo ' manhtml: Build html-manpages (requires Asciidoc)'
@echo ' clean: Remove build stuff'
@echo ''
@echo ''
################################################################################ ################################################################################
# Documentation # Documentation
@ -109,16 +138,11 @@ manhtml: $(MANHTML)
$(MAN1DST) $(MAN7DST) $(MANHTML): $(MANOUTDIRS) $(MAN1DST) $(MAN7DST) $(MANHTML): $(MANOUTDIRS)
# Create output dirs # Create output dirs
$(MAN1DSTDIR) $(MAN7DSTDIR) $(MANHTMLDIR) $(MANTMPDIR): ${MAN1DSTDIR} ${MAN7DSTDIR} $(MANHTMLDIR) $(MANTMPDIR):
mkdir -p $@ mkdir -p $@
# Link source files # Link source files
manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MANOUTDIRS) manlink: ${MAN1SRC} ${MAN7SRC} $(MANTYPE7SRC) $(MANOUTDIRS)
for mansrc in $(MAN1SRC); do ln -sf ../../../$$mansrc $(MAN1DSTDIR); done
for mansrc in $(MAN7SRC); do ln -sf ../../../$$mansrc $(MAN7DSTDIR); done
for mansrc in $(MAN7TYPESRC); do \
dst="$$(echo $$mansrc | sed -e 's;conf/;cdist-;' -e 's;/;;' -e 's;/man;;' -e 's;^;doc/man/man7/;')"; \
ln -sf ../../../$$mansrc $$dst; done
%.1 %.7: %.text manlink %.1 %.7: %.text manlink
$(A2XM) $*.text $(A2XM) $*.text
@ -126,12 +150,12 @@ manlink: $(MAN1SRC) $(MAN7SRC) $(MANTYPE7SRC) $(MANOUTDIRS)
%.html: %.text manlink %.html: %.text manlink
$(A2XH) $< $(A2XH) $<
$(MANDIR)/cdist-reference.text: $(MANDIR)/cdist-reference.text.sh ${MANDIR}/cdist-reference.text: ${MANDIR}/cdist-reference.text.sh
$(MANDIR)/cdist-reference.text.sh ${MANDIR}/cdist-reference.text.sh
clean: clean:
rm -rf $(MANOUTDIRS) rm -rf $(MANOUTDIRS)
rm -f $(MANDIR)/cdist-reference.text rm -f ${MANDIR}/cdist-reference.text
################################################################################ ################################################################################
# Developer targets # Developer targets
@ -144,15 +168,3 @@ test:
.rsync nicosc@free.ethz.ch:cdist .rsync nicosc@free.ethz.ch:cdist
# gentoo # gentoo
.rsync nicosc@ru3.inf.ethz.ch:cdist .rsync nicosc@ru3.inf.ethz.ch:cdist
web: manmove
cp README $(WEBDIR)/$(WEBPAGE)
rm -rf $(WEBDIR)/$(WEBBASE)/man && mkdir $(WEBDIR)/$(WEBBASE)/man
cp -r $(MANHTMLDIR)/* $(WEBDIR)/$(WEBBASE)/man
cd $(WEBDIR) && git add $(WEBBASE)/man
cd $(WEBDIR) && git commit -m "cdist update" $(WEBBASE) $(WEBPAGE)
cd $(WEBDIR) && make pub
pub:
git push --mirror
git push --mirror github