#!/bin/sh -e

VERSION=$(echo $2)
TAR=../libjdom2-java_${VERSION}.orig.tar.xz
DIR=jdom-JDOM-*

tar xvf $3
rm $3
XZ_OPT=--best tar -c -J -f $TAR \
    --exclude '*.jar' \
    --exclude '.gitignore' \
    --exclude 'hamlet.xml' \
    --exclude 'core/samples/catalog.xml' \
    --exclude 'core/samples/catalog.xsl' \
    $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
