#!/bin/bash if [ "$CI_COMMIT_REF_NAME" == "upstream" ] || [ "$CI_COMMIT_REF_NAME" == "pristine-tar" ]; then echo No builds run on the $CI_COMMIT_REF_NAME branch, exiting exit 0 fi # https://gitlab.com/gitlab-org/gitlab-runner/issues/1380#note_48552305 lockfile=/.lock if [[ ! -f $lockfile ]] ; then set -e set -x if [ ! -z "$DEBIAN_RELEASE" ]; then sed -i "s, testing , $DEBIAN_RELEASE ," /etc/apt/sources.list fi apt-get -qy update apt-get -qy dist-upgrade cd $CI_PROJECT_DIR if dpkg --compare-versions `dpkg -s apt |sed -n 's,^Version: \(.*\),\1,p'` ge 1.1; then apt-get -qy build-dep $CI_PROJECT_DIR else # this is running on an older version, like jessie-backports export BUILD_DEPENDS=`sed 's/\s*|[^,]*,/,/g' debian/control | perl -ne 'next if /^#/; $p=(s/^Build-Depends:\s*/ / or (/^ / and $p)); s/,|\n|\([^)]+\)//mg; print if $p'` apt-get -qy install --no-install-recommends \ build-essential fakeroot git-buildpackage pristine-tar $BUILD_DEPENDS fi apt-get -qy autoremove --purge dpkg-checkbuilddeps echo "ensure pristine-tar branch exists and is current" git clean -fdx git reset --hard git fetch --all git checkout -B pristine-tar origin/pristine-tar echo "make $CI_COMMIT_REF_NAME branch current for gbp" git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA" if [ -z "$CI_COMMIT_TAG" ]; then gbp buildpackage -uc -us --git-debian-branch="$CI_COMMIT_REF_NAME" else gbp buildpackage -uc -us fi echo "performing general and experimental lintian checks" su --shell /bin/sh nobody --command "lintian --color always -EviIL +pedantic ../*.changes" || true echo "performing ftp-master-rejects lintian checks" su --shell /bin/sh nobody --command "lintian --color always -viF ../*.changes" if [ -e debian/tests/control ]; then autopkgtest ../*.changes -- null fi fi [[ $CI ]] && touch $lockfile exec "$@"