mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
Don't install pre-releases by default
This commit is contained in:
parent
5db0d51279
commit
658343aa10
@ -475,7 +475,11 @@ where
|
||||
None => None,
|
||||
};
|
||||
let vers = vers.as_ref().map(|s| &**s);
|
||||
let dep = Dependency::parse_no_deprecated(name, vers, source.source_id())?;
|
||||
let dep = Dependency::parse_no_deprecated(
|
||||
name,
|
||||
Some(vers.unwrap_or("*")),
|
||||
source.source_id(),
|
||||
)?;
|
||||
let deps = source.query_vec(&dep)?;
|
||||
match deps.iter().map(|p| p.package_id()).max() {
|
||||
Some(pkgid) => {
|
||||
|
@ -113,17 +113,20 @@ error: some crates failed to install
|
||||
|
||||
#[test]
|
||||
fn pick_max_version() {
|
||||
pkg("foo", "0.0.1");
|
||||
pkg("foo", "0.0.2");
|
||||
pkg("foo", "0.1.0");
|
||||
pkg("foo", "0.2.0");
|
||||
pkg("foo", "0.2.1");
|
||||
pkg("foo", "0.2.1-pre.1");
|
||||
pkg("foo", "0.3.0-pre.2");
|
||||
|
||||
assert_that(
|
||||
cargo_process("install").arg("foo"),
|
||||
execs().with_status(0).with_stderr(&format!(
|
||||
"\
|
||||
[UPDATING] registry `[..]`
|
||||
[DOWNLOADING] foo v0.0.2 (registry [..])
|
||||
[INSTALLING] foo v0.0.2
|
||||
[COMPILING] foo v0.0.2
|
||||
[DOWNLOADING] foo v0.2.1 (registry [..])
|
||||
[INSTALLING] foo v0.2.1
|
||||
[COMPILING] foo v0.2.1
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] {home}[..]bin[..]foo[..]
|
||||
warning: be sure to add `[..]` to your PATH to be able to run the installed binaries
|
||||
|
@ -1109,3 +1109,52 @@ fn patch_depends_on_another_patch() {
|
||||
execs().with_status(0).with_stderr("[FINISHED] [..]"),
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn replace_prerelease() {
|
||||
Package::new("bar", "1.1.0-pre.1").publish();
|
||||
let p = project("foo")
|
||||
.file(
|
||||
"Cargo.toml",
|
||||
r#"
|
||||
[workspace]
|
||||
members = ["foo"]
|
||||
|
||||
[patch.crates-io]
|
||||
bar = { path = "./bar" }
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"foo/Cargo.toml",
|
||||
r#"
|
||||
[project]
|
||||
name = "foo"
|
||||
version = "0.5.0"
|
||||
authors = []
|
||||
|
||||
[dependencies]
|
||||
bar = "1.1.0-pre.1"
|
||||
"#,
|
||||
)
|
||||
.file(
|
||||
"foo/src/main.rs",
|
||||
"
|
||||
extern crate bar;
|
||||
fn main() { bar::bar() }
|
||||
",
|
||||
)
|
||||
.file(
|
||||
"bar/Cargo.toml",
|
||||
r#"
|
||||
[project]
|
||||
name = "bar"
|
||||
version = "1.1.0-pre.1"
|
||||
authors = []
|
||||
[workspace]
|
||||
"#,
|
||||
)
|
||||
.file("bar/src/lib.rs", "pub fn bar() {}")
|
||||
.build();
|
||||
|
||||
assert_that(p.cargo("build"), execs().with_status(0));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user