#!/bin/bash
TEMPLATE="sim-svn_template.spec"
SPEC="sim-svn.spec"
export TS=`date +%Y%m%d`
#svn checkout svn://svn.berlios.de/sim-im/trunk sim-0.9.5
svn checkout http://svn.berlios.de/svnroot/repos/sim-im/trunk sim-0.9.5

cd sim-0.9.5
find . -name .svn -exec rm -rf {} \;
make -f admin/Makefile.common
# create new svn tarball
cd ..
echo -n "creating tar.bz2 ball... "
tar cfj sim-0.9.5.tar.bz2 sim-0.9.5
if [ $? == 0 ]; then
	echo "DONE"
else
	echo "FAILED"
fi

# create new svn spec (replace svn date)

cat ${TEMPLATE} | sed -e s/"%SVNDATE%"/"${TS}"/g > ${SPEC}

osc addremove
osc ci sim-0.9.5.tar.bz2 ${SPEC}
