diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2016-01-20 15:01:16 +0100 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2016-01-20 15:01:16 +0100 |
commit | a31a37cc8f30cb7a21eeef4a41429a5347991922 (patch) | |
tree | d6a54bad9c64031914ae4c5fc7e08059194f2f41 /.travis-translate-pkgs | |
parent | 78be6e00c001f28dba38f4b91698886fa6314a1b (diff) | |
download | libgphoto2-a31a37cc8f30cb7a21eeef4a41429a5347991922.tar.gz |
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.
Diffstat (limited to '.travis-translate-pkgs')
-rw-r--r-- | .travis-translate-pkgs | 50 |
1 files changed, 50 insertions, 0 deletions
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 <<EOF +for SH in "bash" "busybox sh"; do + for os in linux osx no-os; do + for EXTRALIBS in "" "libusb-dev" "libusb-1.0-0-dev libgd2-xpm-dev" "nosuchlib"; do + echo "### SHELL: $SH OS: $os EXTRALIBS: '$EXTRALIBS' ###" + env TRAVIS_OS_NAME=$os $SH .travis-before-install $EXTRALIBS + echo "### Status: $?" + echo + done + done +done +EOF |