#!/bin/sh -e

# called by uscan with '--upstream-version' <version> <file>
echo $*
DIR=libjibx-java-$2
TAR=../libjibx-java_$2.orig.tar.gz

# clean up the upstream tarball
unzip $3
mv jibx $DIR
GZIP=--best tar czf $TAR -X debian/orig-tar.exclude $DIR
rm -rf $DIR

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

exit 0
