some cleanup 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 trunk/packages/package_name"
7         exit 1
8 fi
9
10 if [ -d build-release ] ; then
11     echo "a previous build release directory exists; please clean up"
12     exit 1
13     fi
14
15 package=$1
16 svn export $svnuri/$package build-release/`basename $package`
17 olddir=`pwd`
18 cd build-release/`basename $package`
19
20 eval  `perl '-F:\s+' -lane 'print  $F[0]."=".$F[1] if /^Version|^Source|^Distribution/' \
21     <(dpkg-parsechangelog)`
22
23 dpkg-buildpackage -us -uc -rfakeroot
24
25 if ! svn ls $svnuri/package_tags/$Source >/dev/null 2>&1; then
26   svn mkdir $svnuri/package_tags/$Source \
27       -m "Create package tags directory"
28 fi
29 if ! svn ls $svnuri/package_tags/$Source/$Version >/dev/null 2>&1; then
30   svn cp $svnuri/$package $svnuri/package_tags/$Source/$Version \
31       -m "Tag $Version of $Source"
32 else
33   echo "$(basename $0): tag already exists, not making again"
34 fi
35
36 cd ..
37 reprepro-env include $Distribution  `pwd`/${Source}_*${Version}*.changes
38
39 cd $olddir
40 rm -rf build-release