#!/bin/sh -e
# called by uscan with '--upstream-version' <version> <file>

VERSION=$2
TAR=../libjoda-time-java_$VERSION.orig.tar.xz
DIR=joda-time-$VERSION

# clean up the upstream tarball
tar zxvf $3
rm $3
XZ_OPT=--best tar -cJf $TAR --exclude '*.jar' $DIR
rm -rf $DIR

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