summaryrefslogtreecommitdiff
path: root/bin/ubuntu-trusty-build.sh
blob: df678456d14044b31df63ab90c9f726ed23add7a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/bin/sh

set -e

if [ -z "$1" ]; then
	echo "Usage: <package> [<architecture>]"
	echo "If architecture is a known Debian architecture, build"
	echo "a binary-only package for this architecture."
	echo "e.g. armhf or arm64"
	exit 1
fi

if [ -n "$2" ]; then
	set +e
	chk=`dpkg-architecture -a$2 > /dev/null 2>&1 ; echo $?`
	set -e
	if [ $chk = 0 ]; then
		echo "Building for architecture $2"
		arch="-a$2 -b"
	else
		echo "Did not recognise $2 as a Debian architecture name. Exit."
		exit 1
	fi
fi
PWD=`pwd`
NAME=${1}
suite=unicorn
schroot=utopic-amd64-sbuild
cd /home/buildd/git/${NAME}
git checkout trusty
git pull
if [ -f ../latest-${NAME}-trusty ]; then
	LATEST=`cat ../latest-${NAME}-trusty`
	NOW=`git log -n1 |grep commit`
	if [ "$LATEST" = "$NOW" ]; then
		echo Latest git commit built was: ${LATEST}
		exit 0
	fi
fi
VERSION="2015.9.post1"
if [ -d './dist/' ]; then
	rm -f ./dist/*
fi
python setup.py sdist 2>&1
DIR=`mktemp -d`
mkdir ${DIR}/${NAME}-${VERSION}
mv -v ./dist/${NAME}-${VERSION}.tar.gz ${DIR}/${NAME}_${VERSION}.orig.tar.gz
cd ../pkg-${NAME}
git pull
git checkout trusty
dpkg-checkbuilddeps
git archive trusty debian | tar -x -C ${DIR}/${NAME}-${VERSION}
cd ${DIR}/${NAME}-${VERSION}
dch --force-distribution -v ${VERSION}-1 -D trusty "Trusty release build" 2>&1
#debuild -sa -uc -us $arch
sbuild -A -s --force-orig-source -c ${schroot} -d trusty
cd ${DIR}
rm -rf ${DIR}/pkg-${NAME}
rm -rf ${DIR}/${NAME}-${VERSION}
reprepro -b /home/buildd/ubuntu include trusty ${DIR}/${NAME}_${VERSION}*.changes
cd /home/buildd/git/${NAME}
git checkout trusty
git log -n1 |grep commit > /home/buildd/git/latest-${NAME}-trusty
git checkout master
rm -rf ${DIR}/
reprepro -b /home/buildd/ubuntu ls ${NAME}