4fbe94
From ac7db0c5b48f1090f77dbcfa0a1e0dc08d5c471e Mon Sep 17 00:00:00 2001
4fbe94
From: Frantisek Sumsal <fsumsal@redhat.com>
4fbe94
Date: Mon, 14 Oct 2019 15:26:48 +0200
4fbe94
Subject: [PATCH] travis: move to CentOS 8 docker images
4fbe94
4fbe94
As the CentOS 8 Docker images is finally out, we can use it and drop the
4fbe94
plethora of workarounds we had to implement to compile RHEL8 systemd on
4fbe94
CentOS 7.
4fbe94
4fbe94
Resolves: #1761519
4fbe94
---
4fbe94
 .travis.yml               | 22 ++++++++++------------
4fbe94
 ci/travis-centos-rhel8.sh | 32 +++++++++-----------------------
4fbe94
 2 files changed, 19 insertions(+), 35 deletions(-)
4fbe94
4fbe94
diff --git a/.travis.yml b/.travis.yml
4fbe94
index 0010da5784..70c60cf24e 100644
4fbe94
--- a/.travis.yml
4fbe94
+++ b/.travis.yml
4fbe94
@@ -9,42 +9,40 @@ env:
4fbe94
 
4fbe94
 jobs:
4fbe94
     include:
4fbe94
-        - name: CentOS 7
4fbe94
+        - name: CentOS 8
4fbe94
           language: bash
4fbe94
           env:
4fbe94
-              - CENTOS_RELEASE="centos7"
4fbe94
+              - CENTOS_RELEASE="centos8"
4fbe94
               - CONT_NAME="systemd-centos-$CENTOS_RELEASE"
4fbe94
               - DOCKER_EXEC="docker exec -ti $CONT_NAME"
4fbe94
           before_install:
4fbe94
               - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
4fbe94
               - docker --version
4fbe94
           install:
4fbe94
-              - if [ -f meson.build ]; then RHEL_VERSION=rhel8; else RHEL_VERSION=rhel7; fi
4fbe94
-              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh SETUP
4fbe94
+              - $CI_ROOT/travis-centos-rhel8.sh SETUP
4fbe94
           script:
4fbe94
               - set -e
4fbe94
               # Build systemd
4fbe94
-              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh RUN
4fbe94
+              - $CI_ROOT/travis-centos-rhel8.sh RUN
4fbe94
               - set +e
4fbe94
           after_script:
4fbe94
-              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh CLEANUP
4fbe94
+              - $CI_ROOT/travis-centos-rhel8.sh CLEANUP
4fbe94
 
4fbe94
-        - name: CentOS 7 (ASan+UBSan)
4fbe94
+        - name: CentOS 8 (ASan+UBSan)
4fbe94
           language: bash
4fbe94
           env:
4fbe94
-              - CENTOS_RELEASE="centos7"
4fbe94
+              - CENTOS_RELEASE="centos8"
4fbe94
               - CONT_NAME="systemd-centos-$CENTOS_RELEASE"
4fbe94
               - DOCKER_EXEC="docker exec -ti $CONT_NAME"
4fbe94
           before_install:
4fbe94
               - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
4fbe94
               - docker --version
4fbe94
           install:
4fbe94
-              - if [ -f meson.build ]; then RHEL_VERSION=rhel8; else RHEL_VERSION=rhel7; fi
4fbe94
-              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh SETUP
4fbe94
+              - $CI_ROOT/travis-centos-rhel8.sh SETUP
4fbe94
           script:
4fbe94
               - set -e
4fbe94
               # Build systemd
4fbe94
-              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh RUN_ASAN
4fbe94
+              - $CI_ROOT/travis-centos-rhel8.sh RUN_ASAN
4fbe94
               - set +e
4fbe94
           after_script:
4fbe94
-              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh CLEANUP
4fbe94
+              - $CI_ROOT/travis-centos-rhel8.sh CLEANUP
4fbe94
diff --git a/ci/travis-centos-rhel8.sh b/ci/travis-centos-rhel8.sh
4fbe94
index c3d1018682..ade44a0413 100755
4fbe94
--- a/ci/travis-centos-rhel8.sh
4fbe94
+++ b/ci/travis-centos-rhel8.sh
4fbe94
@@ -15,10 +15,7 @@ CONT_NAME="${CONT_NAME:-centos-$CENTOS_RELEASE-$RANDOM}"
4fbe94
 DOCKER_EXEC="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
4fbe94
 DOCKER_RUN="${DOCKER_RUN:-docker run}"
