summaryrefslogtreecommitdiffstats
path: root/build.pkg.sh
blob: fd9e06ffd416a931d898997412cf452a2e51f0a1 (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
#!/bin/bash
set -e

PKG=$1
VER=$2
ARCH=$3

if [ "$PKG" = "" ]; then
  echo "PKG not set"
  exit 1
fi


if [ "$VER" = "" ]; then
  VER="unstable"
fi

if [ "$ARCH" != "amd64" ]; then
  ARCH="i386"
fi


rm -rf ../build
mkdir -p ../build
( cd ../build && dpkg-source -I.git '-i^\.git/' -b ../git/${PKG} )

cd ../build
dpkg-source -x *.dsc >/dev/null 2>&1
rm -f *.gz *.dsc

python ../git/scripts/update.changelog.py \
	../build/${PKG}-*/debian/changelog \
	"${VER}"

( cd ${PKG}-*/ && make patch_$VER || true )
dpkg-source -b ${PKG}-*/
DSC=$(ls -1 *.dsc)
BUILD_OPTS="-us -uc"

if [ "$ARCH" = "amd64" ]; then
  # binary only in amd64
  BUILD_OPTS="${BUILD_OPTS} -B"
fi

mkdir -p /var/cache/pbuilder/result/${ARCH}


if [ "$VER" = "max" ]; then
  VER="lucid"
fi

if [ -f "/var/cache/pbuilder/${VER}-${ARCH}.tgz" ]; then
  pbuilder --build --architecture ${ARCH} --debbuildopts "${BUILD_OPTS}" \
           --buildresult /var/cache/pbuilder/result/${ARCH}/ \
           --basetgz "/var/cache/pbuilder/${VER}-${ARCH}.tgz" $DSC 2>&1 | \
	tee -a /var/cache/pbuilder/result/${ARCH}/${DSC}-${VER}-${ARCH}.log
fi