[Cmake-commits] CMake branch, next, updated. v3.4.1-1981-g39120bf

Brad King brad.king at kitware.com
Fri Jan 15 14:21:32 EST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  39120bfffe6b2f24cc488bfacf37bc5ca60f5718 (commit)
       via  83d633919a75bde05acdf642ff79c5b310fce824 (commit)
      from  1f83d8a365ec1859b59c596d275fe431126ea63f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=39120bfffe6b2f24cc488bfacf37bc5ca60f5718
commit 39120bfffe6b2f24cc488bfacf37bc5ca60f5718
Merge: 1f83d8a 83d6339
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Fri Jan 15 14:21:31 2016 -0500
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Fri Jan 15 14:21:31 2016 -0500

    Merge topic 'ExternalProject-git-clone-o' into next
    
    83d63391 ExternalProject: Add option to set `git clone -o` argument


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=83d633919a75bde05acdf642ff79c5b310fce824
commit 83d633919a75bde05acdf642ff79c5b310fce824
Author:     Adam Rankin <adam.rankin at gmail.com>
AuthorDate: Fri Jan 15 12:34:46 2016 -0500
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Fri Jan 15 14:20:04 2016 -0500

    ExternalProject: Add option to set `git clone -o` argument
    
    Add a `GIT_REMOTE_NAME` option to `ExternalProject_Add` to support
    
      git clone --origin <name>
    
    Default to `origin` if not specified.

diff --git a/Help/release/dev/ExternalProject-git-clone-o.rst b/Help/release/dev/ExternalProject-git-clone-o.rst
new file mode 100644
index 0000000..c9ff3e1
--- /dev/null
+++ b/Help/release/dev/ExternalProject-git-clone-o.rst
@@ -0,0 +1,5 @@
+ExternalProject-git-clone-o
+---------------------------
+
+* The :module:`ExternalProject` module learned a new ``GIT_REMOTE_NAME``
+  option to control the ``git clone --origin`` value.
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index c822bdb..5c5c54a 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -57,6 +57,8 @@ Create custom targets to build projects in external trees
     URL of git repo
   ``GIT_TAG <tag>``
     Git branch name, commit id or tag
+  ``GIT_REMOTE_NAME <name>``
+    The optional name of the remote, default to ``origin``
   ``GIT_SUBMODULES <module>...``
     Git submodules that shall be updated, all if empty
   ``HG_REPOSITORY <url>``
@@ -494,7 +496,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_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)
   file(WRITE ${script_filename}
 "if(\"${git_tag}\" STREQUAL \"\")
   message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
@@ -524,7 +526,7 @@ 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}\"
+    COMMAND \"${git_EXECUTABLE}\" clone --origin \"${git_remote_name}\" \"${git_repository}\" \"${src_name}\"
     WORKING_DIRECTORY \"${work_dir}\"
     RESULT_VARIABLE error_code
     )
@@ -645,7 +647,7 @@ endif()
 endfunction()
 
 
-function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_submodules git_repository work_dir)
+function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_remote_name git_submodules git_repository work_dir)
   if(NOT GIT_VERSION_STRING VERSION_LESS 1.7.6)
     set(git_stash_save_options --all --quiet)
   else()
@@ -687,7 +689,7 @@ if(\"\${show_ref_output}\" MATCHES \"refs/remotes/${git_tag}\")
   set(git_remote \"\${CMAKE_MATCH_1}\")
   set(git_tag \"\${CMAKE_MATCH_2}\")
 else()
-  set(git_remote \"origin\")
+  set(git_remote \"${git_remote_name}\")
   set(git_tag \"${git_tag}\")
 endif()
 
@@ -1749,6 +1751,11 @@ function(_ep_add_download_command name)
     endif()
     get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES)
 
+    get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME)
+    if(NOT git_remote_name)
+      set(git_remote_name "origin")
+    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
@@ -1772,7 +1779,7 @@ function(_ep_add_download_command name)
     # The script will delete the source directory and then call git clone.
     #
     _ep_write_gitclone_script(${tmp_dir}/${name}-gitclone.cmake ${source_dir}
-      ${GIT_EXECUTABLE} ${git_repository} ${git_tag} "${git_submodules}" ${src_name} ${work_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
       )
     set(comment "Performing download step (git clone) for '${name}'")
@@ -1993,9 +2000,13 @@ function(_ep_add_update_command name)
     if(NOT git_tag)
       set(git_tag "master")
     endif()
+    get_property(git_remote_name TARGET ${name} PROPERTY _EP_GIT_REMOTE_NAME)
+    if(NOT git_remote_name)
+      set(git_remote_name "origin")
+    endif()
     get_property(git_submodules TARGET ${name} PROPERTY _EP_GIT_SUBMODULES)
     _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
-      ${GIT_EXECUTABLE} ${git_tag} "${git_submodules}" ${git_repository} ${work_dir}
+      ${GIT_EXECUTABLE} ${git_tag} ${git_remote_name} "${git_submodules}" ${git_repository} ${work_dir}
       )
     set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
     set(always 1)

-----------------------------------------------------------------------

Summary of changes:
 Help/release/dev/ExternalProject-git-clone-o.rst |    5 +++++
 Modules/ExternalProject.cmake                    |   23 ++++++++++++++++------
 2 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 Help/release/dev/ExternalProject-git-clone-o.rst


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list