mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
Auto merge of #12868 - hi-rustin:rustin-patch-install, r=weihanglo
Remove duplicate binaries during install
This commit is contained in:
commit
fcc3786d73
@ -9,6 +9,7 @@ use cargo::util::IntoUrl;
|
||||
use cargo::util::ToSemver;
|
||||
use cargo::util::VersionReqExt;
|
||||
use cargo::CargoResult;
|
||||
use itertools::Itertools;
|
||||
use semver::VersionReq;
|
||||
|
||||
use cargo_util::paths;
|
||||
@ -119,6 +120,7 @@ pub fn exec(config: &mut Config, args: &ArgMatches) -> CliResult {
|
||||
.get_many::<CrateVersion>("crate")
|
||||
.unwrap_or_default()
|
||||
.cloned()
|
||||
.dedup_by(|x, y| x == y)
|
||||
.map(|(krate, local_version)| resolve_crate(krate, local_version, version))
|
||||
.collect::<crate::CargoResult<Vec<_>>>()?;
|
||||
|
||||
|
@ -57,6 +57,28 @@ fn simple() {
|
||||
assert_has_not_installed_exe(cargo_home(), "foo");
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn install_the_same_version_twice() {
|
||||
pkg("foo", "0.0.1");
|
||||
|
||||
cargo_process("install foo foo")
|
||||
.with_stderr(
|
||||
"\
|
||||
[UPDATING] `[..]` index
|
||||
[DOWNLOADING] crates ...
|
||||
[DOWNLOADED] foo v0.0.1 (registry [..])
|
||||
[INSTALLING] foo v0.0.1
|
||||
[COMPILING] foo v0.0.1
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] [CWD]/home/.cargo/bin/foo[EXE]
|
||||
[INSTALLED] package `foo v0.0.1` (executable `foo[EXE]`)
|
||||
[WARNING] be sure to add `[..]` to your PATH to be able to run the installed binaries
|
||||
",
|
||||
)
|
||||
.run();
|
||||
assert_has_installed_exe(cargo_home(), "foo");
|
||||
}
|
||||
|
||||
#[cargo_test]
|
||||
fn toolchain() {
|
||||
pkg("foo", "0.0.1");
|
||||
|
Loading…
x
Reference in New Issue
Block a user