← Back to team overview

ubuntu-touch-coreapps-reviewers team mailing list archive

[Merge] lp:~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-lib-cache into lp:ubuntu-docviewer-app

 

Roman Shchekin has proposed merging lp:~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-lib-cache into lp:ubuntu-docviewer-app.

Commit message:
Upstream libs caching.

Requested reviews:
  Jenkins Bot (ubuntu-core-apps-jenkins-bot): continuous-integration
  Ubuntu Document Viewer Developers (ubuntu-docviewer-dev)

For more details, see:
https://code.launchpad.net/~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-lib-cache/+merge/282652

Upstream libs caching.
-- 
Your team Ubuntu Document Viewer Developers is requested to review the proposed merge of lp:~mrqtros/ubuntu-docviewer-app/ubuntu-docviewer-app-lib-cache into lp:ubuntu-docviewer-app.
=== modified file 'cmake/modules/Click.cmake'
--- cmake/modules/Click.cmake	2015-11-22 17:28:09 +0000
+++ cmake/modules/Click.cmake	2016-01-14 19:36:18 +0000
@@ -17,11 +17,24 @@
   set(CUSTOM_SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/click/disable-file-locking.sh)
   set(UPSTREAM_LIBS_DIR ${CMAKE_BINARY_DIR}/upstream-libs)
 
-  MESSAGE("Grabbing upstream libs to ${UPSTREAM_LIBS_DIR}")
-  execute_process(
-    COMMAND mkdir ${UPSTREAM_LIBS_DIR}
-    COMMAND ${GET_CLICK_DEPS_TOOL} -d ${DEPS_MANIFEST} -c ${CUSTOM_SCRIPT} ${CLICK_ARCH} ${UPSTREAM_LIBS_DIR}
-  )
+  MESSAGE("Grabbing upstream libs to ${UPSTREAM_LIBS_DIR}") 
+
+  get_filename_component(BLD_CONFIGURATION_NAME ${CMAKE_BINARY_DIR} NAME)
+  set(UPSTREAM_CACHE $ENV{HOME}/dev/upstream-libs-docviewer/${BLD_CONFIGURATION_NAME})
+  MESSAGE("Upstream libs cache path: ${UPSTREAM_CACHE}")  
+
+  if(EXISTS "${UPSTREAM_CACHE}")
+    MESSAGE("Upstream libs cache exists.") 
+    file(COPY ${UPSTREAM_CACHE}/upstream-libs/ DESTINATION ${UPSTREAM_LIBS_DIR} PATTERN * )
+  else()
+    MESSAGE("Cache miss, downloading from network.") 
+    execute_process(
+      COMMAND mkdir ${UPSTREAM_LIBS_DIR}
+      COMMAND ${GET_CLICK_DEPS_TOOL} -d ${DEPS_MANIFEST} -c ${CUSTOM_SCRIPT} ${CLICK_ARCH} ${UPSTREAM_LIBS_DIR}
+    )
+    # Cache for next usage.
+    file(COPY ${UPSTREAM_LIBS_DIR} DESTINATION ${UPSTREAM_CACHE} )
+  endif()
 
   MESSAGE("Installing upstream libs from ${UPSTREAM_LIBS_DIR}/usr/lib/${ARCH_TRIPLET}/ to ${DATA_DIR}lib/${ARCH_TRIPLET}")
   file(GLOB_RECURSE UPSTREAM_LIBS "${UPSTREAM_LIBS_DIR}/usr/lib/${ARCH_TRIPLET}/*")