-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
test(travis): Test build with minimal versions #5275
Conversation
The first build error with competing curl versions can be solved by bumping the curl version. Now I'm falling a bit into a rabbit hole with lots of dependencies that need to yank their broken old versions from crates.io. Started with rust-lang/libz-sys#36 |
@klausi I think that rather than yanking, we should probably just bump minimal dependencies across the board? For example, we can say |
The counter argument to that is then that all libraries across the Rust ecosystem need to update their minimum requirements for old package versions that are broken anyway. In servo/rust-url#441 @SimonSapin decided to rather yank broken packages from crates.io, which makes a lot of sense to me. |
Probably! Personally, I wouldn't be too worried about checking with That said, |
For what it’s worth, those versions were published before Rust 1.0.0 and relevant changes to the crate were accounting for breaking changes in the language. Today this would be similar to a crate that requires unstable features, where the ecosystem’s convention is to update to new Rust in non-SemVer-breaking version nubmers. |
Agreed that fixing their weird minimal versions in curl-rust also makes sense, opened alexcrichton/curl-rust#205 We can tackle this on multiple fronts :) In the future every Rust library should add something like |
Thanks for the PR @klausi! I think though that this PR is mostly showing that we're not quite ready for this option. One of the reasons we considered adding this was to ensure that everyone's "lower bound" in their Cargo.toml was correct as our suspicion was that it wasn't correct for many many projects. Clearly that appears to be the case! I'm not so sure that we should test this for Cargo itself, but rather fix issues as they come up. Perhaps one day we may be able to do this on Cargo's own CI but I think for now we won't be able to. I'll comment on some of the assorted issues as well, but I think that yanking probably isn't the right approach here but rather the intended solution to this was updating the minimum version required in |
Note that as part of the "multiple fronts" this @alexcrichton I agree we should work on things as they come up. As crates try and use this feature, that should demand that their dependencies do it to, that is just how these things will come up. Also cargo as a library should be using this feature. I.E. this PR may take a long time to land but it should get implemented. @klausi thanks for thinking of this! |
To remove the dep on libc:0.1.0 |
makes sense to me! |
I'm currently trying to make progress by testing crates (and cargo itself) with
(see also rust-lang/crates.io#7310 for the reason why I run my fork of the registry). cargo fails to build with this because curl-sys has broken minimum dependencies. 2 ways to fix this:
|
dc4e4b3
to
340acc5
Compare
I managed to compile cargo now with minimum dependency versions, yay! I modified the Travis config to test that with my registry index fork.
If this passes then I think we can spin out the Cargo.toml dependency changes to a separate pull request and leave this for automating the minimal version check with Travis CI. |
Cargo.toml
Outdated
crypto-hash = "0.3" | ||
curl = "0.4.6" | ||
env_logger = "0.5" | ||
crypto-hash = ">=0.3.1, <0.4.0" |
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 could be crypto-hash = "0.3.1"
I think. We actually have an issue about linting against <
versions #5340 :)
I believe
|
☔ The latest upstream changes (presumably #5379) made this pull request unmergeable. Please resolve the merge conflicts. |
… minimal versions
…ed to build cargo
340acc5
to
6760478
Compare
Oh, you are totally right! I misunderstood how the version ranges work below 1.x and we should be good with specifying "0.x.y" in all cases. I also had to bump tar because earlier versions want to use winapi 0.0.x which does not compile anymore. |
You're not the first person to be confused by that, if you have ideas for what would make it clear since that might make a good PR. :-) |
Cool, that one was merged! The remaining task here is now to establish a Travis CI config that ensures Cargo's minimal dependency versions keep compiling successfully in the future. In order for that to happen we need:
After that all crates should be able to throw this into their CI config:
|
You can’t assume everyone uses the latest version of Cargo. Some people will keep using older versions, and those versions still need to be able to read the index and publish new crates. |
@klausi I am trying to understand what needs to be done to move this forward. I see we use custom registry here, to work around the After that we should be ready to merge it? |
Unfortunately I think this will take some time until we can finish this. We need to do the steps 1. -3. I mentioned above. That will not stop people from still publishing crates without the "links" attribute. 2 options to solve this:
|
Hm, my understanding that only ancient (pre-Rust 1.0) versions of Cargo don't set That is, I still don't think we need to change anything in Cargo to move this forward, we only need to make sure that Cargo dependencies don't depend on ancient stuff like |
@matklad oh FWIW publishing |
Should we perhaps close this PR in favor of the tracking issue for now? |
I think they are separate, this is on adding minimal-versions to cargos CI, the tracking issue is on stabilizing the flag and messaging around that. |
True! But this is also testing the ability for a published Cargo to build with this flag rather than the in-tree version? Additionally I figured we may want to close until the standard registry has been fixed up |
My impression is that what is preventing the mass fixing of the standard registry is your opposition. Nor have I heard an alternative for dealing with the conflicting sys crates issues. In general if all my dependents can build with |
This happens because old versions of
That is, I think the problem is solvable by sending some PRs upstream, without modifying the registry? |
You are technically correct. The best kind of correct. |
Hm, yeah... Like, every transitive rev-dep should be bumped, which I think in practice means every crate. At least, we can't have worse churn :-) OTOH, I think the amount of churn will be massive even if we somehow fix the links issue: #5657 (comment) says that anything that depends on |
But for non sys crates like log, there are workarounds. If anything in my dependency tree uses a |
Er well so I personally continue to feel that there's no need to mass update the registry, I feel like just not enough work has gone into fixing this in the ecosystem. If something is blocked on core sys crates like |
I think I've published enough crates now that if libgit2-sys's dependency version is updated to 0.7.5 in Cargo that should do the trick and we can build with minimal-versions |
You claim the sys mess can be fix by new releases, I am sceptical so you demonstrate that it works. 😄 Well the proof is in the pudding. If it works it works and I am convinced. 😄 I was also thinking, how can a dependency tree depend on two semver versions of an sys crate? Why can that build at all? The answer the sys crates needs to be imported by a non semver respecting version_req. So this problem should be much smaller than I was thinking. So ya if you dep on an sys don't do it like |
Confirmed that Cargo builds with index e9d45290..23a930b2 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -27,7 +27,7 @@ failure = "0.1.1"
filetime = "0.2"
flate2 = "1.0"
fs2 = "0.4"
-git2 = "0.7.0"
+git2 = "0.7.2"
git2-curl = "0.8.1"
glob = "0.2.11"
hex = "0.3"
@@ -37,7 +37,6 @@ lazy_static = "1.0.0"
jobserver = "0.1.9"
lazycell = "1.0"
libc = "0.2"
-libgit2-sys = "0.7.1"
log = "0.4"
num_cpus = "1.0"
same-file = "1"
@@ -54,6 +53,8 @@ toml = "0.4.2"
url = "1.1"
clap = "2.31.2"
unicode-width = "0.1.5"
+libssh2-sys = "0.2.8"
+libgit2-sys = "0.7.5"
# Not actually needed right now but required to make sure that rls/cargo build
# with the same set of features in rust-lang/rust EDIT: 🎉 |
With that change |
Ah yeah I was just testing on Linux, it may still be broken on Windows! |
adding |
We should make sure that cargo itself builds successfully with minimal dependency versions. Not sure this is the correct place in the Travis config, let me know if this should be added somewhere else.
This should currently fail because
This is not good because
cargo update -Z minimal-versions
should produce a setup that is always able to be built. This can have 2 causes:cargo update -Z minimal-versions
is broken and should work differently