4fbe94
 REPO_ROOT="${REPO_ROOT:-$PWD}"
4fbe94
-ADDITIONAL_DEPS=(systemd-ci-environment libidn2-devel python-lxml python36 ninja-build libasan net-tools strace nc busybox e2fsprogs quota dnsmasq)
4fbe94
-# Repo with additional depencencies to compile newer systemd on CentOS 7
4fbe94
-COPR_REPO="https://copr.fedorainfracloud.org/coprs/mrc0mmand/systemd-centos-ci/repo/epel-7/mrc0mmand-systemd-centos-ci-epel-7.repo"
4fbe94
-COPR_REPO_PATH="/etc/yum.repos.d/${COPR_REPO##*/}"
4fbe94
+ADDITIONAL_DEPS=(libasan libubsan net-tools strace nc e2fsprogs quota dnsmasq)
4fbe94
 # RHEL8 options
4fbe94
 CONFIGURE_OPTS=(
4fbe94
     -Dsysvinit-path=/etc/rc.d/init.d
4fbe94
@@ -95,18 +92,14 @@ for phase in "${PHASES[@]}"; do
4fbe94
                         -dit --net=host centos:$CENTOS_RELEASE /sbin/init
4fbe94
             # Beautiful workaround for Fedora's version of Docker
4fbe94
             sleep 1
4fbe94
-            $DOCKER_EXEC yum makecache
4fbe94
-            $DOCKER_EXEC curl "$COPR_REPO" -o "$COPR_REPO_PATH"
4fbe94
-            $DOCKER_EXEC yum -q -y install epel-release yum-utils
4fbe94
-            $DOCKER_EXEC yum-config-manager -q --enable epel
4fbe94
-            $DOCKER_EXEC yum -y upgrade
4fbe94
-            # Install necessary build/test requirements
4fbe94
-            $DOCKER_EXEC yum -y install "${ADDITIONAL_DEPS[@]}"
4fbe94
-            $DOCKER_EXEC python3.6 -m ensurepip
4fbe94
-            $DOCKER_EXEC python3.6 -m pip install meson
4fbe94
-            # Create necessary symlinks
4fbe94
-            $DOCKER_EXEC ln --force -s /usr/bin/python3.6 /usr/bin/python3
4fbe94
-            $DOCKER_EXEC ln --force -s /usr/bin/ninja-build /usr/bin/ninja
4fbe94
+            $DOCKER_EXEC dnf makecache
4fbe94
+            # Install and enable EPEL
4fbe94
+            $DOCKER_EXEC dnf -q -y install epel-release dnf-utils "${ADDITIONAL_DEPS[@]}"
4fbe94
+            $DOCKER_EXEC dnf config-manager -q --enable epel
4fbe94
+            # Upgrade the container to get the most recent environment
4fbe94
+            $DOCKER_EXEC dnf -y upgrade
4fbe94
+            # Install systemd's build dependencies
4fbe94
+            $DOCKER_EXEC dnf -q -y --enablerepo "PowerTools" builddep systemd
4fbe94
             ;;
4fbe94
         RUN)
4fbe94
             info "Run phase"
4fbe94
@@ -117,16 +110,9 @@ for phase in "${PHASES[@]}"; do
4fbe94
             # unexpected fails due to incompatibilities with older systemd
4fbe94
             $DOCKER_EXEC ninja -C build install
4fbe94
             docker restart $CONT_NAME
4fbe94
-            # "Mask" the udev-test.pl, as it requires newer version of systemd-detect-virt
4fbe94
-            # and it's pointless to run it on a VM in a Docker container...
4fbe94
-            echo -ne "#!/usr/bin/perl\nexit(0);\n" > "test/udev-test.pl"
4fbe94
             $DOCKER_EXEC ninja -C build test
4fbe94
             ;;
4fbe94
         RUN_ASAN|RUN_CLANG_ASAN)
4fbe94
-            # Let's install newer gcc for proper ASan/UBSan support
4fbe94
-            $DOCKER_EXEC yum -y install centos-release-scl
4fbe94
-            $DOCKER_EXEC yum -y install devtoolset-8 devtoolset-8-libasan-devel libasan5 devtoolset-8-libubsan-devel libubsan1
4fbe94
-            $DOCKER_EXEC bash -c "echo 'source scl_source enable devtoolset-8' >> /root/.bashrc"
4fbe94
             # Note to my future frustrated self: docker exec runs the given command
4fbe94
             # as sh -c 'command' - which means both .bash_profile and .bashrc will
4fbe94
             # be ignored. That's because .bash_profile is sourced for LOGIN shells (i.e.