From a31a37cc8f30cb7a21eeef4a41429a5347991922 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Wed, 20 Jan 2016 15:01:16 +0100 Subject: travis: Fix sudo apt-get invocations It appears as if running "sudo apt-get" only works directly within .travis.yml but fails when used in a shell helper script. So we move the package installation commands themselves back to .travis.yml and only let the helper script only translate package names, not do any installations. --- .travis-translate-pkgs | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 .travis-translate-pkgs (limited to '.travis-translate-pkgs') diff --git a/.travis-translate-pkgs b/.travis-translate-pkgs new file mode 100644 index 000000000..b31337c1f --- /dev/null +++ b/.travis-translate-pkgs @@ -0,0 +1,50 @@ +#!/bin/sh + +set -e + +# Translate package names from Ubuntu packages to OSX brew packages +ubuntu2osx() { + case "$1" in + libusb-dev) echo "libusb-compat" ;; + libusb-1.0-0-dev) echo "libusb" ;; + libgd2-xpm-dev) echo "gd" ;; + *) + echo "Error: Unknown package name: '$1'" >&2 + exit 2 ;; + esac +} + +case "$TRAVIS_OS_NAME" in + linux) + echo "autopoint" "$@" + ;; + osx) + accu="gettext" + for pkg in "$@"; do + pkg="$(ubuntu2osx "$pkg")" + accu="$accu $pkg" + done + echo "$accu" + ;; + *) + echo "Unknown TRAVIS_OS_NAME value: '$TRAVIS_OS_NAME'" >&2 + exit 1 +esac + +exit 0 + +# Test this script. +# +# Usage: Type ( into a shell, paste test code, type ) and press Enter. +true <