[ci] Enable IRC notifications from travis
[xapian.git] / xapian-maintainer-tools / debian / make-source-packages
blob26a16dd7be959b3308198cb979526dedeec54261
1 #!/bin/sh
2 # Make Debian source packages from a Xapian source tree.
4 # Copyright (C) 2004 Richard Boulton
5 # Copyright (C) 2006,2007,2008,2009 Olly Betts
7 # This program is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of the
10 # License, or (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
20 # USA
22 set -e
24 if [ x"$1" = x--help ] ; then
25 echo "Usage: $0 [xapian-core] [xapian-bindings] [xapian-omega]"
26 echo
27 echo 'Make Debian source packages.'
28 exit 0
31 trap "echo \"make-source-packages failed\"" EXIT
33 # Where to get debian directories from.
34 BRANCH=trunk
35 #BRANCH=branches/1.0
37 # Options to pass to dpkg-buildpackage when building source packages
38 BUILDPACKAGE_SRC_OPTS="--no-lintian -us -uc -d -S"
40 # Location to download tarballs from
41 DOWNLOAD_BASE="http://oligarchy.co.uk/xapian/"
43 # Location to checkout debian packaging from.
44 SVNROOT="svn+ssh+userv://xapian-svn@svn.xapian.org/xapian/"
45 # Detect if we're on the machine that Xapian SVN is held on, and don't use
46 # network to check out sources if so.
47 if [ "x`hostname`" = "xatreus" ] && [ -r '/home/xapian-svn' ] ; then
48 SVNROOT="svn+xapian:///xapian/"
51 SVNBASE=$SVNROOT/$BRANCH
53 # Unpack distribution tarballs, and put the debian control files into place,
54 # and build source packages
55 make_source_package() {
56 pkg=$1
57 # Calculate SVN tag to use to check out Debian control files
58 debtag=debian-`svn cat "$SVNBASE"/$2/debian/changelog|dpkg-parsechangelog -l-|sed 's/^Version: //p;d'`
59 url=${DOWNLOAD_BASE}${VERSION}/$pkg-${VERSION}.tar.gz
60 tarball=${pkg}_${VERSION}.orig.tar.gz
61 # wget exits with status 1 if -nc was passed the file already exists.
62 wget -q -nc -O "$tarball" "$url" || test $? = 1 -a -f "$tarball" || exit $?
63 tar zxf "$tarball"
64 cd "${pkg}-${VERSION}"
65 # Checkout debian control files from SVN.
66 svn export -q "${SVNROOT}/tags/${debtag}/$pkg" debian
67 # Generate any generated control files.
68 debian/rules maint
69 debuild ${BUILDPACKAGE_SRC_OPTS}
70 cd ..
73 # Get the version number from xapian-core's configure.ac the current tree.
74 VERSION=`svn cat "$SVNBASE"/xapian-core/configure.ac | grep AC_INIT | head -n 1 | sed 's/^.*AC_INIT( *\[\?xapian-core\]\?, *\[\?\([0-9][0-9]*\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\)[^0-9].*$/\1.\2.\3/g'`
76 # Make build directory if it doesn't exist already.
77 mkdir -p build
79 # Clean out any files except downloaded original tarballs.
80 for f in build/* ; do
81 case $f in
82 *.orig.tar.gz) ;;
83 build/\*) ;;
84 *) rm -rf "$f" ;;
85 esac
86 done
88 ls -l build
90 cd build
91 for module in ${*:-xapian-core xapian-bindings xapian-omega} ; do
92 case $module in
93 xapian-omega) modulepath=xapian-applications/omega ;;
94 *) modulepath=$module ;;
95 esac
97 # Make source package
98 make_source_package "$module" "$modulepath"
99 done
100 cd ..
102 echo "Successfully built Debian source packages."
104 trap - EXIT