#!/bin/sh -e

# $1 = version
TAR=../libjboss-integration-java_$2.orig.tar.gz
DIR=libjboss-integration-java-$2.orig
TAG=$(echo $2 | sed -e 's/~/./')

# clean up the upstream tarball
svn export http://anonsvn.jboss.org/repos/jbossas/projects/integration/tags/$TAG $DIR
GZIP=--best tar -c -z -f $TAR $DIR
rm -rf $DIR
rm ../$TAG

# move to directory 'tarballs'
if [ -r .svn/deb-layout ]; then
  . .svn/deb-layout
  mv $TAR $origDir
  echo "moved $TAR to $origDir"
fi

