streamline usage of sx-build-release
[invirt/packages/invirt-dev.git] / sx-build-release
1 #!/bin/bash
2 svnuri=`svn info /srv/checkout | sed -n 's/^Repository Root: //p'`
3
4 set -e
5 if  [ $# -ne 1 ] ; then
6         echo " usage: sx-build-release package_name"
7         exit 1
8 fi
9
10 package=$1
11 rm -rf build-release/$package
12 svn export $svnuri/trunk/packages/$package build-release/$package
13 cd build-release/$package
14
15 eval  `perl '-F:\s+' -lane 'print  $F[0]."=".$F[1] if /^Version|^Source|^Distribution/' \
16     <(dpkg-parsechangelog)`
17
18 dpkg-buildpackage -us -uc -rfakeroot
19
20 if ! svn ls $svnuri/package_tags/$Source >/dev/null 2>&1; then
21   svn mkdir $svnuri/package_tags/$Source \
22       -m "Create package tags directory"
23 fi
24 if ! svn ls $svnuri/package_tags/$Source/$Version >/dev/null 2>&1; then
25   svn cp $svnuri/trunk/packages/$package $svnuri/package_tags/$Source/$Version \
26       -m "Tag $Version of $Source"
27 else
28   echo "$(basename $0): tag already exists, not making again"
29 fi
30
31 cd ..
32 reprepro-env include unstable `pwd`/${Source}_*${Version}*.changes
33 reprepro-env include stable   `pwd`/${Source}_*${Version}*.changes
34
35 cd ..
36 rm -rf build-release