Created
July 9, 2013 17:49
-
-
Save rkleemann/5959534 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install devscripts debhelper | |
SOURCE_DIR=$1 | |
if [ -n "$SOURCE_DIR" ]; then | |
cd ~/sources/$SOURCE_DIR | |
fi | |
if ! grep 'Depends:' debian/control \ | |
| cut -d ':' -f 2- \ | |
| perl -nE ' say for map {s/\s+|[()>]//g; $_} split /,/ ' \ | |
| grep -v '\$' \ | |
| grep -v debhelper \ | |
| xargs sudo apt-get -y install | |
then | |
return | |
fi | |
if ! prove -lr t/ ; then | |
return | |
fi | |
PACKAGE_NAME=$( \ | |
grep 'Package:' debian/control \ | |
| cut -d ':' -f 2 \ | |
| tr -d ' ' \ | |
) | |
VERSION=$( \ | |
grep $PACKAGE_NAME debian/changelog \ | |
| head -n 1 \ | |
| perl -pE 's/[^(]+\(([0-9.-]+)-\d+\)[^)]+/$1/' \ | |
) | |
tar -zcvf ../${PACKAGE_NAME}_${VERSION}.orig.tar.gz \ | |
--exclude=.git \ | |
--exclude='.*.swp' \ | |
. | |
debuild |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment