diff options
-rw-r--r-- | .travis-translate-pkgs (renamed from .travis-before-install) | 37 | ||||
-rw-r--r-- | .travis.yml | 7 |
2 files changed, 12 insertions, 32 deletions
diff --git a/.travis-before-install b/.travis-translate-pkgs index a42deb209..b31337c1f 100644 --- a/.travis-before-install +++ b/.travis-translate-pkgs @@ -2,13 +2,7 @@ set -e -# Calling us with DRY_RUN=true makes this script dry-run with debug -# output for testing this script. -if test "x$DRY_RUN" = "x"; then - DRY_RUN="false" -fi - -# Convert package names from Ubuntu packages to OSX brew packages +# Translate package names from Ubuntu packages to OSX brew packages ubuntu2osx() { case "$1" in libusb-dev) echo "libusb-compat" ;; @@ -20,38 +14,20 @@ ubuntu2osx() { esac } -# Execute a command -cmd() { - echo "$@" - if "$DRY_RUN"; then - # Do nothing - true - else - # Execute the command - "$@" - fi -} - case "$TRAVIS_OS_NAME" in linux) - cmd sudo apt-get update -qq - accu="autopoint" - for pkg in "$@"; do - accu="$accu $pkg" - done - cmd sudo apt-get install -y $accu + echo "autopoint" "$@" ;; osx) - cmd brew update accu="gettext" for pkg in "$@"; do pkg="$(ubuntu2osx "$pkg")" accu="$accu $pkg" done - cmd brew install $accu + echo "$accu" ;; *) - echo "Unknown Travis CI build OS: $TRAVIS_OS_NAME" >&2 + echo "Unknown TRAVIS_OS_NAME value: '$TRAVIS_OS_NAME'" >&2 exit 1 esac @@ -61,10 +37,9 @@ exit 0 # # Usage: Type ( into a shell, paste test code, type ) and press Enter. true <<EOF -export DRY_RUN=true for SH in "bash" "busybox sh"; do - for os in linux osx; do - for EXTRALIBS in "" "libusb-dev" "libusb-1.0-0-dev libgd2-xpm-dev" "moo"; 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: $?" diff --git a/.travis.yml b/.travis.yml index 0a2af569f..a44c12223 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,8 +9,13 @@ env: - EXTRALIBS="libusb-dev" - EXTRALIBS="libusb-1.0-0-dev libgd2-xpm-dev" +# Note: Keep the sudo commands in .travis.yml - they do not work from +# a helper shell script. before_install: - - sh .travis-before-install $EXTRALIBS + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install $(sh .travis-translate-pkgs $EXTRALIBS); fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get update -qq; fi + - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -y $(sh .travis-translate-pkgs $EXTRALIBS); fi compiler: - clang |