skip Build-Depends scraping if apt-get is new enough

Starting in apt v1.1, `apt-get build-dep` accepts a path to a source package
as an argument, instead of just a package name.
This commit is contained in:
Hans-Christoph Steiner 2018-05-23 14:51:33 +02:00
parent 930b79366a
commit 2a6fe47e38
1 changed files with 3 additions and 1 deletions

View File

@ -15,7 +15,9 @@ if [[ ! -f $lockfile ]] ; then
apt-get -qy dist-upgrade
cd $CI_PROJECT_DIR
if ! apt-get -qy build-dep $CI_PROJECT_DIR; then
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 \