#!/bin/sh -e

# called by uscan with '--upstream-version' <version> <file>
DIR=libjfreechart-java-$2.orig

echo "Cleaning up the original tarball"

# clean up the upstream tarball
tar zxf $3
mv jfreechart-$2 $DIR
GZIP=--best tar czf $3 --exclude '*jar' --exclude 'lib/*' $DIR
rm -rf $DIR

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

exit 0
