#!/bin/sh -e

VERSION=$2
TAR=../jing-trang_$VERSION+dfsg+1.orig.tar.xz
DIR=jing-trang-$VERSION
TAG=V"$VERSION"

svn export http://jing-trang.googlecode.com/svn/tags/${TAG} $DIR
XZ_OPT=--best tar cJf $TAR \
       --exclude 'lib/*.txt' \
       --exclude 'lib/*.jar' \
       --exclude 'mod/dtdinst/test' \
       --exclude 'doc/*.mod' \
       --exclude 'doc/gcapaper.rng' \
       --exclude 'gcj/*.patch' \
       --exclude 'gcj/*.tar.gz' \
       --exclude 'gcj/*.copying.txt' \
       $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
