Re: [cmake-developers] [PATCH v2] ExternalProject: Allow TLS_VERIFY for git clones

2016-04-06 Thread Brad King
On 04/01/2016 01:18 PM, Ben Boeckel wrote:
> On Fri, Apr 01, 2016 at 15:39:26 +0100, Samir Benmendil wrote:
>> Use the git config `http.sslVerify=false` to disable strict ssl for git
>> commands.
> 
> I've pushed this into next for testing.

FYI, the patch is now in 'master'.  However, I since realized that it
changes default behavior to TLS_VERIFY=OFF.  I've restored the default
behavior:

 ExternalProject: Tell Git not to verify certs only if TLS_VERIFY is OFF
 https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=23a71e4e

Now an explicit "TLS_VERIFY OFF" or setting CMAKE_TLS_VERIFY to
"OFF" will disable it but otherwise no special option will be passed
to `git clone`.

-Brad

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


Re: [cmake-developers] [PATCH v2] ExternalProject: Allow TLS_VERIFY for git clones

2016-04-01 Thread Ben Boeckel
On Fri, Apr 01, 2016 at 15:39:26 +0100, Samir Benmendil wrote:
> Use the git config `http.sslVerify=false` to disable strict ssl for git
> commands.
> ---
> Changes in v2:
> - git_options is now a list

Thanks.

I've pushed this into next for testing.

--Ben
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers


[cmake-developers] [PATCH v2] ExternalProject: Allow TLS_VERIFY for git clones

2016-04-01 Thread Samir Benmendil
Use the git config `http.sslVerify=false` to disable strict ssl for git
commands.
---
Changes in v2:
- git_options is now a list

 Modules/ExternalProject.cmake | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 1185a81..8d8382f 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -499,7 +499,7 @@ define_property(DIRECTORY PROPERTY "EP_UPDATE_DISCONNECTED" 
INHERITED
   "ExternalProject module."
   )
 
-function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE 
git_repository git_tag git_remote_name git_submodules src_name work_dir 
gitclone_infofile gitclone_stampfile)
+function(_ep_write_gitclone_script script_filename source_dir git_EXECUTABLE 
git_repository git_tag git_remote_name git_submodules src_name work_dir 
gitclone_infofile gitclone_stampfile tls_verify)
   file(WRITE ${script_filename}
 "if(\"${git_tag}\" STREQUAL \"\")
   message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -524,12 +524,18 @@ if(error_code)
   message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\")
 endif()
 
+set(git_options)
+if(NOT tls_verify)
+  list(APPEND git_options
+-c http.sslVerify=false)
+endif()
+
 # try the clone 3 times incase there is an odd git clone issue
 set(error_code 1)
 set(number_of_tries 0)
 while(error_code AND number_of_tries LESS 3)
   execute_process(
-COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" 
\"${git_repository}\" \"${src_name}\"
+COMMAND \"${git_EXECUTABLE}\" \${git_options} clone --origin 
\"${git_remote_name}\" \"${git_repository}\" \"${src_name}\"
 WORKING_DIRECTORY \"${work_dir}\"
 RESULT_VARIABLE error_code
 )
@@ -544,7 +550,7 @@ if(error_code)
 endif()
 
 execute_process(
-  COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+  COMMAND \"${git_EXECUTABLE}\" \${git_options} checkout ${git_tag}
   WORKING_DIRECTORY \"${work_dir}/${src_name}\"
   RESULT_VARIABLE error_code
   )
@@ -553,7 +559,7 @@ if(error_code)
 endif()
 
 execute_process(
-  COMMAND \"${git_EXECUTABLE}\" submodule init ${git_submodules}
+  COMMAND \"${git_EXECUTABLE}\" \${git_options} submodule init 
${git_submodules}
   WORKING_DIRECTORY \"${work_dir}/${src_name}\"
   RESULT_VARIABLE error_code
   )
@@ -562,7 +568,7 @@ if(error_code)
 endif()
 
 execute_process(
-  COMMAND \"${git_EXECUTABLE}\" submodule update --recursive ${git_submodules}
+  COMMAND \"${git_EXECUTABLE}\" \${git_options} submodule update --recursive 
${git_submodules}
   WORKING_DIRECTORY \"${work_dir}/${src_name}\"
   RESULT_VARIABLE error_code
   )
@@ -1777,6 +1783,11 @@ function(_ep_add_download_command name)
   set(git_remote_name "origin")
 endif()
 
+get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY)
+if(NOT tls_verify)
+  set(tls_verify OFF)
+endif()
+
 # For the download step, and the git clone operation, only the repository
 # should be recorded in a configured RepositoryInfo file. If the repo
 # changes, the clone script should be run again. But if only the tag
@@ -1801,7 +1812,7 @@ function(_ep_add_download_command name)
 #
 _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
   ${GIT_EXECUTABLE} ${git_repository} ${git_tag} ${git_remote_name} 
"${git_submodules}" ${src_name} ${work_dir}
-  ${stamp_dir}/${name}-gitinfo.txt 
${stamp_dir}/${name}-gitclone-lastrun.txt
+  ${stamp_dir}/${name}-gitinfo.txt 
${stamp_dir}/${name}-gitclone-lastrun.txt ${tls_verify}
   )
 set(comment "Performing download step (git clone) for '${name}'")
 set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitclone.cmake)
-- 
2.8.0

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers