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

Add zstd support #2676

Merged
merged 4 commits into from
Feb 27, 2021
Merged

Add zstd support #2676

merged 4 commits into from
Feb 27, 2021

Conversation

kinnison
Copy link
Contributor

@kinnison kinnison commented Feb 21, 2021

This builds atop #2675 and adds support for ZStd compression, both to rustup and to the test suite.

This fixes #2488 and in theory goes some way toward #1858 though given this is a linear preference of zst over xz over gz it's not entirely a fix.

This patch assumes it's okay to insert zstd into manifest v2 files without bumping the manifest version. It follows the xz_tar pattern with zst_tar et al. Also since it builds atop the refactor in #2675 it doesn't require that gz still be present, paving the way for seamless conversion from gz+xz, via some combination of gz+(xz and/or zst) to a pure zst manifest if that is of interest to the infra team.

I'd appreciate opinions from @rust-lang/infra on this - should we bump the manifest version since this implicitly makes the gz files optional?

Copy link
Contributor

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

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

I think the 'prefer X under Y circumstance thing can reasonably be added later. I have some review bits that should be addressed.

gz is already implicitly optional in the current code.

src/dist/manifestation.rs Outdated Show resolved Hide resolved
tests/dist.rs Outdated Show resolved Hide resolved
tests/dist.rs Show resolved Hide resolved
tests/dist.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@rbtcollins rbtcollins left a comment

Choose a reason for hiding this comment

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

More suggestions but nothing that prevents merging.

tests/dist.rs Outdated Show resolved Hide resolved
@@ -153,6 +155,11 @@ impl MockDistServer {
} else {
None
};
let zst_hash = if enable_zst {
Copy link
Contributor

Choose a reason for hiding this comment

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

This to me looks like a loop trying to break free. Something for the future I guess.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it'll be nice to make this more generic and loopy in the future.

@@ -356,6 +364,13 @@ impl MockDistServer {
);
toml_target.insert(String::from("xz_hash"), toml::Value::String(xz_hash));
}
if let Some(zst_hash) = hash.zst {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't the dist abstraction write this out ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll admit I lazily extended what existed already. We can certainly log to refactor this part of the tests.

@@ -466,6 +482,10 @@ fn create_tarball(relpath: &Path, src: &Path, dst: &Path) -> io::Result<()> {
xzwriter = xz2::write::XzEncoder::new(outfile, 0);
&mut xzwriter
}
s if s.ends_with(".tar.zst") => {
Copy link
Contributor

Choose a reason for hiding this comment

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

These blocks here look like an enum trying to break free

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I wasn't terribly happy about duplicating this code, but again I think the refactor can come later.

Signed-off-by: Daniel Silverstone <[email protected]>
If the manifest contains zst_tar and zst_hash then treat them
as ZStd compressed data.

Signed-off-by: Daniel Silverstone <[email protected]>
Signed-off-by: Daniel Silverstone <[email protected]>
@kinnison
Copy link
Contributor Author

I've rebased this and added the refactor of the initial_install* functions.

@kinnison kinnison merged commit cc20b7e into rust-lang:master Feb 27, 2021
@kinnison kinnison deleted the add-zstd-support branch February 27, 2021 10:30
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 support for .zst for component tarballs in channels
2 participants