baseline
[omp.pkp.sfu.ca.git] / tools / buildpkg.sh
blob82f9ca130f3c3dde741bd5e214d995a4c9d7f535
1 #!/bin/bash
4 # buildpkg.sh
6 # Copyright (c) 2003-2008 John Willinsky
7 # Distributed under the GNU GPL v2. For full terms see the file docs/COPYING.
9 # Script to create an OMP package for distribution.
11 # Usage: buildpkg.sh <version> [<tag>]
13 # $Id: buildpkg.sh,v 1.3 2009/06/09 23:37:16 tylerl Exp $
16 CVSROOT=:pserver:anonymous@pkp.sfu.ca:/cvs
17 MODULE=omp
19 if [ -z "$1" ]; then
20 echo "Usage: $0 <version> [<tag>] [<patch_dir>]";
21 exit 1;
24 VERSION=$1
25 TAG=${2-HEAD}
26 PATCHDIR=${3-}
27 PREFIX=omp
28 BUILD=$PREFIX-$VERSION
29 TMPDIR=`mktemp -d $PREFIX.XXXXXX` || exit 1
31 EXCLUDE="dbscripts/xml/data/locale/en_US/sample.xml \
32 dbscripts/xml/data/locale/te_ST \
33 dbscripts/xml/data/sample.xml \
34 docs/dev \
35 docs/doxygen \
36 lib/adodb/CHANGED_FILES \
37 lib/adodb/diff \
38 lib/smarty/CHANGED_FILES \
39 lib/smarty/diff \
40 locale/te_ST \
41 cache/*.php \
42 tools/buildpkg.sh \
43 tools/cvs2cl.pl \
44 tools/genLocaleReport.sh \
45 tools/genTestLocale.php \
46 tools/test"
49 cd $TMPDIR
51 echo -n "Exporting $MODULE with tag $TAG ... "
52 cvs -Q -d $CVSROOT export -r $TAG -d $BUILD $MODULE || exit 1
53 echo "Done"
55 cd $BUILD
57 echo -n "Preparing package ... "
58 cp config.TEMPLATE.inc.php config.inc.php
59 find . -name .cvsignore -exec rm {} \;
60 rm -r $EXCLUDE
61 echo "Done"
63 cd ..
65 echo -n "Creating archive $BUILD.tar.gz ... "
66 tar -zcf ../$BUILD.tar.gz $BUILD
67 echo "Done"
69 if [ ! -z "$PATCHDIR" ]; then
70 echo "Creating patches in $BUILD.patch ..."
71 [ -e "../${BUILD}.patch" ] || mkdir "../$BUILD.patch"
72 for FILE in $PATCHDIR/*; do
73 OLDBUILD=$(basename $FILE)
74 OLDVERSION=${OLDBUILD/$PREFIX-/}
75 OLDVERSION=${OLDVERSION/.tar.gz/}
76 echo -n "Creating patch against ${OLDVERSION} ... "
77 tar -zxf $FILE
78 diff -urN $PREFIX-$OLDVERSION $BUILD | gzip -c > ../${BUILD}.patch/$PREFIX-${OLDVERSION}_to_${VERSION}.patch.gz
79 echo "Done"
80 done
81 echo "Done"
84 cd ..
86 echo -n "Building doxygen documentation... "
87 doxygen docs/dev/omp.doxygen > /dev/null && cd docs/doxygen && tar czf ../../${BUILD}-doxygen.tar.gz html latex && cd ../..
89 echo "Done"
91 rm -r $TMPDIR