[CMake] Prevent ExternalProject from updating git submodules
David Cole
DLRdave at aol.com
Tue Dec 6 09:47:18 EST 2016
If you customize DOWNLOAD_COMMAND, you should also probably customize
UPDATE_COMMAND. If you are just using a fixed snapshot from some repo,
consider simply using a *.tar.gz snapped to that commit rather than
connecting to the repo at all. The GitHub "/archive/" URLs are perfect
for this.
However, if you are still going to use some sort of git command for
DOWNLOAD_COMMAND, just use:
UPDATE_COMMAND ""
to prevent any git commands from running after the download step.
By the way, it's unclear to me: are you just trying to get something
to work for your project, or are you saying there's a bug in CMake
that needs to be dealt with regardless of what you do for your
project. The repo-based ExternalProject stuff assumes online status is
readily available... If that's not true, you shouldn't use the
repo-based ExternalProject stuff and instead use a "download
everything once to a local spot" and then thereafter use the local
stuff.
HTH,
David C.
On Sun, Dec 4, 2016 at 9:47 PM, Timothy Rae <timothy.rae at sbibits.com> wrote:
> I finally got a chance to try David's suggestion out, but unfortunately that
> doesn't work. I think the ExternalProject script is downloading the
> submodules in a separate step rather than via the "git clone --recursive"
> command.
>
> I simply mentioned the recursive clone as a way to reproduce the issue. You
> could also just set a local filesystem path as the GIT_REPOSITORY and
> disable the internet to reproduce:
>
> 1) git clone https://github.com/ericniebler/range-v3.git LOCAL_CLONE_DIR
> 2) Add ExternalProject_Add(range-v3 GIT_REPOSITORY LOCAL_CLONE_DIR) to a
> project
> 3) Disable the internet
> 4) Attempt to build
>
> ** Watch it hang, and you have to ctrl+c to exit **
>
>
> On 25/10/16 22:12, David Cole wrote:
>>
>> Sounds like you should consider customizing the git clone with
>> DOWNLOAD_COMMAND. You can do anything you want as a customization...
>>
>> HTH,
>> David
>>
>>
>> On Oct 24, 2016, at 11:35 PM, Timothy Rae <timothy.rae at sbibits.com
>> <mailto:timothy.rae at sbibits.com>> wrote:
>>
>>> Thanks for the tip, but I'd rather it didn't fetch the documentation
>>> submodule at all, as this unnecessarily slows down the build.
>>>
>>> On Tue, Oct 25, 2016 at 12:29 PM, Hendrik Sattler
>>> <post at hendrik-sattler.de <mailto:post at hendrik-sattler.de>> wrote:
>>>
>>> Hi,
>>>
>>> you can tell git where your copy of tree remote url is. This is
>>> site-specific and does not change the repository:
>>> git config remote."$origirl".url "$newurl"
>>>
>>> HS
>>>
>>>
>>> Am 25. Oktober 2016 03:52:12 MESZ, schrieb Tim Rae
>>> <timothy.rae at sbibits.com <mailto:timothy.rae at sbibits.com>>:
>>>
>>> >Hi all,
>>> >
>>> >I'm using ExternalProject_Add to add the popular C++ library
>>> range-v3
>>> >to
>>> >one of our projects. However, since the build server only has local
>>> >intranet access, and therefore can't access the main github
>>> repository,
>>> >
>>> >we have put a clone of that repo on our local gitlab:
>>> >
>>> >ExternalProject_Add(range-v3
>>> > PREFIX ${PREFIX_DIR}
>>> > GIT_REPOSITORY ${LOCAL_GITLAB_URI}
>>> >)
>>> >
>>> >The problem is that range-v3 has a documentation submodule that
>>> points
>>> >to github, so `git clone ${LOCAL_GITLAB_URI} --recursive` would fail
>>> >when github is inaccessible, whereas git clone works fine without
>>> the
>>> >recursive flag.
>>> >
>>> >I found a previous message from Tim Gallagher on the mailing list
>>> >reporting the same problem, but it looks like the issue was never
>>> >addressed upstream.
>>> >
>>> >https://cmake.org/pipermail/cmake/2015-March/060100.html
>>> <https://cmake.org/pipermail/cmake/2015-March/060100.html>
>>> >
>>> >Unfortunately, specifying GIT_SUBMODULES "" will add all
>>> submodules, so
>>> >
>>> >it doesn't appear that variable will help to solve the issue. I
>>> would
>>> >suggest either having a special value like "__NONE__", or having
>>> a new
>>> >boolean variable like INIT_GIT_SUBMODULES; either of which can be
>>> used
>>> >to disable the automatic initialization of submodules entirely.
>>> >
>>> >You could also change the default to NOT pull in submodules. This
>>> would
>>> >
>>> >be much better IMHO, as the current behavior is unintuitive. Most
>>> >developers (e.g. myself until yesterday) don't even know what a
>>> >submodule is, and are only familiar with using git clone, as
>>> opposed to
>>> >
>>> >git clone --recursive. Obviously this would be a breaking change
>>> >though,
>>> >so I understand that you probably don't want to go with this option.
>>> >
>>> >For now I have "solved" the problem by adding a new commit to our
>>> >range-v3 fork removing all git submodules, however this makes it
>>> more
>>> >difficult to get the upstream changes in, so I highly recommend
>>> adding
>>> >an option to disable the automatic initialization of git submodules.
>>> >
>>> >Best regards,
>>> >Tim
>>> >
>>> >--
>>> >*This correspondence (including any attachments) is for the intended
>>> >recipient(s) only. It may contain confidential or privileged
>>> >information or
>>> >both. No confidentiality or privilege is waived or lost by any
>>> >mis-transmission. If you receive this correspondence by mistake,
>>> please
>>> >
>>> >contact the sender immediately, delete this correspondence (and all
>>> >attachments) and destroy any hard copies. You must not use,
>>> disclose,
>>> >copy,
>>> >distribute or rely on any part of this correspondence (including any
>>> >attachments) if you are not the intended recipient(s). 本
>>> >メッセージに記載および添付されている情報 (以 下、総称して「本情
>>> 報」といいます。)は、本来の受信者による使用のみを 意
>>> >図しています。誤送信等により
>>> >本 情報を取得された場合でも、本情報に係る 秘 密、または法律上の秘
>>> 匿特権が失われるものではありません。本電子メールを 受
>>> >取られた方が、本来の受
>>> >信者ではない場合には、本情報及びそのコピー すべ てを削除・破棄
>>> し、本電子メールが誤って届い た旨を発信者宛てにご通知下さい ま
>>> >すようお願いしま
>>> >す。本情報の閲覧、発信または本情報に基づく いかなる行 為も明確に
>>> 禁止されていることをご了承くださ い。*
>>> >--
>>> >
>>> >Powered by www.kitware.com <http://www.kitware.com>
>>> >
>>> >Please keep messages on-topic and check the CMake FAQ at:
>>> >http://www.cmake.org/Wiki/CMake_FAQ
>>> <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
>>> <http://cmake.org/cmake/help/support.html>
>>> >CMake Consulting: http://cmake.org/cmake/help/consulting.html
>>> <http://cmake.org/cmake/help/consulting.html>
>>> >CMake Training Courses: http://cmake.org/cmake/help/training.html
>>> <http://cmake.org/cmake/help/training.html>
>>> >
>>> >Visit other Kitware open-source projects at
>>> >http://www.kitware.com/opensource/opensource.html
>>> <http://www.kitware.com/opensource/opensource.html>
>>> >
>>> >Follow this link to subscribe/unsubscribe:
>>> >http://public.kitware.com/mailman/listinfo/cmake
>>> <http://public.kitware.com/mailman/listinfo/cmake>
>>>
>>> --
>>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>>> gesendet.
>>>
>>>
>>>
>>> /This correspondence (including any attachments) is for the intended
>>> recipient(s) only. It may contain confidential or privileged
>>> information or both. No confidentiality or privilege is waived or lost
>>> by any mis-transmission. If you receive this correspondence by
>>> mistake, please contact the sender immediately, delete this
>>> correspondence (and all attachments) and destroy any hard copies. You
>>> must not use, disclose, copy, distribute or rely on any part of this
>>> correspondence (including any attachments) if you are not the intended
>>> recipient(s).本 メッセージに記載および添付されている情報 (以 下、総称
>>> して「本情報」といいます。)は、本来の受信者による使用のみを 意 図して
>>> います。誤送信等により 本 情報を取得された場合でも、本情報に係る 秘
>>> 密、または法律上の秘匿特権が失われるものではありません。本電子メールを
>>> 受 取られた方が、本来の受 信者ではない場合には、本情報及びそのコピー
>>> すべ てを削除・破棄し、本電子メールが誤って届い た旨を発信者宛てにご通
>>> 知下さい ま すようお願いしま す。本情報の閲覧、発信または本情報に基づ
>>> く いかなる行 為も明確に禁止されていることをご了承くださ い。/
>>> --
>>>
>>> Powered by www.kitware.com <http://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
>
>
>
> --
> *This correspondence (including any attachments) is for the intended
> recipient(s) only. It may contain confidential or privileged information or
> both. No confidentiality or privilege is waived or lost by any
> mis-transmission. If you receive this correspondence by mistake, please
> contact the sender immediately, delete this correspondence (and all
> attachments) and destroy any hard copies. You must not use, disclose, copy,
> distribute or rely on any part of this correspondence (including any
> attachments) if you are not the intended
> recipient(s).本メッセージに記載および添付されている情報(以下、総称して「本情報」といいます。)は、本来の受信者による使用のみを意図しています。誤送信等により本情報を取得された場合でも、本情報に係る秘密、または法律上の秘匿特権が失われるものではありません。本電子メールを受取られた方が、本来の受信者ではない場合には、本情報及びそのコピーすべてを削除・破棄し、本電子メールが誤って届いた旨を発信者宛てにご通知下さいますようお願いします。本情報の閲覧、発信または本情報に基づくいかなる行為も明確に禁止されていることをご了承ください。*
More information about the CMake
mailing list