Update CI scripts

Synced from ndn-tools

Change-Id: I1faf341ab032a2e5ca2a70e2c1142379581fba34
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 41b93f0..66dafb4 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -7,14 +7,28 @@
 set -x
 
 if has OSX $NODE_LABELS; then
+    FORMULAE=(boost openssl pkg-config)
     brew update
-    brew upgrade
-    brew install boost pkg-config cryptopp openssl
+    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 cleanup
 fi
 
 if has Ubuntu $NODE_LABELS; then
     sudo apt-get -qq update
-    sudo apt-get -qq install build-essential pkg-config libboost-all-dev \
-                             libcrypto++-dev libsqlite3-dev libssl-dev
+    sudo apt-get -qy install build-essential pkg-config libboost-all-dev \
+                             libsqlite3-dev libssl-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-ndn-cxx.sh b/.jenkins.d/01-ndn-cxx.sh
index e25dd2a..c9e2a63 100755
--- a/.jenkins.d/01-ndn-cxx.sh
+++ b/.jenkins.d/01-ndn-cxx.sh
@@ -35,15 +35,16 @@
     sudo rm -Rf ndn-cxx-latest
 fi
 
-sudo rm -Rf /usr/local/include/ndn-cxx
+sudo rm -f /usr/local/bin/ndnsec*
+sudo rm -fr /usr/local/include/ndn-cxx
 sudo rm -f /usr/local/lib/libndn-cxx*
-sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx*
+sudo rm -f /usr/local/lib/pkgconfig/libndn-cxx.pc
 
 pushd ndn-cxx >/dev/null
 
-./waf configure -j1 --color=yes --enable-shared --disable-static --without-osx-keychain
-./waf -j1 --color=yes
-sudo ./waf install -j1 --color=yes
+./waf configure --color=yes --enable-shared --disable-static --without-osx-keychain
+./waf build --color=yes -j${WAF_JOBS:-1}
+sudo env "PATH=$PATH" ./waf install --color=yes
 
 popd >/dev/null
 popd >/dev/null
diff --git a/.jenkins.d/10-build.sh b/.jenkins.d/10-build.sh
index ef94d90..b902b1e 100755
--- a/.jenkins.d/10-build.sh
+++ b/.jenkins.d/10-build.sh
@@ -6,42 +6,39 @@
 
 set -x
 
-git submodule init
-git submodule sync
-git submodule update
+if [[ $JOB_NAME == *"code-coverage" ]]; then
+    COVERAGE="--with-coverage"
+elif [[ -z $DISABLE_ASAN ]]; then
+    ASAN="--with-sanitizer=address"
+fi
 
 # Cleanup
-sudo ./waf -j1 --color=yes distclean
+sudo env "PATH=$PATH" ./waf --color=yes distclean
 
 if [[ $JOB_NAME != *"code-coverage" && $JOB_NAME != *"limited-build" ]]; then
   # Configure/build in optimized mode with tests
-  ./waf -j1 --color=yes configure --with-tests
-  ./waf -j1 --color=yes build
+  ./waf --color=yes configure --with-tests
+  ./waf --color=yes build -j${WAF_JOBS:-1}
 
   # Cleanup
-  sudo ./waf -j1 --color=yes distclean
+  sudo env "PATH=$PATH" ./waf --color=yes distclean
 
   # Configure/build in optimized mode without tests
-  ./waf -j1 --color=yes configure
-  ./waf -j1 --color=yes build
+  ./waf --color=yes configure
+  ./waf --color=yes build -j${WAF_JOBS:-1}
 
   # Cleanup
-  sudo ./waf -j1 --color=yes distclean
+  sudo env "PATH=$PATH" ./waf --color=yes distclean
 fi
 
 # Configure/build in debug mode with tests
-if [[ $JOB_NAME == *"code-coverage" ]]; then
-    COVERAGE="--with-coverage"
-elif ! has OSX-10.9 $NODE_LABELS && ! has OSX-10.11 $NODE_LABELS; then
-    ASAN="--with-sanitizer=address"
-fi
-./waf -j1 --color=yes configure --debug --with-tests --with-sanitizer=address $COVERAGE $ASAN
-./waf -j1 --color=yes build
+./waf --color=yes configure --debug --with-tests $ASAN $COVERAGE
+./waf --color=yes build -j${WAF_JOBS:-1}
 
 # (tests will be run against debug version)
 
 # Install
