Brenden Blanco | c234344 | 2015-09-02 10:26:59 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
Brenden Blanco | 9134c56 | 2016-02-22 17:25:21 -0800 | [diff] [blame] | 3 | # helper script to be invoked by jenkins/buildbot |
| 4 | |
| 5 | # $1 [optional]: the build type - release | nightly | test |
| 6 | buildtype=${1:-test} |
| 7 | |
Brenden Blanco | c234344 | 2015-09-02 10:26:59 -0700 | [diff] [blame] | 8 | set -x |
| 9 | set -e |
| 10 | |
| 11 | PARALLEL=${PARALLEL:-1} |
| 12 | TMP=$(mktemp -d /tmp/debuild.XXXXXX) |
| 13 | |
| 14 | function cleanup() { |
| 15 | [[ -d $TMP ]] && rm -rf $TMP |
| 16 | } |
| 17 | trap cleanup EXIT |
| 18 | |
Brenden Blanco | 9134c56 | 2016-02-22 17:25:21 -0800 | [diff] [blame] | 19 | . scripts/git-tag.sh |
Brenden Blanco | 8838fba | 2016-02-22 10:29:36 -0800 | [diff] [blame] | 20 | |
| 21 | git archive HEAD --prefix=bcc/ --format=tar.gz -o $TMP/bcc_$revision.orig.tar.gz |
| 22 | |
Brenden Blanco | c234344 | 2015-09-02 10:26:59 -0700 | [diff] [blame] | 23 | pushd $TMP |
Brenden Blanco | 8838fba | 2016-02-22 10:29:36 -0800 | [diff] [blame] | 24 | tar xf bcc_$revision.orig.tar.gz |
Brenden Blanco | c234344 | 2015-09-02 10:26:59 -0700 | [diff] [blame] | 25 | cd bcc |
Brenden Blanco | 9134c56 | 2016-02-22 17:25:21 -0800 | [diff] [blame] | 26 | |
Brenden Blanco | 7a46276 | 2017-02-09 14:58:33 -0800 | [diff] [blame] | 27 | debuild=debuild |
Brenden Blanco | 9134c56 | 2016-02-22 17:25:21 -0800 | [diff] [blame] | 28 | if [[ "$buildtype" = "test" ]]; then |
Brenden Blanco | 7a46276 | 2017-02-09 14:58:33 -0800 | [diff] [blame] | 29 | # 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 Blanco | 9134c56 | 2016-02-22 17:25:21 -0800 | [diff] [blame] | 34 | dch -b -v $revision-$release "$git_subject" |
| 35 | fi |
| 36 | if [[ "$buildtype" = "nightly" ]]; then |
| 37 | dch -v $revision-$release "$git_subject" |
| 38 | fi |
| 39 | |
Brenden Blanco | 7a46276 | 2017-02-09 14:58:33 -0800 | [diff] [blame] | 40 | DEB_BUILD_OPTIONS="nocheck parallel=${PARALLEL}" $debuild -us -uc |
Brenden Blanco | c234344 | 2015-09-02 10:26:59 -0700 | [diff] [blame] | 41 | popd |
| 42 | |
| 43 | cp $TMP/*.deb . |