Blame SOURCES/0064-travis-RHEL8-support.patch

a3e2b5
From 45b0a38b47e07186dfe35095c7d8b1e4c2524d80 Mon Sep 17 00:00:00 2001
a3e2b5
From: Frantisek Sumsal <fsumsal@redhat.com>
a3e2b5
Date: Mon, 14 Jan 2019 14:49:32 +0100
a3e2b5
Subject: [PATCH] travis: RHEL8 support
a3e2b5
a3e2b5
(cherry picked from commit e5c78840b2b124400f56cb5fbaf2357cd8901218)
a3e2b5
---
a3e2b5
 .travis.yml                                   |   8 +-
a3e2b5
 ...ravis-centos.sh => travis-centos-rhel7.sh} |   0
a3e2b5
 ci/travis-centos-rhel8.sh                     | 130 ++++++++++++++++++
a3e2b5
 3 files changed, 135 insertions(+), 3 deletions(-)
a3e2b5
 rename ci/{travis-centos.sh => travis-centos-rhel7.sh} (100%)
a3e2b5
 create mode 100755 ci/travis-centos-rhel8.sh
a3e2b5
a3e2b5
diff --git a/.travis.yml b/.travis.yml
a3e2b5
index fc63887324..1c4e6f9728 100644
a3e2b5
--- a/.travis.yml
a3e2b5
+++ b/.travis.yml
a3e2b5
@@ -19,11 +19,13 @@ jobs:
a3e2b5
               - sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
a3e2b5
               - docker --version
a3e2b5
           install:
a3e2b5
-              - $CI_ROOT/travis-centos.sh SETUP
a3e2b5
+              - RHEL_VERSION="rhel7"
a3e2b5
+              - [ -f meson.build ] && RHEL_VERSION="rhel8"
a3e2b5
+              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh SETUP
a3e2b5
           script:
a3e2b5
               - set -e
a3e2b5
               # Build systemd
a3e2b5
-              - $CI_ROOT/travis-centos.sh RUN
a3e2b5
+              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh RUN
a3e2b5
               - set +e
a3e2b5
           after_script:
