mirror of
https://gitlab.freedesktop.org/dbus/dbus.git
synced 2026-01-06 13:00:20 +01:00
Add automatic detection of distribution to CI scripts
The detection is based on the variable ID 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:
parent
7060b64287
commit
82f1aaeea0
3 changed files with 22 additions and 12 deletions
|
|
@ -31,7 +31,6 @@ variables:
|
|||
ci_local_packages: "yes"
|
||||
ci_parallel: "2"
|
||||
ci_sudo: "yes"
|
||||
ci_distro: "debian"
|
||||
ci_suite: "bullseye"
|
||||
###
|
||||
# IMPORTANT
|
||||
|
|
@ -158,8 +157,6 @@ debian buster autotools:
|
|||
.suse-build:
|
||||
extends: .unix-host-build
|
||||
image: "opensuse/leap:15"
|
||||
variables:
|
||||
ci_distro: "opensuse"
|
||||
|
||||
opensuse cmake:
|
||||
extends: .suse-build
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ init_wine() {
|
|||
|
||||
# ci_distro:
|
||||
# OS distribution in which we are testing
|
||||
# Typical values: ubuntu, debian; maybe fedora in future
|
||||
: "${ci_distro:=ubuntu}"
|
||||
# Typical values: auto (detect at runtime), ubuntu, debian; maybe fedora in future
|
||||
: "${ci_distro:=auto}"
|
||||
|
||||
# ci_docker:
|
||||
# If non-empty, this is the name of a Docker image. ci-install.sh will
|
||||
|
|
@ -132,6 +132,12 @@ init_wine() {
|
|||
|
||||
echo "ci_buildsys=$ci_buildsys ci_distro=$ci_distro ci_docker=$ci_docker ci_host=$ci_host ci_local_packages=$ci_local_packages ci_parallel=$ci_parallel ci_suite=$ci_suite ci_test=$ci_test ci_test_fatal=$ci_test_fatal ci_variant=$ci_variant ci_runtime=$ci_runtime $0"
|
||||
|
||||
# choose distribution
|
||||
if [ "$ci_distro" = "auto" ]; then
|
||||
ci_distro=$(. /etc/os-release; echo ${ID} | sed 's, ,_,g')
|
||||
echo "detected ci_distro as '${ci_distro}'"
|
||||
fi
|
||||
|
||||
if [ -n "$ci_docker" ]; then
|
||||
exec docker run \
|
||||
--env=ci_buildsys="${ci_buildsys}" \
|
||||
|
|
@ -366,7 +372,7 @@ case "$ci_buildsys" in
|
|||
# enable tests if supported
|
||||
if [ "$ci_test" = yes ]; then
|
||||
# choose correct wine architecture
|
||||
if [ "${ci_distro}" = opensuse ]; then
|
||||
if [ "${ci_distro%%-*}" = opensuse ]; then
|
||||
if [ "${ci_host%%-*}" = x86_64 ]; then
|
||||
export WINEARCH=win64
|
||||
cmake=mingw64-cmake
|
||||
|
|
|
|||
|
|
@ -29,8 +29,8 @@ NULL=
|
|||
|
||||
# ci_distro:
|
||||
# OS distribution in which we are testing
|
||||
# Typical values: ubuntu, debian; maybe fedora in future
|
||||
: "${ci_distro:=ubuntu}"
|
||||
# Typical values: auto, ubuntu, debian, ; maybe fedora in future
|
||||
: "${ci_distro:=auto}"
|
||||
|
||||
# ci_docker:
|
||||
# If non-empty, this is the name of a Docker image. ci-install.sh will
|
||||
|
|
@ -70,6 +70,13 @@ else
|
|||
sudo=sudo
|
||||
fi
|
||||
|
||||
|
||||
# choose distribution
|
||||
if [ "$ci_distro" = "auto" ]; then
|
||||
ci_distro=$(. /etc/os-release; echo ${ID} | sed 's, ,_,g')
|
||||
echo "detected ci_distro as '${ci_distro}'"
|
||||
fi
|
||||
|
||||
if [ -n "$ci_docker" ]; then
|
||||
sed \
|
||||
-e "s/@ci_distro@/${ci_distro}/" \
|
||||
|
|
@ -80,7 +87,7 @@ if [ -n "$ci_docker" ]; then
|
|||
fi
|
||||
|
||||
case "$ci_distro" in
|
||||
(debian|ubuntu)
|
||||
(debian*|ubuntu*)
|
||||
# Don't ask questions, just do it
|
||||
sudo="$sudo env DEBIAN_FRONTEND=noninteractive"
|
||||
|
||||
|
|
@ -178,7 +185,7 @@ case "$ci_distro" in
|
|||
fi
|
||||
;;
|
||||
|
||||
(opensuse)
|
||||
(opensuse*)
|
||||
zypper="/usr/bin/zypper --non-interactive"
|
||||
# system
|
||||
packages=(
|
||||
|
|
@ -286,7 +293,7 @@ esac
|
|||
# manual package setup
|
||||
#
|
||||
case "$ci_distro" in
|
||||
(debian|ubuntu)
|
||||
(debian*|ubuntu*)
|
||||
|
||||
# Make sure we have a messagebus user, even if the dbus package
|
||||
# isn't installed
|
||||
|
|
@ -294,7 +301,7 @@ case "$ci_distro" in
|
|||
--disabled-password --group messagebus
|
||||
;;
|
||||
|
||||
(opensuse)
|
||||
(opensuse*)
|
||||
# test-bus depends on group 'bin'
|
||||
$sudo getent group bin >/dev/null || /usr/sbin/groupadd -r bin
|
||||
;;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue