Add automatic detection of suite to CI scripts

The detection is based on the variable VERSION_CODENAME from
/etc/os-release, which is supported by systemd. For further details see
https://www.freedesktop.org/software/systemd/man/os-release.html.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
This commit is contained in:
Ralf Habacker 2022-04-04 09:22:54 +02:00
parent 82f1aaeea0
commit a3b20acdd4
3 changed files with 16 additions and 9 deletions

View file

@ -31,7 +31,6 @@ variables:
ci_local_packages: "yes"
ci_parallel: "2"
ci_sudo: "yes"
ci_suite: "bullseye"
###
# IMPORTANT
# These are the version tags for the docker images the CI runs against.
@ -151,8 +150,6 @@ debian buster autotools:
extends: .debian-build
when: manual
image: "debian:buster-slim"
variables:
ci_suite: "buster"
.suse-build:
extends: .unix-host-build

View file

@ -110,9 +110,8 @@ init_wine() {
# ci_suite:
# OS suite (release, branch) in which we are testing.
# Typical values for ci_distro=debian: sid, jessie
# Typical values for ci_distro=fedora might be 25, rawhide
: "${ci_suite:=xenial}"
# Typical values: auto (detect at runtime), ci_distro=debian: bullseye, buster, ci_distro=fedora: 35, rawhide
: "${ci_suite:=auto}"
# ci_test:
# If yes, run tests; if no, just build
@ -138,6 +137,12 @@ if [ "$ci_distro" = "auto" ]; then
echo "detected ci_distro as '${ci_distro}'"
fi
# choose suite
if [ "$ci_suite" = "auto" ]; then
ci_suite=$(. /etc/os-release; if test -v VERSION_CODENAME; then echo ${VERSION_CODENAME}; else echo ${VERSION_ID}; fi)
echo "detected ci_suite as '${ci_suite}'"
fi
if [ -n "$ci_docker" ]; then
exec docker run \
--env=ci_buildsys="${ci_buildsys}" \

View file

@ -54,9 +54,8 @@ NULL=
# ci_suite:
# OS suite (release, branch) in which we are testing.
# Typical values for ci_distro=debian: sid, bullseye
# Typical values for ci_distro=fedora might be 25, rawhide
: "${ci_suite:=bullseye}"
# Typical values: auto (detect at runtime), ci_distro=debian: bullseye, buster, ci_distro=fedora: 35, rawhide
: "${ci_suite:=auto}"
# ci_variant:
# One of debug, reduced, legacy, production
@ -77,6 +76,12 @@ if [ "$ci_distro" = "auto" ]; then
echo "detected ci_distro as '${ci_distro}'"
fi
# choose suite
if [ "$ci_suite" = "auto" ]; then
ci_suite=$(. /etc/os-release; if test -v VERSION_CODENAME; then echo ${VERSION_CODENAME}; else echo ${VERSION_ID}; fi)
echo "detected ci_suite as '${ci_suite}'"
fi
if [ -n "$ci_docker" ]; then
sed \
-e "s/@ci_distro@/${ci_distro}/" \