Skip to content
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

Support pre-fetched deps for nix. #2403

Merged
merged 1 commit into from
Oct 21, 2020
Merged

Support pre-fetched deps for nix. #2403

merged 1 commit into from
Oct 21, 2020

Conversation

jechol
Copy link
Contributor

@jechol jechol commented Oct 20, 2020

Downloading dependencies during build is not possible in some environments like nix.
Nix pre-download all the deps into _build/default/lib and disable internet access during build.

So, _build/default/lib shouldn't be deleted at startup.

@tsloughter
Copy link
Collaborator

This is useful when developing, which is the main place bootstrap is used. Why does nix not download a release of rebar3 instead of bootstrapping the source?

@jechol
Copy link
Contributor Author

jechol commented Oct 20, 2020

@tsloughter Nix is pure, immutable package manager, so it build every binaries with very deterministic way.

It pre-fetches dependencies (nix community have developed functions that emulates what packages managers like npm, gem, hex does) and verifies checksum, and then disable internet access during actual build process. And it works really well and built binaries are bit-wise same for every machine.

But it means that rebar3 dependencies should be pre-fetched into _build and it is not downloadable if deleted during bootstrap is executing.

@ferd
Copy link
Collaborator

ferd commented Oct 20, 2020

Leaving the stuff that is in _build/default causes issues for non-nix users whenever we change compiler modules and run a re-build, as the project in the process of re-building itself starts loading older compiler module versions and crashing. I added that line to specifically address this workflow, since bootstrap cleaning saved us quite a few issues and our users a bunch of unexpected deep dives.

This caused a spate of issues for everyone else who builds from regular OSes when we moved from 3.13.x to 3.14 pre-releases because they expected the process to be clean.

There's no proper way to resolve this issue in a way that makes everyone happy.

@tsloughter
Copy link
Collaborator

I was going to suggest a DEV_MODE os var that is default true and can be set to false to not delete everything on bootstrap.

@pablocostass
Copy link
Contributor

pablocostass commented Oct 20, 2020

Was about to pitch in to suggest an OS var too

@ferd
Copy link
Collaborator

ferd commented Oct 20, 2020

It might make more sense to actually just drop the _build/**/lib/rebar directories and solve both. Lockfile checks will automatically drop dependencies that could otherwise cause issue on the bootstrap's second full compilation pass.

@tsloughter
Copy link
Collaborator

True.

@jechol
Copy link
Contributor Author

jechol commented Oct 20, 2020

@ferd Agree.

@jechol
Copy link
Contributor Author

jechol commented Oct 21, 2020

PR is changed to just drop _build/default/lib/rebar. Please review again.

@ferd ferd merged commit 22a6b19 into erlang:master Oct 21, 2020
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

Successfully merging this pull request may close these issues.

4 participants