1#!/bin/bash 2 3# helper script to be invoked by jenkins/buildbot or github actions 4 5# $1 [optional]: the build type - release | nightly | test 6buildtype=${1:-test} 7 8set -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 19# populate submodules 20git submodule update --init --recursive 21 22. scripts/git-tag.sh 23 24git archive HEAD --prefix=bcc/ --format=tar -o $TMP/bcc_$revision.orig.tar 25 26# archive submodules 27pushd src/cc/libbpf 28git archive HEAD --prefix=bcc/src/cc/libbpf/ --format=tar -o $TMP/bcc_libbpf_$revision.orig.tar 29popd 30 31pushd $TMP 32 33# merge all archives into bcc_$revision.orig.tar.gz 34tar -A -f bcc_$revision.orig.tar bcc_libbpf_$revision.orig.tar 35gzip bcc_$revision.orig.tar 36 37tar xf bcc_$revision.orig.tar.gz 38cd bcc 39 40debuild=debuild 41if [[ "$buildtype" = "test" ]]; then 42 # when testing, use faster compression options 43 debuild+=" --preserve-envvar PATH" 44 echo -e '#!/bin/bash\nexec /usr/bin/dpkg-deb -z1 "$@"' \ 45 | sudo tee /usr/local/bin/dpkg-deb 46 sudo chmod +x /usr/local/bin/dpkg-deb 47 dch -b -v $revision-$release "$git_subject" 48fi 49if [[ "$buildtype" = "nightly" ]]; then 50 dch -v $revision-$release "$git_subject" 51fi 52 53DEB_BUILD_OPTIONS="nocheck parallel=${PARALLEL}" $debuild -us -uc 54popd 55 56cp $TMP/*.deb . 57