From 2284367591e82b836039a0f7803a03252f6291bb Mon Sep 17 00:00:00 2001 From: MerryMage Date: Sat, 21 Oct 2017 22:46:46 +0100 Subject: [PATCH] travis: Add build with frozen versions for dependencies --- .travis.yml | 6 ++++ .travis/linux-frozen/build.sh | 4 +++ .travis/linux-frozen/docker.sh | 27 ++++++++++++++++++ .travis/linux-frozen/install_package.py | 38 +++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100755 .travis/linux-frozen/build.sh create mode 100755 .travis/linux-frozen/docker.sh create mode 100755 .travis/linux-frozen/install_package.py diff --git a/.travis.yml b/.travis.yml index 41a78d345..e87700b5b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,12 @@ matrix: install: "./.travis/macos/deps.sh" script: "./.travis/macos/build.sh" after_success: "./.travis/macos/upload.sh" + - os: linux + env: NAME="linux build (frozen versions of dependencies)" + sudo: required + dist: trusty + services: docker + script: "./.travis/linux-frozen/build.sh" deploy: provider: releases diff --git a/.travis/linux-frozen/build.sh b/.travis/linux-frozen/build.sh new file mode 100755 index 000000000..25c655516 --- /dev/null +++ b/.travis/linux-frozen/build.sh @@ -0,0 +1,4 @@ +#!/bin/bash -ex + +docker pull ubuntu:16.04 +docker run -v $(pwd):/citra ubuntu:16.04 /bin/bash -ex /citra/.travis/linux-frozen/docker.sh diff --git a/.travis/linux-frozen/docker.sh b/.travis/linux-frozen/docker.sh new file mode 100755 index 000000000..edca9a7a1 --- /dev/null +++ b/.travis/linux-frozen/docker.sh @@ -0,0 +1,27 @@ +#!/bin/bash -ex + +cd /citra + +apt-get update +apt-get install -y build-essential wget git python-launchpadlib libssl-dev + +# Install specific versions of packages with their dependencies +# The apt repositories remove older versions regularly, so we can't use +# apt-get and have to pull the packages directly from the archives. +/citra/.travis/linux-frozen/install_package.py \ + libsdl2-dev 2.0.4+dfsg1-2ubuntu2 xenial \ + qtbase5-dev 5.2.1+dfsg-1ubuntu14.3 trusty \ + libqt5opengl5-dev 5.2.1+dfsg-1ubuntu14.3 trusty \ + libcurl4-openssl-dev 7.47.0-1ubuntu2.3 xenial \ + libicu52 52.1-3ubuntu0.6 trusty + +# Get a recent version of CMake +wget https://cmake.org/files/v3.9/cmake-3.9.0-Linux-x86_64.sh +echo y | sh cmake-3.9.0-Linux-x86_64.sh --prefix=cmake +export PATH=/citra/cmake/cmake-3.9.0-Linux-x86_64/bin:$PATH + +mkdir build && cd build +cmake .. -DUSE_SYSTEM_CURL=ON -DCMAKE_BUILD_TYPE=Release +make -j4 + +ctest -VV -C Release diff --git a/.travis/linux-frozen/install_package.py b/.travis/linux-frozen/install_package.py new file mode 100755 index 000000000..bdf333716 --- /dev/null +++ b/.travis/linux-frozen/install_package.py @@ -0,0 +1,38 @@ +#!/usr/bin/python + +import sys, re, subprocess +from launchpadlib.launchpad import Launchpad + +cachedir = '/.launchpadlib/cache/' +launchpad = Launchpad.login_anonymously('grab build info', 'production', cachedir, version='devel') + +processed_packages = [] +deb_file_list = [] + +def get_url(pkg, distro): + build_link = launchpad.archives.getByReference(reference='ubuntu').getPublishedBinaries(binary_name=pkg[0], distro_arch_series='https://api.launchpad.net/devel/ubuntu/'+distro+'/amd64', version=pkg[1], exact_match=True, order_by_date=True).entries[0]['build_link'] + deb_name = pkg[0] + '_' + pkg[1] + '_amd64.deb' + deb_link = build_link + '/+files/' + deb_name + return [deb_link, deb_name] + +def list_dependencies(deb_file): + t=subprocess.check_output(['bash', '-c', 'dpkg -I ' + deb_file + ' | grep -oP "^ Depends\: \K.*$"']) + deps=[i.strip() for i in t.split(',')] + equals_re = re.compile(r'^(.*) \(= (.*)\)$') + return [equals_re.sub(r'\1=\2', i).split('=') for i in filter(equals_re.match, deps)] + +def get_package(pkg, distro): + if pkg in processed_packages: + return + print 'Getting ' + pkg[0] + '...' + url = get_url(pkg, distro) + subprocess.check_call(['wget', '--quiet', url[0], '-O', url[1]]) + for dep in list_dependencies(url[1]): + get_package(dep, distro) + processed_packages.append(pkg) + deb_file_list.append('./' + url[1]) + +for i in xrange(1, len(sys.argv), 3): + get_package([sys.argv[i], sys.argv[i + 1]], sys.argv[i + 2]) + +subprocess.check_call(['apt-get', 'install', '-y'] + deb_file_list)