ci: speed up Travis-CI osx jobs by upgrading only the packages we need

Synchronize the rest of the file with NFD.

Change-Id: If2f5fba0eb614a881b51396b15a5a30e7939f728
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
new file mode 100755
index 0000000..6038165
--- /dev/null
+++ b/.jenkins.d/00-deps.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/env bash
+set -e
+
+JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
+source "$JDIR"/util.sh
+
+set -x
+
+if has OSX $NODE_LABELS; then
+    FORMULAE=(boost pkg-config cryptopp log4cxx openssl)
+    brew update
+    if [[ -n $TRAVIS ]]; then
+        # travis images come with a large number of brew packages
+        # pre-installed, don't waste time upgrading all of them
+        for FORMULA in "${FORMULAE[@]}"; do
+            brew outdated $FORMULA || brew upgrade $FORMULA
+        done
+    else
+        brew upgrade
+    fi
+    brew install "${FORMULAE[@]}"
+    brew link --force log4cxx
+    brew cleanup
+fi
+
+if has Ubuntu $NODE_LABELS; then
+    sudo apt-get -qq update
+    sudo apt-get -qy install build-essential pkg-config libboost-all-dev \
+                             libcrypto++-dev libsqlite3-dev libssl-dev \
+                             liblog4cxx10-dev
+
+    if [[ $JOB_NAME == *"code-coverage" ]]; then
+        sudo apt-get -qy install lcov libgd-perl python-setuptools
+        sudo easy_install --upgrade gcovr
+    fi
+fi
diff --git a/.jenkins.d/01-dependencies.sh b/.jenkins.d/01-dependencies.sh
deleted file mode 100755
index 760b057..0000000
--- a/.jenkins.d/01-dependencies.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env bash
-set -e
-
-JDIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
-source "$JDIR"/util.sh
-
-if has OSX $NODE_LABELS && ! has OSX-10.8-c++11-64bit $NODE_LABELS; then
-    # OSX 10.8 requires special handling of dependencies
-    set -x
-    brew update
-    brew upgrade
-    brew install boost pkg-config sqlite cryptopp log4cxx openssl
-    brew link --force openssl log4cxx
-    brew cleanup
-fi
-
-if has Ubuntu $NODE_LABELS; then
-    BOOST_PKG=libboost-all-dev
-    if has Ubuntu-12.04 $NODE_LABELS; then
-        BOOST_PKG=libboost1.48-all-dev
-    fi
-
-    set -x
-    sudo apt-get update -qq -y
-    sudo apt-get -qq -y install build-essential pkg-config $BOOST_PKG \
-                                libcrypto++-dev libsqlite3-dev \
-                                liblog4cxx10-dev libssl-dev
-fi