#!/bin/sh

set -eu

VERSION=$2
TAR=../libcommons-discovery-java_$VERSION.orig.tar.gz
DIR=commons-discovery-$VERSION
TAG=$(echo "DISCOVERY_$VERSION" | sed -re's,\.,_,g')

svn export http://svn.apache.org/repos/asf/commons/proper/discovery/tags/${TAG}/ $DIR
tar -c -z -f $TAR $DIR
rm -rf $DIR ../$TAG

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