]> git.ipfire.org Git - thirdparty/dbus.git/commitdiff
On CI add build support for openSUSE distributions
authorRalf Habacker <ralf.habacker@freenet.de>
Tue, 1 Mar 2022 12:25:01 +0000 (13:25 +0100)
committerRalf Habacker <ralf.habacker@freenet.de>
Tue, 29 Mar 2022 12:47:59 +0000 (12:47 +0000)
The mingw related jobs are running the whole test suite which
is an extension to the available jobs.

The environment variable ci_suite is not used on openSUSE
distributions, as it is determined from the installed image.

Signed-off-by: Ralf Habacker <ralf.habacker@freenet.de>
.gitlab-ci.yml
tools/ci-build.sh
tools/ci-install.sh

index 4e8b7b5f1e750cab4d5dbe7fb0c6aadd4f6aec05..d38e63cc1be2e6d4412e092947e9469b7d647c45 100644 (file)
@@ -70,9 +70,8 @@ windows amd64 docker:
         Exit 1
       }
 
-.debian-build:
+.unix-host-build:
   stage: build
-  image: "debian:bullseye-slim"
   cache:
     key: ${CI_JOB_NAME}
     paths:
@@ -89,6 +88,10 @@ windows amd64 docker:
     - chown -R user .
     - runuser -u user ./tools/ci-build.sh
 
+.debian-build:
+  extends: .unix-host-build
+  image: "debian:bullseye-slim"
+
 debian autotools production:
   extends: .debian-build
   variables:
@@ -148,6 +151,34 @@ debian buster autotools:
   variables:
     ci_suite: "buster"
 
+.suse-build:
+  extends: .unix-host-build
+  image: "opensuse/leap:15"
+  variables:
+    ci_distro: "opensuse"
+
+opensuse cmake:
+  extends: .suse-build
+  variables:
+    ci_buildsys: "cmake"
+    ci_local_packages: "no"
+
+opensuse mingw32 cmake:
+  extends: .suse-build
+  when: manual
+  variables:
+    ci_buildsys: "cmake"
+    ci_host: "i686-w64-mingw32"
+    ci_local_packages: "no"
+
+opensuse mingw64 cmake debug:
+  extends: .suse-build
+  variables:
+    ci_buildsys: "cmake"
+    ci_host: "x86_64-w64-mingw32"
+    ci_local_packages: "no"
+    ci_variant: "debug"
+
 .win-build:
   image: $WINDOWS_IMAGE
   stage: build
index f3c194151bc7c27fe36424993cf37381fe8be3f5..d6951cb8131474a6dc846b8e86a6aaa7d8f4df7c 100755 (executable)
@@ -358,12 +358,22 @@ case "$ci_buildsys" in
 
     (cmake|cmake-dist)
         cmdwrapper=
+        cmake=cmake
         case "$ci_host" in
             (*-w64-mingw32)
                 # CFLAGS and CXXFLAGS does do work, checked with cmake 3.15
                 export LDFLAGS="-${ci_runtime}-libgcc"
                 # enable tests if supported
                 if [ "$ci_test" = yes ]; then
+                    # choose correct wine architecture
+                    if [ "${ci_distro}" = opensuse ]; then
+                        if [ "${ci_host%%-*}" = x86_64 ]; then
+                            export WINEARCH=win64
+                            cmake=mingw64-cmake
+                        else
+                            cmake=mingw32-cmake
+                        fi
+                    fi
                     libgcc_path=
                     if [ "$ci_runtime" = "shared" ]; then
                         libgcc_path=$(dirname "$("${ci_host}-gcc" -print-libgcc-file-name)")
@@ -372,7 +382,9 @@ case "$ci_buildsys" in
                     cmdwrapper="xvfb-run -a"
                 fi
                 set _ "$@"
-                set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake"
+                if [ "$ci_distro" != "opensuse" ]; then
+                    set "$@" -D CMAKE_TOOLCHAIN_FILE="${srcdir}/cmake/${ci_host}.cmake"
+                fi
                 set "$@" -D CMAKE_PREFIX_PATH="${dep_prefix}"
                 if [ "$ci_local_packages" = yes ]; then
                     set "$@" -D CMAKE_INCLUDE_PATH="${dep_prefix}/include"
