#!/bin/sh
# script to download and repack source package of bowtie which comes in zip format

PKG=`dpkg-parsechangelog | awk '/^Source/ { print $2 }'`
VERSION=`uscan --verbose --force-download | \
    grep "Newest version on remote site is .* local version is .*" | \
    head -n 1 | \
    sed "s/Newest version on remote site is \([-0-9.]\+\),.*/\1/"`

mkdir -p ../tarballs
cd ../tarballs

UPSTREAMDIR=${PKG}-${VERSION}
unzip ../"${UPSTREAMDIR}-src.zip"

## remove copy of SeqAn library - unfortunately the package does not compile
## with the Debian packaged version 1.2
#rm -rf "${UPSTREAMDIR}"/SeqAn-1.1

GZIP="--best --no-name" tar -czf "$PKG"_"$VERSION".orig.tar.gz "${UPSTREAMDIR}"
rm -rf "${UPSTREAMDIR}"

