File svn2obs of Package rear-snapshot

#!/bin/bash
#
# update OBS from SVN

SVN=https://rear.svn.sourceforge.net/svnroot/rear/trunk

# read revision
IFS=": " read junk REV < <(svn info https://rear.svn.sourceforge.net/svnroot/rear/trunk | grep ^Revision)

# read OSB 
IFS=":. " read j1 j2 j3 OBSREV < <(osc cat home:sschapiro rear-snapshot rear-snapshot.spec | grep Version)

if test "$REV" = "$OBSREV" ; then
	echo "ReaR revision in SVN and OBS match already ($REV)"
else
	echo "SVN revision is $REV, OBS revision is $OBSREV, building in OBS"
	BUILD_DIR=/tmp/rear.$$
	trap "rm -rf $BUILD_DIR" 0
	mkdir -p $BUILD_DIR/obs

	cd $BUILD_DIR

	svn export -r $REV -q "$SVN" svn
	osc co -c home:sschapiro rear-snapshot
	osc del rear-snapshot/*.tar.gz
	prod_name=rear-snapshot VERSION=0.0.$REV DESTDIR=rear-snapshot svn/usr/share/rear/contrib/svn2tar
	osc add rear-snapshot/*.tar.gz
	sed -i -e "/^Version:/s/^Version.*$/Version: 0.0.$REV/" rear-snapshot/rear-snapshot.dsc rear-snapshot/rear-snapshot.spec rear-snapshot/debian.control
	sed -i -e "/rear-snapshot/s/0.0.[0-9]*/0.0.$REV/g" rear-snapshot/debian.changelog
	osc ci -m "SVN -> OBS rev $REV" rear-snapshot
fi
openSUSE Build Service is sponsored by