From 02876df2e8713d65986fa44d1e027bdea8272b28 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 14 Jan 2019 18:55:13 +0100 Subject: [PATCH] Build RHEL 7 packages in Travis --- .travis.yml | 50 +++++++++++++++++++++++++------------- .travis/centos7/Dockerfile | 13 ++++++++++ .travis/centos7/build.sh | 40 ++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 .travis/centos7/Dockerfile create mode 100755 .travis/centos7/build.sh diff --git a/.travis.yml b/.travis.yml index ceafcbb7..69198463 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,36 @@ -language: - - c++ - - java +language: minimal -# Travis is still stuck on Ubuntu 14.04, which has too old crap -before_install: -# GnuTLS 3.x - - sudo apt-get install -y libgnutls28-dev -# FLTK 1.3.4 - - wget http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-2-source.tar.gz - - tar -xvf fltk-1.3.4-2-source.tar.gz - - pushd fltk-1.3.4-2 - - ./configure --prefix=/usr --enable-shared - - make -j2 - - sudo make install - - popd +env: + - DOCKER=centos7 + +matrix: + include: + - language: c++ + env: + + # Travis is still stuck on Ubuntu 14.04, which has too old crap + before_install: + # GnuTLS 3.x + - sudo apt-get install -y libgnutls28-dev + # FLTK 1.3.4 + - wget http://fltk.org/pub/fltk/1.3.4/fltk-1.3.4-2-source.tar.gz + - tar -xvf fltk-1.3.4-2-source.tar.gz + - pushd fltk-1.3.4-2 + - ./configure --prefix=/usr --enable-shared + - make -j2 + - sudo make install + - popd + script: + - cmake -DCMAKE_BUILD_TYPE=Debug . && make + + - language: java + env: + before_install: skip + script: + - cd java && cmake . && make + +before_install: + - docker build -t tigervnc/$DOCKER .travis/$DOCKER script: - - cmake -DCMAKE_BUILD_TYPE=Debug . && make - - cd java && cmake . && make + - .travis/$DOCKER/build.sh diff --git a/.travis/centos7/Dockerfile b/.travis/centos7/Dockerfile new file mode 100644 index 00000000..36e86fbd --- /dev/null +++ b/.travis/centos7/Dockerfile @@ -0,0 +1,13 @@ +FROM centos:7 + +RUN yum -y groupinstall 'Development Tools' +RUN yum -y install centos-packager + +RUN yum -y install sudo + +RUN useradd -s /bin/bash -m rpm +RUN echo >> /etc/sudoers +RUN echo "rpm ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +USER rpm +WORKDIR /home/rpm diff --git a/.travis/centos7/build.sh b/.travis/centos7/build.sh new file mode 100755 index 00000000..f5b4de03 --- /dev/null +++ b/.travis/centos7/build.sh @@ -0,0 +1,40 @@ +#!/bin/bash + +set -e +set -x + +## Basic variables + +CURDIR=$(dirname $(readlink -f $0)) +TOPDIR=$(git rev-parse --show-toplevel 2>/dev/null) + +RPMDIR=${TOPDIR}/contrib/packages/rpm/el7 + +VERSION=$(grep '^set(VERSION ' ${TOPDIR}/CMakeLists.txt | sed 's@^set(VERSION \(.*\))@\1@') + +## Prepare the build directory + +rm -rf ${CURDIR}/rpmbuild +mkdir -p ${CURDIR}/rpmbuild/{BUILD,BUILDROOT,SRPMS,SOURCES,SPECS,RPMS} +chmod a+w ${CURDIR}/rpmbuild/{BUILD,BUILDROOT,SRPMS,RPMS} +[ -x /usr/sbin/selinuxenabled ] && /usr/sbin/selinuxenabled && chcon -Rt container_file_t ${CURDIR}/rpmbuild + +## Copy over the packaging files + +cp ${RPMDIR}/SOURCES/* ${CURDIR}/rpmbuild/SOURCES +cp ${RPMDIR}/SPECS/tigervnc.spec ${CURDIR}/rpmbuild/SPECS +sed -i "s/@VERSION@/${VERSION}/" ${CURDIR}/rpmbuild/SPECS/tigervnc.spec + +## Copy over the source code + +(cd ${TOPDIR} && git archive --prefix tigervnc-${VERSION}/ HEAD) | bzip2 > ${CURDIR}/rpmbuild/SOURCES/tigervnc-${VERSION}.tar.bz2 + +## Start the build + +docker run --volume ${CURDIR}/rpmbuild:/home/rpm/rpmbuild --interactive --tty --rm tigervnc/${DOCKER} \ + bash -c " + sudo yum-builddep -y ~/rpmbuild/SPECS/tigervnc.spec && + sudo chown 0.0 ~/rpmbuild/SOURCES/* && + sudo chown 0.0 ~/rpmbuild/SPECS/* && + rpmbuild -ba ~/rpmbuild/SPECS/tigervnc.spec + " -- 2.39.5