[LTP] [PATCH 2/3] ci/debian: Speedup minimal variant installation

Petr Vorel pvorel@suse.cz
Fri Aug 23 13:42:16 CEST 2024


We installed full dependencies and then remove them. Faster and easier
to review is to install only what will not be later removed.
But still attempt to remove (in case something was installed for
whatever reason - this should not happen in containers which are
minimal, but 1) just in case 2) can be used on VM for testing.

Implement this by several lists of packages and usual passing
environment variables.

In the end speedup is ~ 1 min 20 sec, but it's also easier to see what
happen.

Reported-by: Andrea Cervesato <andrea.cervesato@suse.com>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 .github/workflows/ci-docker-build.yml |  2 +-
 ci/debian.minimal.sh                  | 17 +-----
 ci/debian.sh                          | 84 +++++++++++++++++----------
 3 files changed, 55 insertions(+), 48 deletions(-)

diff --git a/.github/workflows/ci-docker-build.yml b/.github/workflows/ci-docker-build.yml
index 322c06efa3..0445a35384 100644
--- a/.github/workflows/ci-docker-build.yml
+++ b/.github/workflows/ci-docker-build.yml
@@ -128,7 +128,7 @@ jobs:
         INSTALL=${{ matrix.container }}
         INSTALL="${INSTALL%%:*}"
         INSTALL="${INSTALL%%/*}"
-        ./ci/$INSTALL.sh
+        ACTION="$VARIANT" ./ci/$INSTALL.sh
         if [ "$VARIANT" ]; then ./ci/$INSTALL.$VARIANT.sh; fi
 
     - name: Compiler version
diff --git a/ci/debian.minimal.sh b/ci/debian.minimal.sh
index 2ccd161c46..1e8dd19af2 100755
--- a/ci/debian.minimal.sh
+++ b/ci/debian.minimal.sh
@@ -2,19 +2,4 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2018-2024 Petr Vorel <pvorel@suse.cz>
 
-apt="apt remove -y"
-
-$apt \
-	asciidoc-base \
-	asciidoctor \
-	libacl1-dev \
-	libaio-dev \
-	libcap-dev \
-	libkeyutils-dev \
-	libnuma-dev \
-	libselinux1-dev \
-	libsepol-dev \
-	libssl-dev
-
-# Missing on Ubuntu 18.04 LTS (Bionic Beaver)
-$apt ruby-asciidoctor-pdf || true
+ACTION="remove-nonessential" $(dirname $0)/debian.sh
diff --git a/ci/debian.sh b/ci/debian.sh
index c413ef457b..68cf1509fc 100755
--- a/ci/debian.sh
+++ b/ci/debian.sh
@@ -11,39 +11,61 @@ apt update
 # workaround for Ubuntu impish asking to interactively configure tzdata
 export DEBIAN_FRONTEND="noninteractive"
 
-apt="apt install -y --no-install-recommends"
-
-$apt \
-	acl-dev \
-	asciidoc-base \
-	asciidoc-dblatex \
-	asciidoctor \
-	autoconf \
-	automake \
-	build-essential \
-	debhelper \
-	devscripts \
-	clang \
-	gcc \
-	git \
-	iproute2 \
-	libacl1-dev \
-	libaio-dev \
-	libcap-dev \
-	libc6-dev \
-	libjson-perl \
-	libkeyutils-dev \
-	libmnl-dev \
-	libnuma-dev \
-	libselinux1-dev \
-	libsepol-dev \
-	libssl-dev \
-	libtirpc-dev \
-	linux-libc-dev \
-	lsb-release \
+install="apt install -y --no-install-recommends"
+remove="apt remove -y"
+
+pkg_minimal="
+	acl-dev
+	autoconf
+	automake
+	build-essential
+	debhelper
+	devscripts
+	clang
+	gcc
+	git
+	iproute2
+	libc6-dev
+	libjson-perl
+	libmnl-dev
+	libtirpc-dev
+	linux-libc-dev
+	lsb-release
 	pkg-config
+"
+
+pkg_nonessential="
+	asciidoc-base
+	asciidoc-dblatex
+	asciidoctor
+	libacl1-dev
+	libaio-dev
+	libcap-dev
+	libkeyutils-dev
+	libnuma-dev
+	libselinux1-dev
+	libsepol-dev
+	libssl-dev
+"
 
 # Missing on Ubuntu 18.04 LTS (Bionic Beaver)
-$apt ruby-asciidoctor-pdf || true
+pkg_maybe_nonessential="ruby-asciidoctor-pdf"
+
+case "$ACTION" in
+	minimal)
+		echo "=== Installing only minimal dependencies ==="
+		$install $pkg_minimal
+		;;
+	remove-nonessential)
+		echo "=== Make sure devel libraries are removed ==="
+		$remove $pkg_nonessential
+		$remove $pkg_maybe_nonessential || true
+		;;
+	*)
+		echo "=== Installing dependencies ==="
+		$install $pkg_minimal $pkg_nonessential
+		$install $pkg_maybe_nonessential || true
+		;;
+esac
 
 df -hT
-- 
2.45.2



More information about the ltp mailing list