-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Really avoid redundant downloads when bootstrapping #36069
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
Conversation
Follow-up fix of ab5309e This also fixes packaging for source distros that don't allow fetching during build-time, which was unconditionally done for the sha256 file.
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Thanks for the PR! This looks pretty good to me, but I think that with normal use the |
Oh right and the other piece is that if we need to invalidate the previously downloaded artifact when we update the source to bootstrap from a new compiler. Previously I believe that happened because we'd download a new checksum file, but now it looks like we may cache the old checksum fail and forget to see the update? |
Hm, I'm unable to follow here. What do you mean with |
The checksum file has the same filename as the tarball, except for the file extension:
So when a new bootstrap compiler is used, both the tarball of the compiler and the sha256 file will have different file names and so the old ones will not be used. |
Hm so yeah I think my concern isn't relevant because of the first piece of behavior, never caching sha256 by default. My latter concern stems from the fact that filenames don't always change, for example the master branch bootstraps from the beta compiler which always has the same filename. I guess that not caching the sha256 is fine, but this seems like very magical behavior where "if you happen to place some magical files here we'll avoid downloading things." As in, that's a code path which isn't tested but us at all, so it'd be very likely to break :( Another point is that for offline builds I was under the impression that's what |
I only see
Actually, the but the tarball is cached, because of this The latter was already the case before this patch, so I don't know what the desired behavior is here. So currently:
|
Ok sorry for the runaround a bit, but I think this is starting to make sense to me. It sounds like you're doing something that unfortunately is not supported by us or our build system, which is attempting to pre-download a snapshot compiler and then hope the build system doesn't try to do it again. For distros it is our assumption that this logic will never be used, but rather the |
no, how would I bootstrap without a local rust? |
Yes to bootstrap the compiler you need to download something from somewhere. It sounds like you're arranging for some bootstrap compiler to be available, but you can just pass |
So you are basically telling me to recreate the logic of your bootstrapping scripts manually? That's really distro friendly. |
@hasufell oh no, not at all! That would indeed be quite difficult! Instead what you can do is the equivalent of: # Download the previous compiler, e.g. 1.12.0 from somewhere
$ curl https://sh.rustup.rs | sh -s -- --default-toolchain 1.12.0
# Configure rust to build with that compiler
$ ./configure --local-rust-root=$(rustc --print sysroot)
$ make That is, any standard layout of the compiler works just fine, you just need to point the build system at it. |
What your example suggests is:
You do not seem familiar with packaging rules/mechanisms and I don't blame you. But this debate is getting annoying. The current bootstrapping mechanisms of rust are fine, except for this tiny bit that can be easily fixed with the provided patch. I'm starting to feel my time is being wasted here. |
Sorry I think I may be failing to explain something here, let me see if I can try again! So the constraint here, as I understand it, is that a distro wants to be able to build Rust without the build process itself downloading anything. Right now it sounds like you're doing this by placing a tarball in the right place it "works" except for the fact that we download a sha256 checksum file. My point, however, is that this is not the interface we support for avoiding downloads as part of the build process. What's happening here is that you're arranging for the bootstrap compiler to be available ahead of time through your own build system. Instead, however, you'll need to just arrange for the bootstrap compiler to be unpacked somewhere. Once that's done, you can pass the Once you've configured with Does that make sense? I believe that's the strategy that other distributions like Debian and Fedora are using as well, and we were at least under the impression that if it works there it should work for everyone, but that may not be the case! |
No, they are not, debian is even applying something similar to this PR: Fedora is also applying bootstrapping patches: http://pkgs.fedoraproject.org/cgit/rpms/rust.git/tree/ So your information is clearly wrong. In addition, you are comparing binary distos to source distros, which does not make sense. They have different set of rules. Source distros don't ship binaries and as such, bootstrapping happens on the user machine.
It doesn't even work cleanly on debian and fedora. So, can you present a proper argument without guessing what distros do or what problems distros have? |
It looks to me like there's a disconnect between how we expected packagers to use the build system for bootstrapping and how they are in practice. If you look at Debian's build script, you can see that they do use @hasufell Does that sound like a correct assessment of the situation to you? From the way the build system is constructed today, we would instead expect those tarballs that are being placed in But they are not doing that, and @hasufell is disinclined to do that as well. So the obvious question is "why"? Just from the description of the process I gave, I might expect that the answer is "because the way they are doing it is easier", but we should probably go to the source and ask. @infinity0 @sylvestre I wonder if you could say something about how Debian is doing their initial bootstrap from upstream, and why. As described in this comment and previous in the thread, we expect that bootstrap to be possible via My guess is that using the existing stage0 cache structure is just more convenient to do, and if so we should be providing more facilities in-tree for creating this arrangement. Just as one idea, we could create a build system command for creating on offline-bootstrap tarball, that produced this same effect, but using a different short-circuiting mechanism that avoids the problems @acrichto is concerned with. @hasufell Are you doing packaging for a distro? If so, do you mind saying which and linking to the scripts you have so we can compare to what Debian is doing? The language in your op, "this also fixes packaging for source distros", sounds as though you may have multiple motivations for wanting this short-circuiting. If that's the case, do you mind expanding on what use-cases this patch supports beyond bootstrapping for distros? |
Rust's build scripts unconditionally download the hash file, because (I guess) you guys want the freedom to re-define the bootstrap compiler during development, and you want to make sure old bootstraps are always obsoleted when updating a git checkout. This does indeed require network access. For Debian, as you noticed, we are patching away this "unconditionally download" and instead making the build scripts use what's already there. However, this is logically contradictory to the requirement mentioned above, and that is why I marked the patch as I personally am OK with rust not accepting this PR and us at Debian patching it away specifically like we're currently doing. Another option would be to make this PR dependant on an environment variable, then we at Debian (as well as the OP) could set this during the build. |
Or, instead of requiring an envvar, detect the existence of ".git", and change the behaviour (always-download-the-hash vs reuse-existing-hash-on-filesystem) based on this. |
This discussion is useless and wasting my time. |
Follow-up fix of ab5309e
This also fixes packaging for source distros that don't allow
fetching during build-time, which was unconditionally done for
the sha256 file.