mirror of
https://github.com/rust-lang/cargo
synced 2024-10-13 19:22:33 +00:00
Show version of package to be installed (before potential overwrite errors)
Fixes #3587
This commit is contained in:
parent
2324c2bbaf
commit
82a8f6f7e7
|
@ -97,6 +97,8 @@ pub fn install(root: Option<&str>,
|
|||
};
|
||||
let pkg = ws.current()?;
|
||||
|
||||
config.shell().status("Installing", pkg)?;
|
||||
|
||||
// Preflight checks to check up front whether we'll overwrite something.
|
||||
// We have to check this again afterwards, but may as well avoid building
|
||||
// anything if we're gonna throw it away anyway.
|
||||
|
|
|
@ -37,6 +37,7 @@ fn simple() {
|
|||
execs().with_status(0).with_stderr(&format!("\
|
||||
[UPDATING] registry `[..]`
|
||||
[DOWNLOADING] foo v0.0.1 (registry [..])
|
||||
[INSTALLING] foo v0.0.1
|
||||
[COMPILING] foo v0.0.1
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] {home}[..]bin[..]foo[..]
|
||||
|
@ -62,6 +63,7 @@ fn pick_max_version() {
|
|||
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
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] {home}[..]bin[..]foo[..]
|
||||
|
@ -171,6 +173,7 @@ fn install_path() {
|
|||
assert_that(cargo_home(), has_installed_exe("foo"));
|
||||
assert_that(cargo_process("install").arg("--path").arg(".").cwd(p.root()),
|
||||
execs().with_status(101).with_stderr("\
|
||||
[INSTALLING] foo v0.1.0 [..]
|
||||
[ERROR] binary `foo[..]` already exists in destination as part of `foo v0.1.0 [..]`
|
||||
Add --force to overwrite
|
||||
"));
|
||||
|
@ -336,6 +339,7 @@ fn no_binaries() {
|
|||
|
||||
assert_that(cargo_process("install").arg("--path").arg(p.root()).arg("foo"),
|
||||
execs().with_status(101).with_stderr("\
|
||||
[INSTALLING] foo [..]
|
||||
[ERROR] specified package has no binaries
|
||||
"));
|
||||
}
|
||||
|
@ -376,6 +380,7 @@ fn install_twice() {
|
|||
execs().with_status(0));
|
||||
assert_that(cargo_process("install").arg("--path").arg(p.root()),
|
||||
execs().with_status(101).with_stderr("\
|
||||
[INSTALLING] foo v0.1.0 [..]
|
||||
[ERROR] binary `foo-bin1[..]` already exists in destination as part of `foo v0.1.0 ([..])`
|
||||
binary `foo-bin2[..]` already exists in destination as part of `foo v0.1.0 ([..])`
|
||||
Add --force to overwrite
|
||||
|
@ -409,6 +414,7 @@ fn install_force() {
|
|||
|
||||
assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
|
||||
execs().with_status(0).with_stderr(&format!("\
|
||||
[INSTALLING] foo v0.2.0 ([..])
|
||||
[COMPILING] foo v0.2.0 ([..])
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[REPLACING] {home}[..]bin[..]foo[..]
|
||||
|
@ -452,6 +458,7 @@ fn install_force_partial_overlap() {
|
|||
|
||||
assert_that(cargo_process("install").arg("--force").arg("--path").arg(p.root()),
|
||||
execs().with_status(0).with_stderr(&format!("\
|
||||
[INSTALLING] foo v0.2.0 ([..])
|
||||
[COMPILING] foo v0.2.0 ([..])
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] {home}[..]bin[..]foo-bin3[..]
|
||||
|
@ -503,6 +510,7 @@ fn install_force_bin() {
|
|||
.arg("--path")
|
||||
.arg(p.root()),
|
||||
execs().with_status(0).with_stderr(&format!("\
|
||||
[INSTALLING] foo v0.2.0 ([..])
|
||||
[COMPILING] foo v0.2.0 ([..])
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[REPLACING] {home}[..]bin[..]foo-bin2[..]
|
||||
|
@ -559,6 +567,7 @@ fn git_repo() {
|
|||
assert_that(cargo_process("install").arg("--locked").arg("--git").arg(p.url().to_string()),
|
||||
execs().with_status(0).with_stderr(&format!("\
|
||||
[UPDATING] git repository `[..]`
|
||||
[INSTALLING] foo v0.1.0 ([..])
|
||||
[COMPILING] foo v0.1.0 ([..])
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] {home}[..]bin[..]foo[..]
|
||||
|
@ -697,7 +706,8 @@ fn do_not_rebuilds_on_local_install() {
|
|||
assert_that(p.cargo_process("build").arg("--release"),
|
||||
execs().with_status(0));
|
||||
assert_that(cargo_process("install").arg("--path").arg(p.root()),
|
||||
execs().with_status(0).with_stderr("[FINISHED] release [optimized] target(s) in [..]
|
||||
execs().with_status(0).with_stderr("[INSTALLING] [..]
|
||||
[FINISHED] release [optimized] target(s) in [..]
|
||||
[INSTALLING] [..]
|
||||
warning: be sure to add `[..]` to your PATH to be able to run the installed binaries
|
||||
"));
|
||||
|
|
Loading…
Reference in a new issue