Skip to content

Redundant cloning of git submodules #30107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MagaTailor opened this issue Nov 29, 2015 · 3 comments
Closed

Redundant cloning of git submodules #30107

MagaTailor opened this issue Nov 29, 2015 · 3 comments

Comments

@MagaTailor
Copy link

When building from git source, the build system makes a deep clone of git submodules, even those, like jemalloc or llvm, that had been disabled with configure options. (--disable-jemalloc and --llvm-root respectively)

Not downloading a couple hundred megabytes of data spread over tens of thousands of small files is especially important on flash devices (and slow connections).

@Aatch
Copy link
Contributor

Aatch commented Nov 30, 2015

At the very least it should probably do a shallower clone of those repos. As best I can tell, you should be able to just pass --depth 1 to git submodule update just fine.

@MagaTailor
Copy link
Author

Yep, that would be a great start. However the gist of this report is to completely forego downloading the source trees that are never going to be used.

japaric pushed a commit to japaric/rust that referenced this issue Aug 28, 2016
With this commit, if one bootstraps rust against system llvm then the
src/llvm submodule is not updated/checked-out. This saves considerable
network bandwith when starting from a fresh clone of rust-lang/rust as
the llvm submodule is never cloned.

cc rust-lang#30107
bors added a commit that referenced this issue Aug 29, 2016
rustbuild: smarter `git submodule`-ing

With this commit, if one bootstraps rust against system llvm then the
src/llvm submodule is not updated/checked-out. This saves considerable
network bandwith when starting from a fresh clone of rust-lang/rust as
the llvm submodule is never cloned.

cc #30107

r? @alexcrichton
cc @petevine

~~We could also avoid updating the jemalloc submodule if --disable-jemalloc is used. It just hasn't been implemented.~~ Done

This probably doesn't handle "recursive" submodules correctly but I think we don't have any of those right now.

I'm still testing a bootstrap but already confirmed that the llvm submodule doesn't get updated when `--llvm-root` is passed to `configure`.
@MagaTailor
Copy link
Author

@japaric I've just tested your patch, having done a rust shallow clone first and llvm is not cloned at all but jemalloc still is. Still, a huge improvement; thanks!

I also paid attention to the amount of data downloaded by fully cloning other modules, like compiler-rt, liblibc, etc. and it seems bootstrapping from a source snapshot is still the fastest option, requiring a 50% smaller download.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants