-
Notifications
You must be signed in to change notification settings - Fork 891
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 support for XZ-compressed packages #1100
Conversation
This looks great @ranma42. Thank you for pushing this through all the tooling. I do think there should be tests for xz compression in rustup. Unfortunately rustup's testing is fairly cumbersome. I think the simplest thing here is to just add some unit tests that the installation code works correctly with xz. The basic way to do this is to duplicate this test case, add a new 'xz' boolean to MockDistServer::write that causes the mock dist server to generate both the 'gz' and 'xz' tarballs and the appropriate keys in the manifest, and thread that call into the new test case. That will at least provide a smoke test that the xz fields work. |
Ok, I will try and add a test as suggested. |
xz = try!(TarXzPackage::new_file(&installer_file, temp_cfg)); | ||
&xz | ||
} | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is quite a fascinating pattern, leaving one local uninitialized. I did not know that was possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rustc
does not complain, but I guess it might be regarded as bad practice.
It is easy to transform this in a single local that is always assigned by wrapping the two cases in an enum, if it is preferred.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good as is, thanks.
@ranma42 I don't have a better suggestion for that offhand. |
I updated the lzma-sys package (to fix some linking/crosscompiling issues) and added a test. |
For that one specific test could the xz tarball have different files than the gz tarball, and then you assert that the xz-specific files exist? |
That is apparently not so easy, because only the contents listed in the |
@ranma42 what about running |
@Diggsey I tried to implement your suggestion and it seems to work locally, but somehow my new commit fails badly on the CI services |
@ranma42 I'm not sure, but while trying to reproduce locally, I ran into this other issue: I'm not keen on making rustup (even) harder to build on windows... |
Taking a look at the travis logs, it says:
I was able to check out this PR's branch locally and attempt to build, since I'm not on windows and not hitting the issue @Diggsey is. I'm indeed able to reproduce the error happening on travis. I reset Cargo.lock, then did diff --git a/Cargo.lock b/Cargo.lock
index 0602c7b..324ff53 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -345,12 +345,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "lzma-sys"
-version = "0.1.3"
+version = "0.1.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
"gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)",
- "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)",
+ "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -997,7 +997,7 @@ name = "xz2"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "lzma-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "lzma-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[metadata]
@@ -1038,7 +1038,7 @@ dependencies = [
"checksum libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)" = "babb8281da88cba992fa1f4ddec7d63ed96280a1a53ec9b919fd37b53d71e502"
"checksum libz-sys 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c18b5826abbfafb0160b37e1991e2d327c1fe38c955e496ea306f72c06d7570c"
"checksum log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ab83497bf8bf4ed2a74259c1c802351fcd67a65baa86394b6ba73c36f4838054"
-"checksum lzma-sys 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c5eaaa53b35fa17482ee2c001b04242827b47ae0faba72663fee3dee32366248"
+"checksum lzma-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "fedff6a5cbb24494ec6ee4784e9ac5c187161fede04c7767d49bf87544013afa"
"checksum markdown 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bdb7e864aa1dccbebb05751e899bc84c639df47490c0c24caf4b1a77770b6566"
"checksum matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "15305656809ce5a4805b1ff2946892810992197ce1270ff79baded852187942e"
"checksum memchr 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d8b629fb514376c675b98c1421e80b151d3817ac42d7c667717d282761418d20" @ranma42 I'm guessing there was a merge conflict to Cargo.lock at some point? Can you try checking out the changes your branch makes to Cargo.lock, then building, then checking in Cargo.lock again? |
@carols10cents it was not a merge conflict in the sense of git (it would have been marked as such by github), but in a sense that was the problem. Thank you for helping out diagnosing the problem! @Diggsey what is the best way forward regarding alexcrichton/xz2-rs#6 ? |
@ranma42 I'm working on a fix for the xz2 issue, then we can get this merged. |
☔ The latest upstream changes (presumably #1131) made this pull request unmergeable. Please resolve the merge conflicts. |
When XZ-compressed packages are available, prefer them in place of the GZip-compressed ones as they can provide significant savings interms of download size.
Why does AppVeyor report the branch as non-mergeable? (I rebased, upgraded lzma-sys and force-pushed) |
No idea :/ Let's give bors a try. @bors r+ |
📌 Commit f3aeab3 has been approved by |
Add support for XZ-compressed packages When XZ-compressed packages are available, prefer them in place of the GZip-compressed ones as they can provide significant savings interms of download size. This should be the last step towards fixing rust-lang/rust#21724
💔 Test failed - status-travis |
@bors retry |
Add support for XZ-compressed packages When XZ-compressed packages are available, prefer them in place of the GZip-compressed ones as they can provide significant savings interms of download size. This should be the last step towards fixing rust-lang/rust#21724
☀️ Test successful - status-appveyor, status-travis |
When XZ-compressed packages are available, prefer them in place of the
GZip-compressed ones as they can provide significant savings interms
of download size.
This should be the last step towards fixing rust-lang/rust#21724