@@ -389,7 +401,7 @@ case "$ci_buildsys" in
                 ;;
         esac
 
-        cmake "$@" -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON ..
+        $cmake "$@" -DCMAKE_VERBOSE_MAKEFILE=ON -DENABLE_WERROR=ON ..
 
         ${make}
         # The test coverage for OOM-safety is too verbose to be useful on
index bc1f72e45f235c0d3104cd6a24137ff1a0516222..a331f931dbfa1a20f283c785043fc840bc622348 100755 (executable)
@@ -176,6 +176,117 @@ case "$ci_distro" in
             echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd
             chmod 0440 /etc/sudoers.d/nopasswd
         fi
+        ;;
+
+    (opensuse)
+        zypper="/usr/bin/zypper --non-interactive"
+        # system
+        packages=(
+            sudo
+        )
+
+        # build system
+        packages=(
+            "${packages[@]}"
+            autoconf
+            autoconf-archive
+            automake
+            cmake
+            libtool
+        )
+
+        # docs
+        packages=(
+            "${packages[@]}"
+            docbook_4
+            docbook-xsl-stylesheets
+            doxygen
+            libqt5-qttools
+            libxslt-tools
+            yelp-tools
+        )
+
+        # dbus (autogen.sh)
+        packages=(
+            "${packages[@]}"
+            which
+        )
+
+        case "$ci_host" in
+            (*-w64-mingw32)
+                # cross
+                packages=(
+                    "${packages[@]}"
+                    wine
+                    xvfb-run
+                )
+
+                # choose distribution
+                id=$(. /etc/os-release; echo ${ID} | sed 's, ,_,g')
+                case "$id" in
+                    (opensuse-leap)
+                        version=$(. /etc/os-release; echo ${VERSION_ID} | sed 's, ,_,g')
+                        repo="openSUSE_Leap_$version"
+                        ;;
+                    (opensuse-tumbleweed)
+                        repo="openSUSE_Tumbleweed"
+                        ;;
+                    (*)
+                        echo "ci_suite not specified, please choose one from 'leap' or 'tumbleweed'"
+                        exit 1
+                        ;;
+                esac
+
+                # add required repos
+                if [ "${ci_host%%-*}" = x86_64 ]; then
+                    bits="64"
+                else
+                    bits="32"
+                fi
+                (
+                    p=$(zypper lr | grep "windows_mingw_win${bits}" || true)
+                    if [ -z "$p" ]; then
+                        $zypper ar --refresh --no-gpgcheck \
+                            "https://download.opensuse.org/repositories/windows:/mingw:/win${bits}/$repo/windows:mingw:win${bits}.repo"
+                    fi
+                )
+                packages=(
+                    "${packages[@]}"
+                    mingw${bits}-cross-gcc-c++
+                    mingw${bits}-libexpat-devel
+                    mingw${bits}-glib2-devel
+                )
+                ;;
+
+            (*)
+                packages=(
+                    "${packages[@]}"
+                    gcc-c++
+                    libexpat-devel
+                    glib2-devel
+                    libX11-devel
+                    systemd-devel
+                )
+                ;;
+        esac
+        $zypper install "${packages[@]}"
+
+        if [ "$ci_in_docker" = yes ]; then
+            # Add the user that we will use to do the build inside the
+            # Docker container, and let them use sudo
+            useradd -m user
+            passwd -ud user
+            echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/nopasswd
+            chmod 0440 /etc/sudoers.d/nopasswd
+        fi
+        ;;
+esac
+
+#
+# manual package setup
+#
+case "$ci_distro" in
+    (debian|ubuntu)
 
         # Make sure we have a messagebus user, even if the dbus package
         # isn't installed
@@ -183,6 +294,11 @@ case "$ci_distro" in
             --disabled-password --group messagebus
         ;;
 
+    (opensuse)
+        # test-bus depends on group 'bin'
+        $sudo getent group bin >/dev/null || /usr/sbin/groupadd -r bin
+        ;;
+
     (*)
         echo "Don't know how to set up ${ci_distro}" >&2
         exit 1