From c0a05db10171613891bd9b2cacb2fa04f9bf3133 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 28 Sep 2017 18:56:59 +0200
Subject: [PATCH] try to fix linux caching

---
 gitlab/build.sh     | 6 ++++++
 gitlab/functions.sh | 7 +++++--
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/gitlab/build.sh b/gitlab/build.sh
index dea1366..d3f4b02 100755
--- a/gitlab/build.sh
+++ b/gitlab/build.sh
@@ -30,4 +30,10 @@ else
 fi
 
 # Copy the .tar.bz2 and urls.txt
+if [ "${OSNAME}" == "linux" ]; then
+    mkdir -p ${CONDA_ENVS_PATH}/.pkgs
+    touch ${CONDA_ENVS_PATH}/.pkgs/urls
+    touch ${CONDA_ENVS_PATH}/.pkgs/urls.txt
+fi
+
 merge_conda_cache ${CONDA_ENVS_PATH}/.pkgs ${CONDA_FOLDER}/pkgs
diff --git a/gitlab/functions.sh b/gitlab/functions.sh
index 1cdd2a2..eb30c9c 100644
--- a/gitlab/functions.sh
+++ b/gitlab/functions.sh
@@ -269,12 +269,15 @@ fi
 # $2: Path to the extra cache to be merged into main cache
 merge_conda_cache() {
   if [ -e ${1} ]; then
-    _cached_urls="${2}/urls.txt"
-    _urls="${1}/urls.txt"
+    _cached_urls="${2}/urls"
+    _urls="${1}/urls"
+    _cached_urlstxt="${2}/urls.txt"
+    _urlstxt="${1}/urls.txt"
     if [ -e ${2} ]; then
       log_info "Merging urls.txt and packages with cached files..."
       mv ${2}/*.tar.bz2 ${1}/
       cat ${_urls} ${_cached_urls} | sort | uniq > ${_urls}
+      cat ${_urlstxt} ${_cached_urlstxt} | sort | uniq > ${_urlstxt}
     fi
   fi
 }
-- 
GitLab