-sudo ./waf -j1 --color=yes install
+sudo env "PATH=$PATH" ./waf --color=yes install
 
 if has Linux $NODE_LABELS; then
     sudo ldconfig
diff --git a/.jenkins.d/20-tests.sh b/.jenkins.d/20-tests.sh
index 18d1c91..fe7981d 100755
--- a/.jenkins.d/20-tests.sh
+++ b/.jenkins.d/20-tests.sh
@@ -6,6 +6,9 @@
 
 set -x
 
+# Prepare environment
+rm -Rf ~/.ndn
+
 BOOST_VERSION=$(python -c "import sys; sys.path.append('build/c4che'); import _cache; print(_cache.BOOST_VERSION_NUMBER);")
 
 ut_log_args() {
@@ -32,5 +35,5 @@
 ASAN_OPTIONS+=":strip_path_prefix=${PWD}/"
 export ASAN_OPTIONS
 
-# First run all tests as unprivileged user
+# Run unit tests
 ./build/unit-tests $(ut_log_args)
diff --git a/.jenkins.d/30-coverage.sh b/.jenkins.d/30-coverage.sh
index e629e83..92a9ceb 100755
--- a/.jenkins.d/30-coverage.sh
+++ b/.jenkins.d/30-coverage.sh
@@ -9,12 +9,28 @@
 if [[ $JOB_NAME == *"code-coverage" ]]; then
     gcovr --object-directory=build \
           --output=build/coverage.xml \
-          --exclude="$PWD/(tests)" \
+          --exclude="$PWD/tests" \
           --root=. \
           --xml
 
-    # # Generate also a detailed HTML output, but using lcov (slower, but better results)
-    lcov -q -c -d . --no-external -o build/coverage-with-tests.info --rc lcov_branch_coverage=1
-    lcov -q -r build/coverage-with-tests.info "$PWD/tests/*" -o build/coverage.info --rc lcov_branch_coverage=1
-    genhtml build/coverage.info --output-directory build/coverage --legend --rc genhtml_branch_coverage=1
+    # Generate also a detailed HTML output, but using lcov (better results)
+    lcov --quiet \
+         --capture \
+         --directory . \
+         --no-external \
+         --rc lcov_branch_coverage=1 \
+         --output-file build/coverage-with-tests.info
+
+    lcov --quiet \
+         --remove build/coverage-with-tests.info "$PWD/tests/*" \
+         --rc lcov_branch_coverage=1 \
+         --output-file build/coverage.info
+
+    genhtml --branch-coverage \
+            --demangle-cpp \
+            --frames \
+            --legend \
+            --output-directory build/coverage \
+            --title "ndncert unit tests" \
+            build/coverage.info
 fi
diff --git a/.jenkins.d/README.md b/.jenkins.d/README.md
index 085e383..41812aa 100644
--- a/.jenkins.d/README.md
+++ b/.jenkins.d/README.md
@@ -32,3 +32,5 @@
 
 - `CACHE_DIR`: the variable defines a path to folder containing cached files from previous builds,
   e.g., a compiled version of ndn-cxx library.  If not set, `/tmp` is used.
+
+- `WAF_JOBS`: number of parallel build jobs used by waf, defaults to 1.
diff --git a/COPYING.md b/COPYING.md
index ff81c83..8bbf3bd 100644
--- a/COPYING.md
+++ b/COPYING.md
@@ -8,9 +8,6 @@
 - Boost libraries licensed under conditions of
   [Boost Software License 1.0](http://www.boost.org/users/license.html)
 
-- CryptoPP library is licensed under conditions of
-  [Boost Software License 1.0](http://www.boost.org/users/license.html)
-
 - SQLite is in [public domain](http://www.sqlite.org/copyright.html)
 
 - waf build system is licensed under conditions of