#!/bin/sh
#
# new-upstream: Copyright © 2010, 2011 by Jan Dittberner <jandd@debian.org>
#
# Called by uscan; from uscan(1):
#
# Finally,  if a third parameter (an action) is given in the watchfile
# line, this is taken as the name of a command, and the command
#  command --upstream-version version filename
# 
# is executed, using either the original file or the symlink name.
#
# Thanks to Vincent Fourmond's <fourmond@debian.org> freecol package - where he
# thanks Sam Morris <sam@robots.org.uk> for giving him the idea - for giving me
# the idea.
#

# If called manually, this file must be called within the xlwt/ directory.

version=$2
filename=`readlink -f $3`
targetdir=`dirname $filename`

dir=`mktemp -d`

curdir=`pwd`

origname="${targetdir}/xlwt_${version}+debian1.orig.tar.gz"

echo "Repacking xlwt version $version from $filename"

# Abort on errors:
set -e

cd "$dir"
tar xzf "$filename"
rm -f xlwt-$version/xlwt/antlr.py
tar czf "$origname" xlwt-$version
echo "Repacked tarball is $origname"
cd -
rm -rf "$dir"
