From d9f488197d7cb3aef0d523542a136aa4ffeeaf92 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 17 Jun 2012 23:49:20 +0000 Subject: [PATCH] Added a script to document the tree --- Makefile | 1 + src/deforaos-document.sh | 72 ++++++++++++++++++++++++++++++++++++++++ src/project.conf | 2 +- 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100755 src/deforaos-document.sh diff --git a/Makefile b/Makefile index 1eed47c..c7ca058 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ dist: @$(TAR) $(PACKAGE)-$(VERSION).tar.gz -- \ $(PACKAGE)-$(VERSION)/src/Makefile \ $(PACKAGE)-$(VERSION)/src/deforaos-build.sh \ + $(PACKAGE)-$(VERSION)/src/deforaos-document.sh \ $(PACKAGE)-$(VERSION)/src/deforaos-update.sh \ $(PACKAGE)-$(VERSION)/src/project.conf \ $(PACKAGE)-$(VERSION)/targets/Makefile \ diff --git a/src/deforaos-document.sh b/src/deforaos-document.sh new file mode 100755 index 0000000..9d3408b --- /dev/null +++ b/src/deforaos-document.sh @@ -0,0 +1,72 @@ +#!/usr/bin/env sh +#$Id$ +#Copyright (c) 2012 Pierre Pronchery +#This file is part of DeforaOS Unix scripts +#TODO: +#- no longer use a temporary folder + + + +#environment +umask 022 +#variables +[ -z "$CVSROOT" ] && CVSROOT=":pserver:anonymous@anoncvs.defora.org:/home/cvs" +#private +DATE=`date '+%Y%m%d'` +DESTDIR="/var/www" +DEVNULL="/dev/null" +EMAIL="webmaster@defora.org" +ROOT=`mktemp -d -p "$HOME/temp" "temp.XXXXXX"` +MODULE="DeforaOS" +SRC="$ROOT/$MODULE" + +#executables +CVS="cvs -q" +FIND="find" +LN="ln -f" +MAIL="mail" +MAKE="make" +MKDIR="mkdir -p" +RM="rm -f" +TAR="tar" +TOUCH="touch" + + +#functions +#deforaos_document +deforaos_document() +{ + #configure cvs if necessary + $MKDIR "$HOME" || exit 2 + if [ ! -f "$HOME/.cvspass" ]; then + $TOUCH "$HOME/.cvspass" || exit 2 + fi + + #checkout tree if necessary + if [ ! -d "$SRC" ]; then + echo "" + echo "Checking out CVS module $MODULE:" + (cd "$ROOT" && $CVS "-d$CVSROOT" co "$MODULE") || exit 2 + fi + + #update tree + echo "" + echo "Updating CVS module $MODULE:" + (cd "$SRC" && $CVS update -dPA) || exit 2 + + #document tree + echo "" + echo "Documenting CVS module $MODULE:" + $FIND "$SRC/System" "$SRC/Apps" -name "doc" | while read path; do + [ -x "$path/gtkdoc.sh" ] || continue + (cd "$path" && $MAKE install DESTDIR="$DESTDIR" PREFIX="/" > "$DEVNULL" 2> "$DEVNULL") + done + + #erase temporary data + $RM -r "$ROOT" +} + + +#main +[ -z "$ROOT" ] && exit 2 +deforaos_document 2>&1 | $MAIL -s "Daily CVS documentation: $DATE" "$EMAIL" diff --git a/src/project.conf b/src/project.conf index dc9bd8c..41c3ba0 100644 --- a/src/project.conf +++ b/src/project.conf @@ -1 +1 @@ -dist=Makefile,deforaos-build.sh,deforaos-update.sh +dist=Makefile,deforaos-build.sh,deforaos-document.sh,deforaos-update.sh