From 94c22092a804e4718fa3ed07d554c7b185878f3c Mon Sep 17 00:00:00 2001
From: Massimiliano Culpo <massimiliano.culpo@gmail.com>
Date: Tue, 6 Mar 2018 06:49:43 +0100
Subject: [PATCH] Save sources in a mirror and cache it in Travis (#7392)

---
 .travis.yml                    | 5 ++++-
 share/spack/qa/run-build-tests | 6 ++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/.travis.yml b/.travis.yml
index dd4c255af9..c3d65f0e63 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -124,7 +124,10 @@ addons:
       - perl
       - perl-base
 
-cache: pip
+cache:
+  pip: true
+  directories:
+    - ~/.mirror
 
 # Work around Travis's lack of support for Python on OSX
 before_install:
diff --git a/share/spack/qa/run-build-tests b/share/spack/qa/run-build-tests
index 56aa51542e..5772632234 100755
--- a/share/spack/qa/run-build-tests
+++ b/share/spack/qa/run-build-tests
@@ -11,6 +11,12 @@
 . "$(dirname $0)/setup.sh"
 check_dependencies ${coverage} git hg svn
 
+# Fetch the sources in a mirror, and add it to Spack
+mkdir -p ~/.mirror
+bin/spack mirror add travis ~/.mirror
+bin/spack mirror create -D -d ~/.mirror ${SPEC}
+
+
 # Move to root directory of Spack
 # Allows script to be run from anywhere
 cd "$SPACK_ROOT"
-- 
GitLab