From be1bdf95319a2c56f752dbbad0e1e96864ab6927 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Mon, 10 Nov 2014 18:13:33 +0100
Subject: [PATCH] Added target sync-data on envinf1 only.

This copies all file from ${CMAKE_SOURCE_DIR}/../ogs6-data to
/data/ogs/ogs6-data and then triggers a build on Jenkins which
syncs /data/ogs6-data to opengeosys.org
---
 scripts/cmake/Find.cmake         |  8 +++++---
 scripts/cmake/ProjectSetup.cmake |  4 +++-
 scripts/cmake/test/Data.cmake    | 18 ++++++++++++++++++
 3 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/scripts/cmake/Find.cmake b/scripts/cmake/Find.cmake
index 9155b2d85be..0108ab4a802 100644
--- a/scripts/cmake/Find.cmake
+++ b/scripts/cmake/Find.cmake
@@ -55,6 +55,8 @@ IF(WIN32)
 	ENDIF()
 ENDIF()
 
+FIND_PROGRAM(CURL_TOOL_PATH curl DOC "The curl-tool")
+
 ######################
 ### Find libraries ###
 ######################
@@ -125,7 +127,7 @@ IF(OGS_USE_PETSC)
     ##This may cause the compilation broken.
     IF(FORCE_PETSC_EXECUTABLE_RUNS)
         SET(PETSC_EXECUTABLE_RUNS YES)
-    ENDIF() 
+    ENDIF()
 
     SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/scripts/cmake/findPETSC")
     FIND_PACKAGE(PETSc REQUIRED)
@@ -133,9 +135,9 @@ IF(OGS_USE_PETSC)
     include_directories(
               ${PETSC_INCLUDES}
      )
-  
+
     ADD_DEFINITIONS(-DPETSC_VERSION_NUMBER=PETSC_VERSION_MAJOR*1000+PETSC_VERSION_MINOR*10)
-    
+
 ENDIF()
 
 ## Check MPI package
diff --git a/scripts/cmake/ProjectSetup.cmake b/scripts/cmake/ProjectSetup.cmake
index 40ae177c695..9cced7ef812 100644
--- a/scripts/cmake/ProjectSetup.cmake
+++ b/scripts/cmake/ProjectSetup.cmake
@@ -25,4 +25,6 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
 # Check if this project is included in another
 IF(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
 	SET(IS_SUBPROJECT ON INTERNAL)
-ENDIF()
\ No newline at end of file
+ENDIF()
+
+SITE_NAME(HOSTNAME)
diff --git a/scripts/cmake/test/Data.cmake b/scripts/cmake/test/Data.cmake
index 4b411d95c72..9378c095305 100644
--- a/scripts/cmake/test/Data.cmake
+++ b/scripts/cmake/test/Data.cmake
@@ -23,3 +23,21 @@ ADD_CUSTOM_TARGET(
 	-P ${PROJECT_SOURCE_DIR}/scripts/cmake/test/MoveDataToStore.cmake
 	VERBATIM
 )
+
+IF(HOSTNAME STREQUAL "envinf1.eve.ufz.de")
+	ADD_CUSTOM_TARGET(
+		sync-data
+		COMMAND ${CMAKE_COMMAND} -E copy_directory
+		${CMAKE_SOURCE_DIR}/../ogs6-data
+		/data/ogs/ogs6-data
+	)
+	IF(CURL_TOOL_PATH)
+		ADD_CUSTOM_COMMAND(
+			TARGET sync-data POST_BUILD
+			COMMAND ${CURL_TOOL_PATH} --insecure 'https://svn.ufz.de:8443/buildByToken/build?job=Tmp_Trigger&token=ogsbuild&cause=Triggered_by_sync-data_target_on_envinf1'
+			COMMENT "Triggered sync to opengeosys.org, see https://svn.ufz.de:8443/job/OGS-6/job/SyncExternalData"
+		)
+	ELSE()
+		MESSAGE(STATUS "curl tool was not found but is required for the sync-data target!")
+	ENDIF()
+ENDIF()
-- 
GitLab