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

Enable xz archives #1284

Merged
merged 3 commits into from
Apr 26, 2022
Merged

Enable xz archives #1284

merged 3 commits into from
Apr 26, 2022

Conversation

wt
Copy link
Contributor

@wt wt commented Apr 21, 2022

XZ archives are about half the size of the gz equivalents. This
improves the cold repo bootstrap case a fair amount.

Fixes: #871

@wt wt force-pushed the enable_xz_archives branch 8 times, most recently from 760f1d4 to 65b64b5 Compare April 21, 2022 06:55
@wt
Copy link
Contributor Author

wt commented Apr 21, 2022

The static rust environment variable is interfering with this since the url it adds ends up on the top of the list. I have removed it. It's not clear to me that the functionality is super useful since the default location for urls matches it. If it's needed, I would love some suggestions for how to deal with it.

@uhthomas
Copy link
Contributor

uhthomas commented Apr 21, 2022

Is it possible to use tar.zst instead?

Arch Linux switched from xz to zst because it decompresses significantly faster (~1300%), at the cost of slightly larger archives (~0.8%).

https://archlinux.org/news/now-using-zstandard-instead-of-xz-for-package-compression/

Though, I don't know if rust is actually archived with zst. Shame.

@wt
Copy link
Contributor Author

wt commented Apr 21, 2022

Are zstd archives supported by bazel? If so, the diff from here to there would be pretty small. There doesn't appear to be a programatic list of the archive types supported, so each much be added manually.

Assuming that is done, at the very least you can supply the sha256s manually to the register_rust_toolchains function.

Having said that, tar.zstd are not available from the rust distribution that I could find. Nothing would stop you from downloading an xz file and converting it to use zstd compression and distributing them from a web site.

@uhthomas
Copy link
Contributor

Are zstd archives supported by bazel?

Yep! :) The list of supported archives can be found with the http_archive documentation.

It supports the following file extensions: "zip", "jar", "war", "aar", "tar", "tar.gz", "tgz", "tar.xz", "txz", "tar.zst", "tzst", tar.bz2, "ar", or "deb".

Having said that, tar.zstd are not available from the rust distribution that I could find.

That is a shame, though I thought this might be the case. Thank you for considering my suggestion.

@wt
Copy link
Contributor Author

wt commented Apr 22, 2022

Find the files for download and it would be easy to add them to the fold. BTW, those archive formats are buried in many comments around bazel. It would be truly awesome if they were available programatically for extensions. If you wanted to create an issue to ask for that on the main bazel repo, feel free to tag me.

Also, if you can find the location of the .tar.zst files. The additional diff on top of this one would be pretty small.

Wren Turkal added 2 commits April 25, 2022 09:47
I have explicitly added keys for the files with the extension explicitly
on the file key. The point of this is to (in a future change) allow
tar.xz archives to be used instead of tar.gz archives.

This change keeps compatiblity with the old keys that assume the tar.gz
archives. I don't know if this is something that we should drop in the future
or just not worry about.
XZ archives are about half the size of the gz equivalents. This
improves the cold repo bootstrap case a fair amount.
@wt wt force-pushed the enable_xz_archives branch from 65b64b5 to 127dbc2 Compare April 25, 2022 16:47
@UebelAndre UebelAndre requested a review from illicitonion April 25, 2022 16:55
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@illicitonion illicitonion merged commit 841fc6f into bazelbuild:main Apr 26, 2022
@UebelAndre
Copy link
Collaborator

Cross posting from 841fc6f#commitcomment-72310891 to try and consolidate info on the PR.

cc @krasimirgg @wt

illicitonion pushed a commit that referenced this pull request Apr 28, 2022
The commit 841fc6f for #1284 broke the ability to use rust_register_toolchains with a nightly channel, see 841fc6f#commitcomment-72310891.
I tracked the issue down to this line which was updated there. While using a dated nightly, these variables look like:
* tool_path:  `rust-nightly-x86_64-unknown-linux-gnu`
* tool_suburl:  `2022-04-06/rust-nightly-x86_64-unknown-linux-gnu`

Using tool_suburl causes the extract to fail like in the comment above:
`Prefix "2022-04-06/rust-nightly-x86_64-unknown-linux-gnu/rustc" was given, but not found in the archive. Here are possible prefixes for this archive: "rust-nightly-x86_64-unknown-linux-gnu".`

Switching back to the old behaviour fixes the glitch. I'm not sure if this breaks novel use cases introduced by 841fc6f; @wt, could you please take a look.

On a sidenote, this is an instance where having some some build bot CI that uses nightly would have noticed this.
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.

Add chksums for tar.xz files
4 participants