a3e2b5
-              - $CI_ROOT/travis-centos.sh CLEANUP
a3e2b5
+              - $CI_ROOT/travis-centos-${RHEL_VERSION}.sh CLEANUP
a3e2b5
diff --git a/ci/travis-centos.sh b/ci/travis-centos-rhel7.sh
a3e2b5
similarity index 100%
a3e2b5
rename from ci/travis-centos.sh
a3e2b5
rename to ci/travis-centos-rhel7.sh
a3e2b5
diff --git a/ci/travis-centos-rhel8.sh b/ci/travis-centos-rhel8.sh
a3e2b5
new file mode 100755
a3e2b5
index 0000000000..968603f949
a3e2b5
--- /dev/null
a3e2b5
+++ b/ci/travis-centos-rhel8.sh
a3e2b5
@@ -0,0 +1,130 @@
a3e2b5
+#!/bin/bash
a3e2b5
+
a3e2b5
+# Run this script from the root of the systemd's git repository
a3e2b5
+# or set REPO_ROOT to a correct path.
a3e2b5
+#
a3e2b5
+# Example execution on Fedora:
a3e2b5
+# dnf install docker
a3e2b5
+# systemctl start docker
a3e2b5
+# export CONT_NAME="my-fancy-container"
a3e2b5
+# ci/travis-centos.sh SETUP RUN CLEANUP
a3e2b5
+
a3e2b5
+PHASES=(${@:-SETUP RUN CLEANUP})
a3e2b5
+CENTOS_RELEASE="${CENTOS_RELEASE:-latest}"
a3e2b5
+CONT_NAME="${CONT_NAME:-centos-$CENTOS_RELEASE-$RANDOM}"
a3e2b5
+DOCKER_EXEC="${DOCKER_EXEC:-docker exec -it $CONT_NAME}"
a3e2b5
+DOCKER_RUN="${DOCKER_RUN:-docker run}"
a3e2b5
+REPO_ROOT="${REPO_ROOT:-$PWD}"
a3e2b5
+ADDITIONAL_DEPS=(systemd-ci-environment libidn2-devel python-lxml python36 ninja-build libasan net-tools strace nc busybox e2fsprogs quota dnsmasq)
a3e2b5
+# Repo with additional depencencies to compile newer systemd on CentOS 7
a3e2b5
+COPR_REPO="https://copr.fedorainfracloud.org/coprs/mrc0mmand/systemd-centos-ci/repo/epel-7/mrc0mmand-systemd-centos-ci-epel-7.repo"
a3e2b5
+COPR_REPO_PATH="/etc/yum.repos.d/${COPR_REPO##*/}"
a3e2b5
+
a3e2b5
+function info() {
a3e2b5
+    echo -e "\033[33;1m$1\033[0m"
a3e2b5
+}
a3e2b5
+
a3e2b5
+set -e
a3e2b5
+
a3e2b5
+source "$(dirname $0)/travis_wait.bash"
a3e2b5
+
a3e2b5
+for phase in "${PHASES[@]}"; do
a3e2b5
+    case $phase in
a3e2b5
+        SETUP)
a3e2b5
+            info "Setup phase"
a3e2b5
+            info "Using Travis $CENTOS_RELEASE"
a3e2b5
+            # Pull a Docker image and start a new container
a3e2b5
+            docker pull centos:$CENTOS_RELEASE
a3e2b5
+            info "Starting container $CONT_NAME"
a3e2b5
+            $DOCKER_RUN -v $REPO_ROOT:/build:rw \
a3e2b5
+                        -w /build --privileged=true --name $CONT_NAME \
a3e2b5
+                        -dit --net=host centos:$CENTOS_RELEASE /sbin/init
a3e2b5
+            # Beautiful workaround for Fedora's version of Docker
a3e2b5
+            sleep 1
a3e2b5
+            $DOCKER_EXEC yum makecache
a3e2b5
+            $DOCKER_EXEC curl "$COPR_REPO" -o "$COPR_REPO_PATH"
a3e2b5
+            $DOCKER_EXEC yum -q -y install epel-release yum-utils
a3e2b5
+            $DOCKER_EXEC yum-config-manager -q --enable epel
a3e2b5
+            $DOCKER_EXEC yum -y --exclude selinux-policy\* upgrade
a3e2b5
+            # Install necessary build/test requirements
a3e2b5
+            $DOCKER_EXEC yum -y install "${ADDITIONAL_DEPS[@]}"
a3e2b5
+            $DOCKER_EXEC python3.6 -m ensurepip
a3e2b5
+            $DOCKER_EXEC python3.6 -m pip install meson
a3e2b5
+            # Create necessary symlinks
a3e2b5
+            $DOCKER_EXEC ln --force -s /usr/bin/python3.6 /usr/bin/python3
a3e2b5
+            $DOCKER_EXEC ln --force -s /usr/bin/ninja-build /usr/bin/ninja
a3e2b5
+            ;;
a3e2b5
+        RUN)
a3e2b5
+            info "Run phase"
a3e2b5
+            # Build systemd
a3e2b5
+            CONFIGURE_OPTS=(
a3e2b5
+                # RHEL8 options
a3e2b5
+                -Dsysvinit-path=/etc/rc.d/init.d
a3e2b5
+                -Drc-local=/etc/rc.d/rc.local
a3e2b5
+                -Ddns-servers=''
a3e2b5
+                -Ddev-kvm-mode=0666
a3e2b5
+                -Dkmod=true
a3e2b5
+                -Dxkbcommon=true
a3e2b5
+                -Dblkid=true
a3e2b5
+                -Dseccomp=true
a3e2b5
+                -Dima=true
a3e2b5
+                -Dselinux=true
a3e2b5
+                -Dapparmor=false
a3e2b5
+                -Dpolkit=true
a3e2b5
+                -Dxz=true
a3e2b5
+                -Dzlib=true
a3e2b5
+                -Dbzip2=true
a3e2b5
+                -Dlz4=true
a3e2b5
+                -Dpam=true
a3e2b5
+                -Dacl=true
a3e2b5
+                -Dsmack=true
a3e2b5
+                -Dgcrypt=true
a3e2b5
+                -Daudit=true
a3e2b5
+                -Delfutils=true
a3e2b5
+                -Dlibcryptsetup=true
a3e2b5
+                -Delfutils=true
a3e2b5
+                -Dqrencode=false
a3e2b5
+                -Dgnutls=true
a3e2b5
+                -Dmicrohttpd=true
a3e2b5
+                -Dlibidn2=true
a3e2b5
+                -Dlibiptc=true
a3e2b5
+                -Dlibcurl=true
a3e2b5
+                -Defi=true
a3e2b5
+                -Dtpm=true
a3e2b5
+                -Dhwdb=true
a3e2b5
+                -Dsysusers=true
a3e2b5
+                -Ddefault-kill-user-processes=false
a3e2b5
+                -Dtests=unsafe
a3e2b5
+                -Dinstall-tests=true
a3e2b5
+                -Dtty-gid=5
a3e2b5
+                -Dusers-gid=100
a3e2b5
+                -Dnobody-user=nobody
a3e2b5
+                -Dnobody-group=nobody
a3e2b5
+                -Dsplit-usr=false
a3e2b5
+                -Dsplit-bin=true
a3e2b5
+                -Db_lto=false
a3e2b5
+                -Dnetworkd=false
a3e2b5
+                -Dtimesyncd=false
a3e2b5
+                -Ddefault-hierarchy=legacy
a3e2b5
+                # Custom options
a3e2b5
+                -Dslow-tests=true
a3e2b5
+                -Dtests=unsafe
a3e2b5
+                -Dinstall-tests=true
a3e2b5
+            )
a3e2b5
+            docker exec -it -e CFLAGS='-g -O0 -ftrapv' $CONT_NAME meson build "${CONFIGURE_OPTS[@]}"
a3e2b5
+            $DOCKER_EXEC ninja -v -C build
a3e2b5
+            # "Mask" the udev-test.pl, as it requires newer version of systemd-detect-virt
a3e2b5
+            # and it's pointless to run it on a VM in a Docker container...
a3e2b5
+            echo -ne "#!/usr/bin/perl\nexit(0);\n" > "test/udev-test.pl"
a3e2b5
+            $DOCKER_EXEC ninja -C build test
a3e2b5
+            ;;
a3e2b5
+        CLEANUP)
a3e2b5
+            info "Cleanup phase"
a3e2b5
+            docker stop $CONT_NAME
a3e2b5
+            docker rm -f $CONT_NAME
a3e2b5
+            ;;
a3e2b5
+        *)
a3e2b5
+            echo >&2 "Unknown phase '$phase'"
a3e2b5
+            exit 1
a3e2b5
+    esac
a3e2b5
+done