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