diff options
author | Brad King <brad.king@kitware.com> | 2013-03-26 18:36:40 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-03-26 18:36:40 (GMT) |
commit | 169bba41f29169126673b801c8b535a62b0f634d (patch) | |
tree | c673945f84d71b1f3f7398c6586ee78898fc6062 | |
parent | c20f4dd62090a109c932c75030ea22771396a722 (diff) | |
parent | 118f741c495be8e244ad7d021623907d450d63ee (diff) | |
download | CMake-169bba41f29169126673b801c8b535a62b0f634d.zip CMake-169bba41f29169126673b801c8b535a62b0f634d.tar.gz CMake-169bba41f29169126673b801c8b535a62b0f634d.tar.bz2 |
Merge topic 'ep_retry_clone'
118f741 ExternalProject: Retry on a failed git clone
-rw-r--r-- | Modules/ExternalProject.cmake | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index bf2892b..40e14d5 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -287,11 +287,21 @@ if(error_code) message(FATAL_ERROR \"Failed to remove directory: '${source_dir}'\") endif() -execute_process( - COMMAND \"${git_EXECUTABLE}\" clone \"${git_repository}\" \"${src_name}\" - WORKING_DIRECTORY \"${work_dir}\" - RESULT_VARIABLE error_code - ) +# 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 \"${git_repository}\" \"${src_name}\" + WORKING_DIRECTORY \"${work_dir}\" + RESULT_VARIABLE error_code + ) + math(EXPR number_of_tries \"\${number_of_tries} + 1\") +endwhile() +if(number_of_tries GREATER 1) + message(STATUS \"Had to git clone more than once: + \${number_of_tries} times.\") +endif() if(error_code) message(FATAL_ERROR \"Failed to clone repository: '${git_repository}'\") endif() |