cargo icon indicating copy to clipboard operation
cargo copied to clipboard

cargo build tries to download packages

Open engstad opened this issue 10 years ago • 7 comments

When issuing

cargo build

It will install packages from the internet. From my very slow internet connection, that is no good.

engstad avatar Dec 18 '15 19:12 engstad

If you have dependencies, this is expected behavior, yes. Otherwise, how would you get them?

If you've already downloaded said dependencies, though, it should not.

steveklabnik avatar Dec 18 '15 19:12 steveklabnik

Yeah as @steveklabnik mentioned this is expected behavior because the dependencies need to come from somewhere, so I'm going to close this as working as intended.

alexcrichton avatar Dec 18 '15 20:12 alexcrichton

Perhaps I wasn't clear? I asked cargo to build not to download. If it needs to download, I expect that to be another command. If the command auto-downloads, it should be reflected in the command. Even better would be if there was some kind of configuration saying "I don't want to download automatically". If download is needed, it will instead error, saying something like:

cargo needs to download package xxxx-0.3, if this was intended pass --allow-download to cargo build

engstad avatar Dec 18 '15 22:12 engstad

Ah yeah there are a number of other issues in the repo about intentionally telling Cargo to not touch the network, such as https://github.com/rust-lang/cargo/issues/2111

alexcrichton avatar Dec 18 '15 22:12 alexcrichton

I think the way that git does it is quite good. There is an explicit command to download (and sync) anything. I feel that cargo does too much with the commands. For instance, I might not care that the up-streams have released new versions - why then should cargo check for it?

engstad avatar Dec 18 '15 22:12 engstad

For instance, I might not care that the up-streams have released new versions - why then should cargo check for it?

It doesn't. I think you may be conflating a few different behaviors here.

If you don't have the requirements to build, cargo build will go get them. Yes, in theory, we could make it two commands, but that introduces friction for the majority case at the expense of the minority case.

If you do have the requirements, then it shouldn't check the network. There may be bugs, and they should be fixed.

steveklabnik avatar Dec 18 '15 23:12 steveklabnik

Yes, I may have been bitten by previous bugs. I just remember the network being off-line, I had all the files in the registry already, yet still I couldn't build because cargo tried to sync to the latest. I'll check it again.

engstad avatar Dec 18 '15 23:12 engstad