#!/bin/bash
set -e
pkgname=$1
if [ -z $pkgname ]; then
echo "Usage: $0 <srcpkgname> [<distro> [<dest>]]"
exit 1
fi
distro=${2:-sid}
dest=${3:-${pkgname}.${distro}}
here=`pwd`
echo "getting $pkgname for $distro"
echo "updating chdist"
chdist apt-get $distro update -qq
where=`mktemp -d`
function cleanup {
echo "cleaning $where"
rm -rf $where
}
trap cleanup EXIT
echo "putting source in $where"
cd $where
chdist apt-get $distro source -qq $pkgname
cd $here
echo "git import to directory $dest"
git init $dest
cd $dest
gbp import-dsc $where/*.dsc