blob: 97bed85eb39974870de9ab369e5acccf1fd04a1a [file] [log] [blame]
Brenden Blancoc2343442015-09-02 10:26:59 -07001#!/bin/bash
2
Brenden Blanco9134c562016-02-22 17:25:21 -08003# helper script to be invoked by jenkins/buildbot
4
5# $1 [optional]: the build type - release | nightly | test
6buildtype=${1:-test}
7
Brenden Blancoc2343442015-09-02 10:26:59 -07008set -x
9set -e
10
11PARALLEL=${PARALLEL:-1}
12TMP=$(mktemp -d /tmp/debuild.XXXXXX)
13
14function cleanup() {
15 [[ -d $TMP ]] && rm -rf $TMP
16}
17trap cleanup EXIT
18
Brenden Blanco9134c562016-02-22 17:25:21 -080019. scripts/git-tag.sh
Brenden Blanco8838fba2016-02-22 10:29:36 -080020
21git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/bcc_$revision.orig.tar.gz
22
Brenden Blancoc2343442015-09-02 10:26:59 -070023pushd $TMP
Brenden Blanco8838fba2016-02-22 10:29:36 -080024tar xf bcc_$revision.orig.tar.gz
Brenden Blancoc2343442015-09-02 10:26:59 -070025cd bcc
Brenden Blanco9134c562016-02-22 17:25:21 -080026
Brenden Blanco7a462762017-02-09 14:58:33 -080027debuild=debuild
Brenden Blanco9134c562016-02-22 17:25:21 -080028if [[ "$buildtype" = "test" ]]; then
Brenden Blanco7a462762017-02-09 14:58:33 -080029 # when testing, use faster compression options
30 debuild+=" --preserve-envvar PATH"
31 echo -e '#!/bin/bash\nexec /usr/bin/dpkg-deb -z1 "$@"' \
32 | sudo tee /usr/local/bin/dpkg-deb
33 sudo chmod +x /usr/local/bin/dpkg-deb
Brenden Blanco9134c562016-02-22 17:25:21 -080034 dch -b -v $revision-$release "$git_subject"
35fi
36if [[ "$buildtype" = "nightly" ]]; then
37 dch -v $revision-$release "$git_subject"
38fi
39
Brenden Blanco7a462762017-02-09 14:58:33 -080040DEB_BUILD_OPTIONS="nocheck parallel=${PARALLEL}" $debuild -us -uc
Brenden Blancoc2343442015-09-02 10:26:59 -070041popd
42
43cp $TMP/*.deb .