From a88ff58b335bf48c53cc26db6e337a46f2e3f9e2 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Fri, 12 May 2017 09:30:39 +0200 Subject: [PATCH 1/2] tests/lib: abstract build dependency installation a bit more --- tests/lib/distro.sh | 11 +++++++++++ tests/lib/prepare-project.sh | 23 +++++++++++++++-------- 2 files changed, 26 insertions(+), 8 deletions(-) create mode 100644 tests/lib/distro.sh diff --git a/tests/lib/distro.sh b/tests/lib/distro.sh new file mode 100644 index 00000000000..41d52063e78 --- /dev/null +++ b/tests/lib/distro.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +DISTRO_BUILD_DEPS="" + +case "$SPREAD_SYSTEM" in + debian-*|ubuntu-*) + DISTRO_BUILD_DEPS="build-essential curl devscripts expect gdebi-core jq rng-tools git netcat-openbsd" + ;; + *) + ;; +esac diff --git a/tests/lib/prepare-project.sh b/tests/lib/prepare-project.sh index bb6db78ae26..6797b44c8a3 100644 --- a/tests/lib/prepare-project.sh +++ b/tests/lib/prepare-project.sh @@ -121,14 +121,21 @@ if [[ "$SPREAD_SYSTEM" == ubuntu-14.04-* ]]; then quiet apt-get install -y --force-yes apparmor libapparmor1 seccomp libseccomp2 systemd cgroup-lite util-linux fi -distro_purge_package snapd -# utilities -# XXX: build-essential seems to be required. Otherwise package build -# fails with unmet dependency on "build-essential:native" -distro_install_package build-essential curl devscripts expect gdebi-core jq rng-tools git netcat-openbsd - -# in 16.04: apt build-dep -y ./ -quiet apt-get install -y $(gdebi --quiet --apt-line ./debian/control) +. "$TESTSLIB/distro.sh" + +distro_purge_package snapd || true +distro_install_package $DISTRO_BUILD_DEPS + +# We take a special case for Debian/Ubuntu where we install additional build deps +# base on the packaging. In Fedora/Suse this is handled via mock/osc +case "$SPREAD_SYSTEM" in + debian-*|ubuntu-*) + # in 16.04: apt build-dep -y ./ + quiet apt-get install -y $(gdebi --quiet --apt-line ./debian/control) + ;; + *) + ;; +esac # update vendoring if [ "$(which govendor)" = "" ]; then From e55eb41aebc18aa068e1631fe526b741775e4444 Mon Sep 17 00:00:00 2001 From: Simon Fels Date: Mon, 22 May 2017 09:28:10 +0200 Subject: [PATCH 2/2] tests/lib: merge distro.sh into pkgdb.sh --- tests/lib/distro.sh | 11 ----------- tests/lib/pkgdb.sh | 11 +++++++++++ tests/lib/prepare-project.sh | 2 -- 3 files changed, 11 insertions(+), 13 deletions(-) delete mode 100644 tests/lib/distro.sh diff --git a/tests/lib/distro.sh b/tests/lib/distro.sh deleted file mode 100644 index 41d52063e78..00000000000 --- a/tests/lib/distro.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh - -DISTRO_BUILD_DEPS="" - -case "$SPREAD_SYSTEM" in - debian-*|ubuntu-*) - DISTRO_BUILD_DEPS="build-essential curl devscripts expect gdebi-core jq rng-tools git netcat-openbsd" - ;; - *) - ;; -esac diff --git a/tests/lib/pkgdb.sh b/tests/lib/pkgdb.sh index c3499519d05..0b3b930d658 100644 --- a/tests/lib/pkgdb.sh +++ b/tests/lib/pkgdb.sh @@ -120,3 +120,14 @@ distro_clean_package_cache() { ;; esac } + +# Specify necessary packages which need to be installed on a +# system to provide a basic build environment for snapd. +DISTRO_BUILD_DEPS="" +case "$SPREAD_SYSTEM" in + debian-*|ubuntu-*) + DISTRO_BUILD_DEPS="build-essential curl devscripts expect gdebi-core jq rng-tools git netcat-openbsd" + ;; + *) + ;; +esac diff --git a/tests/lib/prepare-project.sh b/tests/lib/prepare-project.sh index b67866bff70..687cbc91ccb 100644 --- a/tests/lib/prepare-project.sh +++ b/tests/lib/prepare-project.sh @@ -122,8 +122,6 @@ if [[ "$SPREAD_SYSTEM" == ubuntu-14.04-* ]]; then quiet apt-get install -y --force-yes apparmor libapparmor1 seccomp libseccomp2 systemd cgroup-lite util-linux fi -. "$TESTSLIB/distro.sh" - distro_purge_package snapd || true distro_install_package $DISTRO_BUILD_DEPS