From 4d0eefc1ae2dcaf9c54b1cb2eeb1552ca4ae3bf0 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Fri, 21 Apr 2017 09:42:46 +0200
Subject: [PATCH] Improved macports on travis-ci

Take advantage of https://github.com/GiovanniBussi/macports-ci

In this manner I will have to maintain a single script even though
I use macports on travis-ci for multiple projects
---
 .travis.yml                | 26 ++++++++++----------------
 .travis/config.macports.sh | 16 ----------------
 2 files changed, 10 insertions(+), 32 deletions(-)
 delete mode 100755 .travis/config.macports.sh

diff --git a/.travis.yml b/.travis.yml
index 7d3dfb4f6..9f6fc47e2 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -109,22 +109,16 @@ install:
 # I do it only when LD_LIBRARY_PATH is non blank, since otherwise clang gives problems
   - if test -n "$LD_LIBRARY_PATH" ; then PLUMED_LDFLAGS="-Wl,-rpath,$LD_LIBRARY_PATH" ; fi
 # macports related stuff
-  - if test -n "$PLUMED_MACPORTS" ; then export COLUMNS=80 ; fi
-# install macports from source:
-#  - if test -n "$PLUMED_MACPORTS" ; then wget https://distfiles.macports.org/MacPorts/MacPorts-2.3.4.tar.bz2 && tar xvfj MacPorts-2.3.4.tar.bz2 ; fi
-#  - if test -n "$PLUMED_MACPORTS" ; then cd MacPorts-2.3.4 && ./configure && sudo make install && cd - && sudo rm -fr MacPorts-2.3.4 ; fi
-# install macports from binary (faster):
-  - if test -n "$PLUMED_MACPORTS" ; then OSX_VERSION="$(sw_vers -productVersion | sed 's/\.[^\.]*$//')" ; fi
-  - MACPORTS_PKG=MacPorts-2.4.1-10.11-ElCapitan.pkg
-  - if test "$OSX_VERSION" == 10.12 ; then MACPORTS_PKG=MacPorts-2.4.1-10.12-Sierra.pkg ; fi
-  - echo "$MACPORTS_PKG"
-  - if test -n "$PLUMED_MACPORTS" ; then wget https://distfiles.macports.org/MacPorts/$MACPORTS_PKG ; fi
-  - if test -n "$PLUMED_MACPORTS" ; then sudo installer -pkg $MACPORTS_PKG -target / ; fi
-  - if test -n "$PLUMED_MACPORTS" ; then export PATH=/opt/local/bin:$PATH ; fi
-  - if test -n "$PLUMED_MACPORTS" ; then sudo port -N -v selfupdate ; fi
-  - if test -n "$PLUMED_MACPORTS" ; then make macports ; fi
-  - if test -n "$PLUMED_MACPORTS" ; then ./.travis/config.macports.sh ; fi
-
+# configure macports
+  - if test -n "$PLUMED_MACPORTS" ; then
+      export COLUMNS=80 ;
+      wget https://raw.githubusercontent.com/GiovanniBussi/macports-ci/master/macports-ci ;
+      chmod +x ./macports-ci ;
+      ./macports-ci install ;
+      PATH="/opt/local/bin:$PATH" ;
+      make macports ;
+      ./macports-ci localports macports ;
+    fi
 script:
 # make sure all modules are enabled
   - CONFIG_FLAGS="$CONFIG_FLAGS --enable-modules=all"
diff --git a/.travis/config.macports.sh b/.travis/config.macports.sh
deleted file mode 100755
index b5cb3db11..000000000
--- a/.travis/config.macports.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#! /bin/bash
-
-set -e
-set -x
-
-cd macports
-
-cp /opt/local/etc/macports/sources.conf $$
-awk -v repo="file://$PWD" '{if($NF=="[default]") print repo; print}' $$ > $$.new
-sudo mv -f $$.new /opt/local/etc/macports/sources.conf
-echo "** NEW SOURCES"
-cat /opt/local/etc/macports/sources.conf
-echo "** END NEW SOURCES"
-rm -f $$
-portindex
-
-- 
GitLab