diff --git a/Cargo.toml b/Cargo.toml index 4f188af674..d3a3056038 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -64,6 +64,6 @@ path = "src/rustup/lib.rs" test = false # no unit tests [[bin]] -name = "rustup-setup" +name = "rustup-init" path = "src/rustup-cli/main.rs" test = false # no unit tests diff --git a/README.md b/README.md index 9608352265..d13d8b26a1 100644 --- a/README.md +++ b/README.md @@ -379,34 +379,34 @@ documentation for [multirust] and [multirust-dist]. The primary installation method, as described at [www.rustup.rs](https://www.rustup.rs), differs by platform: -* On Windows, download and run the [rustup-setup.exe for the +* On Windows, download and run the [rustup-init.exe for the `i686-pc-windows-gnu` target][setup]. Although this build of `rustup` installs compilers targeting the GNU ABI by default, compilers targetting the MSVC ABI can be installed with e.g. `rustup update stable-msvc`. * On Unix, run `curl https://sh.rustup.rs -sSf | sh` in your shell. This downloads and runs the correct version of - `rustup-setup` for your platform. + `rustup-init` for your platform. -[setup]: https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-setup.exe +[setup]: https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe -If you prefer you can directly download `rustup-setup` for the +If you prefer you can directly download `rustup-init` for the platform of your choice: -- [aarch64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-setup) -- [arm-unknown-linux-gnueabi](https://static.rust-lang.org/rustup/dist/arm-unknown-linux/rustup-setup) -- [arm-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/arm-unknown-linux-gnueabihf/rustup-setup) -- [armv7-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-setup) -- [i686-apple-darwin](https://static.rust-lang.org/rustup/dist/i686-apple-darwin/rustup-setup) -- [i686-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-setup.exe) -- [i686-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-setup.exe)[†](#vs2015) -- [i686-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/i686-unknown-linux-gnu/rustup-setup) -- [x86_64-apple-darwin](https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-setup) -- [x86_64-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-setup.exe) -- [x86_64-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-setup.exe)[†](#vs2015) -- [x86_64-unknown-freebsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-freebsd/rustup-setup) -- [x86_64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-setup) -- [x86_64-unknown-netbsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-netbsd/rustup-setup) +- [aarch64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init) +- [arm-unknown-linux-gnueabi](https://static.rust-lang.org/rustup/dist/arm-unknown-linux/rustup-init) +- [arm-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/arm-unknown-linux-gnueabihf/rustup-init) +- [armv7-unknown-linux-gnueabihf](https://static.rust-lang.org/rustup/dist/armv7-unknown-linux-gnueabihf/rustup-init) +- [i686-apple-darwin](https://static.rust-lang.org/rustup/dist/i686-apple-darwin/rustup-init) +- [i686-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/i686-pc-windows-gnu/rustup-init.exe) +- [i686-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/i686-pc-windows-msvc/rustup-init.exe)[†](#vs2015) +- [i686-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/i686-unknown-linux-gnu/rustup-init) +- [x86_64-apple-darwin](https://static.rust-lang.org/rustup/dist/x86_64-apple-darwin/rustup-init) +- [x86_64-pc-windows-gnu](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-gnu/rustup-init.exe) +- [x86_64-pc-windows-msvc](https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe)[†](#vs2015) +- [x86_64-unknown-freebsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-freebsd/rustup-init) +- [x86_64-unknown-linux-gnu](https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init) +- [x86_64-unknown-netbsd](https://static.rust-lang.org/rustup/dist/x86_64-unknown-netbsd/rustup-init) MSVC builds of `rustup` additionally require an [installation of diff --git a/appveyor.yml b/appveyor.yml index c99d7d6763..295c91a69b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -54,6 +54,10 @@ after_test: - powershell -File ci/prepare-deploy-appveyor.ps1 artifacts: + - path: dist\$(TARGET)\rustup-init.exe + name: rustup-init + - path: dist\$(TARGET)\rustup-init.exe.sha256 + name: rustup-init-sha - path: dist\$(TARGET)\rustup-setup.exe name: rustup-setup - path: dist\$(TARGET)\rustup-setup.exe.sha256 @@ -68,7 +72,7 @@ deploy: bucket: dev-static-rust-lang-org set_public: true region: us-west-1 - artifact: rustup-setup,rustup-setup-sha + artifact: rustup-init,rustup-init-sha,rustup-setup,rustup-setup-sha folder: rustup on: branch: master @@ -81,7 +85,7 @@ deploy: bucket: static-rust-lang-org set_public: true region: us-west-1 - artifact: rustup-setup,rustup-setup-sha + artifact: rustup-init,rustup-init-sha,rustup-setup,rustup-setup-sha folder: rustup on: branch: stable diff --git a/ci/prepare-deploy-appveyor.ps1 b/ci/prepare-deploy-appveyor.ps1 index 8a4dca207b..5df8d6c323 100644 --- a/ci/prepare-deploy-appveyor.ps1 +++ b/ci/prepare-deploy-appveyor.ps1 @@ -6,12 +6,17 @@ if ($env:APPVEYOR_REPO_BRANCH -eq "auto") { exit 0 } +# Copy rustup-init to rustup-setup for backwards compatibility +cp target\release\rustup-init.exe target\release\rustup-setup.exe + # Generate hashes Get-FileHash .\target\release\* | ForEach-Object {[io.file]::WriteAllText($_.Path + ".sha256", $_.Hash.ToLower() + "`n")} # Prepare bins for upload $dest = "dist\$env:TARGET" md -Force "$dest" +cp target\release\rustup-init.exe "$dest/" +cp target\release\rustup-init.exe.sha256 "$dest/" cp target\release\rustup-setup.exe "$dest/" cp target\release\rustup-setup.exe.sha256 "$dest/" diff --git a/ci/prepare-deploy-travis.sh b/ci/prepare-deploy-travis.sh index 2f88feb246..730e118410 100644 --- a/ci/prepare-deploy-travis.sh +++ b/ci/prepare-deploy-travis.sh @@ -23,6 +23,9 @@ if [[ "$TARGET" == "x86_64-unknown-linux-gnu" && "$TRAVIS_BRANCH" == "stable" ]] #git push -qf https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git gh-pages; fi; +# Copy rustup-init to rustup-setup for backwards compatibility +cp target/$TARGET/release/rustup-init target/$TARGET/release/rustup-setup + # Generate hashes if [ "$TRAVIS_OS_NAME" == "osx" ]; then find "target/$TARGET/release/" -maxdepth 1 -type f -exec sh -c 'shasum -a 256 -b "{}" > "{}.sha256"' \;; @@ -36,6 +39,8 @@ dest="deploy" # Prepare bins for upload bindest="$dest/dist/$TARGET" mkdir -p "$bindest/" +cp target/$TARGET/release/rustup-init "$bindest/" +cp target/$TARGET/release/rustup-init.sha256 "$bindest/" cp target/$TARGET/release/rustup-setup "$bindest/" cp target/$TARGET/release/rustup-setup.sha256 "$bindest/" @@ -43,7 +48,7 @@ if [ "$TARGET" != "x86_64-unknown-linux-gnu" ]; then exit 0 fi -cp rustup-setup.sh "$dest/" +cp rustup-init.sh "$dest/" # Prepare website for upload cp -R www "$dest/www" diff --git a/rustup-setup.sh b/rustup-init.sh similarity index 97% rename from rustup-setup.sh rename to rustup-init.sh index a5e3b43865..ed04ccdaf8 100755 --- a/rustup-setup.sh +++ b/rustup-init.sh @@ -37,10 +37,10 @@ main() { ;; esac - local _url="$RUSTUP_UPDATE_ROOT/$_arch/rustup-setup$_ext" + local _url="$RUSTUP_UPDATE_ROOT/$_arch/rustup-init$_ext" local _dir="$(mktemp -d 2>/dev/null || ensure mktemp -d -t rustup)" - local _file="$_dir/rustup-setup$_ext" + local _file="$_dir/rustup-init$_ext" printf "\33[1minfo:\33[0m downloading installer\n" diff --git a/src/rustup-cli/main.rs b/src/rustup-cli/main.rs index b1a3e05486..bad873bc67 100644 --- a/src/rustup-cli/main.rs +++ b/src/rustup-cli/main.rs @@ -76,7 +76,8 @@ fn run_multirust() -> Result<()> { multirust_mode::main() } Some(n) if n.starts_with("multirust-setup")|| - n.starts_with("rustup-setup") => { + n.starts_with("rustup-setup") || + n.starts_with("rustup-init") => { // NB: The above check is only for the prefix of the file // name. Browsers rename duplicates to // e.g. multirust-setup(2), and this allows all variations diff --git a/src/rustup-cli/self_update.rs b/src/rustup-cli/self_update.rs index e4c7914c67..cfb525c177 100644 --- a/src/rustup-cli/self_update.rs +++ b/src/rustup-cli/self_update.rs @@ -875,7 +875,7 @@ pub fn update() -> Result<()> { pub fn prepare_update() -> Result> { let ref cargo_home = try!(utils::cargo_home()); let ref multirust_path = cargo_home.join(&format!("bin/multirust{}", EXE_SUFFIX)); - let ref setup_path = cargo_home.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); + let ref setup_path = cargo_home.join(&format!("bin/rustup-init{}", EXE_SUFFIX)); if !multirust_path.exists() { return Err(Error::NotSelfInstalled(cargo_home.clone())); @@ -898,7 +898,7 @@ pub fn prepare_update() -> Result> { })); // Get download URL - let url = format!("{}/{}/rustup-setup{}", update_root, triple, EXE_SUFFIX); + let url = format!("{}/{}/rustup-init{}", update_root, triple, EXE_SUFFIX); // Calculate own hash let mut hasher = Hasher::new(Type::SHA256); @@ -1009,7 +1009,7 @@ pub fn self_replace() -> Result<()> { pub fn cleanup_self_updater() -> Result<()> { let cargo_home = try!(utils::cargo_home()); - let ref setup = cargo_home.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); + let ref setup = cargo_home.join(&format!("bin/rustup-init{}", EXE_SUFFIX)); if setup.exists() { try!(utils::remove_file("setup", setup)); diff --git a/src/rustup-mock/src/clitools.rs b/src/rustup-mock/src/clitools.rs index f9b4cff407..53f6fa3b40 100644 --- a/src/rustup-mock/src/clitools.rs +++ b/src/rustup-mock/src/clitools.rs @@ -84,10 +84,10 @@ pub fn setup(s: Scenario, f: &Fn(&Config)) { let current_exe_path = env::current_exe().map(PathBuf::from).unwrap(); let exe_dir = current_exe_path.parent().unwrap(); - let ref build_path = exe_dir.join(format!("rustup-setup{}", EXE_SUFFIX)); + let ref build_path = exe_dir.join(format!("rustup-init{}", EXE_SUFFIX)); let ref rustup_path = config.exedir.join(format!("rustup{}", EXE_SUFFIX)); - let setup_path = config.exedir.join(format!("rustup-setup{}", EXE_SUFFIX)); + let setup_path = config.exedir.join(format!("rustup-init{}", EXE_SUFFIX)); let multirust_setup_path = config.exedir.join(format!("multirust-setup{}", EXE_SUFFIX)); let rustc_path = config.exedir.join(format!("rustc{}", EXE_SUFFIX)); let cargo_path = config.exedir.join(format!("cargo{}", EXE_SUFFIX)); diff --git a/tests/cli-self-update.rs b/tests/cli-self-update.rs index 88b168e6e9..4baf297620 100644 --- a/tests/cli-self-update.rs +++ b/tests/cli-self-update.rs @@ -57,9 +57,9 @@ pub fn update_setup(f: &Fn(&Config, &Path)) { let ref trip = this_host_triple(); let ref dist_dir = self_dist.join(&format!("{}", trip)); - let ref dist_exe = dist_dir.join(&format!("rustup-setup{}", EXE_SUFFIX)); - let ref dist_hash = dist_dir.join(&format!("rustup-setup{}.sha256", EXE_SUFFIX)); - let ref multirust_bin = config.exedir.join(&format!("rustup-setup{}", EXE_SUFFIX)); + let ref dist_exe = dist_dir.join(&format!("rustup-init{}", EXE_SUFFIX)); + let ref dist_hash = dist_dir.join(&format!("rustup-init{}.sha256", EXE_SUFFIX)); + let ref multirust_bin = config.exedir.join(&format!("rustup-init{}", EXE_SUFFIX)); fs::create_dir_all(dist_dir).unwrap(); fs::copy(multirust_bin, dist_exe).unwrap(); @@ -77,7 +77,7 @@ pub fn update_setup(f: &Fn(&Config, &Path)) { #[test] fn install_bins_to_cargo_home() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let rustc = config.cargodir.join(&format!("bin/rustc{}", EXE_SUFFIX)); let rustdoc = config.cargodir.join(&format!("bin/rustdoc{}", EXE_SUFFIX)); @@ -96,8 +96,8 @@ fn install_bins_to_cargo_home() { #[test] fn install_twice() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); assert!(multirust.exists()); }); @@ -107,7 +107,7 @@ fn install_twice() { #[cfg(unix)] fn bins_are_executable() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let ref rustc = config.cargodir.join(&format!("bin/rustc{}", EXE_SUFFIX)); let ref rustdoc = config.cargodir.join(&format!("bin/rustdoc{}", EXE_SUFFIX)); @@ -135,7 +135,7 @@ fn install_creates_cargo_home() { setup(&|config| { fs::remove_dir(&config.cargodir).unwrap(); fs::remove_dir(&config.rustupdir).unwrap(); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); assert!(config.cargodir.exists()); }); } @@ -143,7 +143,7 @@ fn install_creates_cargo_home() { #[test] fn uninstall_deletes_bins() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let rustc = config.cargodir.join(&format!("bin/rustc{}", EXE_SUFFIX)); @@ -163,7 +163,7 @@ fn uninstall_deletes_bins() { #[test] fn uninstall_works_if_some_bins_dont_exist() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let rustc = config.cargodir.join(&format!("bin/rustc{}", EXE_SUFFIX)); let rustdoc = config.cargodir.join(&format!("bin/rustdoc{}", EXE_SUFFIX)); @@ -188,7 +188,7 @@ fn uninstall_works_if_some_bins_dont_exist() { #[test] fn uninstall_deletes_multirust_home() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "default", "nightly"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); assert!(!config.rustupdir.exists()); @@ -198,7 +198,7 @@ fn uninstall_deletes_multirust_home() { #[test] fn uninstall_works_if_multirust_home_doesnt_exist() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); raw::remove_dir(&config.rustupdir).unwrap(); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); }); @@ -207,7 +207,7 @@ fn uninstall_works_if_multirust_home_doesnt_exist() { #[test] fn uninstall_deletes_cargo_home() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); assert!(!config.cargodir.exists()); }); @@ -216,7 +216,7 @@ fn uninstall_deletes_cargo_home() { #[test] fn uninstall_fails_if_not_installed() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); fs::remove_file(&multirust).unwrap(); expect_err(config, &["rustup", "self", "uninstall", "-y"], @@ -230,7 +230,7 @@ fn uninstall_fails_if_not_installed() { #[test] fn uninstall_self_delete_works() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let mut cmd = Command::new(multirust.clone()); cmd.args(&["self", "uninstall", "-y"]); @@ -261,7 +261,7 @@ fn uninstall_self_delete_works() { #[test] fn uninstall_doesnt_leave_gc_file() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let ref parent = config.cargodir.parent().unwrap(); @@ -285,7 +285,7 @@ fn install_adds_path_to_rc(rcfile: &str) { let my_rc = "foo\nbar\nbaz"; let ref rc = config.homedir.join(rcfile); raw::write_file(rc, my_rc).unwrap(); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let new_rc = raw::read_file(rc).unwrap(); let addition = format!(r#"export PATH="{}/bin:$PATH""#, @@ -308,8 +308,8 @@ fn install_adds_path_to_rcfile_just_once() { let my_profile = "foo\nbar\nbaz"; let ref profile = config.homedir.join(".profile"); raw::write_file(profile, my_profile).unwrap(); - expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let new_profile = raw::read_file(profile).unwrap(); let addition = format!(r#"export PATH="{}/bin:$PATH""#, @@ -325,7 +325,7 @@ fn uninstall_removes_path_from_rc(rcfile: &str) { let my_rc = "foo\nbar\nbaz"; let ref rc = config.homedir.join(rcfile); raw::write_file(rc, my_rc).unwrap(); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let new_rc = raw::read_file(rc).unwrap(); @@ -344,7 +344,7 @@ fn uninstall_removes_path_from_bashrc() { fn uninstall_doesnt_touch_rc_files_that_dont_contain_cargo_home() { setup(&|config| { let my_rc = "foo\nbar\nbaz"; - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let ref profile = config.homedir.join(".profile"); @@ -369,7 +369,7 @@ fn when_cargo_home_is_the_default_write_path_specially() { let my_profile = "foo\nbar\nbaz"; let ref profile = config.homedir.join(".profile"); raw::write_file(profile, my_profile).unwrap(); - let mut cmd = clitools::cmd(config, "rustup-setup", &["-y"]); + let mut cmd = clitools::cmd(config, "rustup-init", &["-y"]); cmd.env_remove("CARGO_HOME"); assert!(cmd.output().unwrap().status.success()); @@ -429,7 +429,7 @@ fn restore_path(_: &Option) { } #[cfg(windows)] fn install_adds_path() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let path = config.cargodir.join("bin").to_string_lossy().to_string(); assert!(get_path().unwrap().contains(&path)); @@ -440,8 +440,8 @@ fn install_adds_path() { #[cfg(windows)] fn install_does_not_add_path_twice() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let path = config.cargodir.join("bin").to_string_lossy().to_string(); assert_eq!(get_path().unwrap().matches(&path).count(), 1); @@ -452,7 +452,7 @@ fn install_does_not_add_path_twice() { #[cfg(windows)] fn uninstall_removes_path() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "self", "uninstall", "-y"]); let path = config.cargodir.join("bin").to_string_lossy().to_string(); @@ -463,7 +463,7 @@ fn uninstall_removes_path() { #[test] fn update_exact() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok_ex(config, &["rustup", "self", "update"], r"", r"info: checking for self-updates @@ -488,9 +488,9 @@ r"error: rustup is not installed at '{}' fn update_but_delete_existing_updater_first() { update_setup(&|config, _| { // The updater is stored in a known location - let ref setup = config.cargodir.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); + let ref setup = config.cargodir.join(&format!("bin/rustup-init{}", EXE_SUFFIX)); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); // If it happens to already exist for some reason it // should just be deleted. @@ -505,12 +505,12 @@ fn update_but_delete_existing_updater_first() { #[test] fn update_no_change() { update_setup(&|config, self_dist| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref trip = this_host_triple(); let ref dist_dir = self_dist.join(&format!("{}", trip)); - let ref dist_exe = dist_dir.join(&format!("rustup-setup{}", EXE_SUFFIX)); - let ref dist_hash = dist_dir.join(&format!("rustup-setup{}.sha256", EXE_SUFFIX)); + let ref dist_exe = dist_dir.join(&format!("rustup-init{}", EXE_SUFFIX)); + let ref dist_hash = dist_dir.join(&format!("rustup-init{}.sha256", EXE_SUFFIX)); let ref rustup_bin = config.exedir.join(&format!("rustup{}", EXE_SUFFIX)); fs::copy(rustup_bin, dist_exe).unwrap(); create_hash(dist_exe, dist_hash); @@ -527,11 +527,11 @@ info: rustup is up to date #[test] fn update_bad_hash() { update_setup(&|config, self_dist| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref trip = this_host_triple(); let ref dist_dir = self_dist.join(&format!("{}", trip)); - let ref dist_hash = dist_dir.join(&format!("rustup-setup{}.sha256", EXE_SUFFIX)); + let ref dist_hash = dist_dir.join(&format!("rustup-init{}.sha256", EXE_SUFFIX)); let ref some_other_file = config.distdir.join("dist/channel-rust-nightly.toml"); @@ -545,11 +545,11 @@ fn update_bad_hash() { #[test] fn update_hash_file_404() { update_setup(&|config, self_dist| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref trip = this_host_triple(); let ref dist_dir = self_dist.join(&format!("{}", trip)); - let ref dist_hash = dist_dir.join(&format!("rustup-setup{}.sha256", EXE_SUFFIX)); + let ref dist_hash = dist_dir.join(&format!("rustup-init{}.sha256", EXE_SUFFIX)); fs::remove_file(dist_hash).unwrap(); @@ -561,11 +561,11 @@ fn update_hash_file_404() { #[test] fn update_download_404() { update_setup(&|config, self_dist| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref trip = this_host_triple(); let ref dist_dir = self_dist.join(&format!("{}", trip)); - let ref dist_exe = dist_dir.join(&format!("rustup-setup{}", EXE_SUFFIX)); + let ref dist_exe = dist_dir.join(&format!("rustup-init{}", EXE_SUFFIX)); fs::remove_file(dist_exe).unwrap(); @@ -580,7 +580,7 @@ fn update_download_404() { #[test] fn update_updates_multirust_bin() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref bin = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let before_hash = calc_hash(bin); @@ -606,7 +606,7 @@ fn update_updates_multirust_bin() { #[test] fn rustup_self_updates() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let ref bin = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); let before_hash = calc_hash(bin); @@ -622,7 +622,7 @@ fn rustup_self_updates() { #[test] fn rustup_self_update_exact() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok_ex(config, &["rustup", "update"], for_host!(r" @@ -636,17 +636,17 @@ info: downloading self-update }) } -// Because self-delete on windows is hard, rustup-setup doesn't +// Because self-delete on windows is hard, rustup-init doesn't // do it. It instead leaves itself installed for cleanup by later // invocations of multirust. #[test] fn updater_leaves_itself_for_later_deletion() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "update", "nightly"]); expect_ok(config, &["rustup", "self", "update"]); - let setup = config.cargodir.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); + let setup = config.cargodir.join(&format!("bin/rustup-init{}", EXE_SUFFIX)); assert!(setup.exists()); }); } @@ -654,13 +654,13 @@ fn updater_leaves_itself_for_later_deletion() { #[test] fn updater_is_deleted_after_running_multirust() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "update", "nightly"]); expect_ok(config, &["rustup", "self", "update"]); expect_ok(config, &["rustup", "update", "nightly"]); - let setup = config.cargodir.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); + let setup = config.cargodir.join(&format!("bin/rustup-init{}", EXE_SUFFIX)); assert!(!setup.exists()); }); } @@ -668,13 +668,13 @@ fn updater_is_deleted_after_running_multirust() { #[test] fn updater_is_deleted_after_running_rustc() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "default", "nightly"]); expect_ok(config, &["rustup", "self", "update"]); expect_ok(config, &["rustc", "--version"]); - let setup = config.cargodir.join(&format!("bin/rustup-setup{}", EXE_SUFFIX)); + let setup = config.cargodir.join(&format!("bin/rustup-init{}", EXE_SUFFIX)); assert!(!setup.exists()); }); } @@ -682,7 +682,7 @@ fn updater_is_deleted_after_running_rustc() { #[test] fn multirust_still_works_after_update() { update_setup(&|config, _| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "default", "nightly"]); expect_ok(config, &["rustup", "self", "update"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); @@ -699,10 +699,22 @@ fn multirust_still_works_after_update() { fn update_stress_test() { } +// The installer used to be called rustup-setup. For compatibility it +// still needs to work in that mode. +#[test] +fn as_rustup_setup() { + update_setup(&|config, _| { + let init = config.exedir.join(format!("rustup-init{}", EXE_SUFFIX)); + let setup = config.exedir.join(format!("rustup-setup{}", EXE_SUFFIX)); + fs::copy(&init, &setup).unwrap(); + expect_ok(config, &["rustup-setup", "-y"]); + }); +} + #[test] fn first_install_exact() { setup(&|config| { - expect_ok_ex(config, &["rustup-setup", "-y"], + expect_ok_ex(config, &["rustup-init", "-y"], r" stable installed - 1.1.0 (hash-s-2) @@ -725,8 +737,8 @@ info: default toolchain set to 'stable' #[test] fn reinstall_exact() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); - expect_ok_ex(config, &["rustup-setup", "-y"], + expect_ok(config, &["rustup-init", "-y"]); + expect_ok_ex(config, &["rustup-init", "-y"], r" ", r"info: updating existing installation @@ -743,7 +755,7 @@ fn produces_env_file_on_unix() { // $HOME/.cargo by removing CARGO_HOME from the environment, // otherwise the literal path will be written to the file. - let mut cmd = clitools::cmd(config, "rustup-setup", &["-y"]); + let mut cmd = clitools::cmd(config, "rustup-init", &["-y"]); cmd.env_remove("CARGO_HOME"); assert!(cmd.output().unwrap().status.success()); let ref envfile = config.homedir.join(".cargo/env"); @@ -760,7 +772,7 @@ fn doesnt_produce_env_file_on_windows() { #[test] fn install_sets_up_stable() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-s-2"); }); @@ -769,7 +781,7 @@ fn install_sets_up_stable() { #[test] fn install_sets_up_stable_unless_a_different_default_is_requested() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y", "--default-toolchain", "nightly"]); + expect_ok(config, &["rustup-init", "-y", "--default-toolchain", "nightly"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); }); @@ -778,10 +790,10 @@ fn install_sets_up_stable_unless_a_different_default_is_requested() { #[test] fn install_sets_up_stable_unless_there_is_already_a_default() { setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_ok(config, &["rustup", "default", "nightly"]); expect_ok(config, &["rustup", "toolchain", "remove", "stable"]); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); expect_stdout_ok(config, &["rustc", "--version"], "hash-n-2"); expect_err(config, &["rustup", "run", "stable", "rustc", "--version"], @@ -804,7 +816,7 @@ fn install_deletes_legacy_multirust_bins() { raw::write_file(rustc_bin, "").unwrap(); assert!(multirust_bin.exists()); assert!(rustc_bin.exists()); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); assert!(!multirust_bin.exists()); assert!(!rustc_bin.exists()); }); @@ -825,7 +837,7 @@ fn install_deletes_legacy_multirust_bins() { // windows::get_special_folder(&windows::FOLDERID_Profile).unwrap(); } -// rustup-setup obeys CONFIG.CARGODIR, which multirust-rs *used* to set +// rustup-init obeys CONFIG.CARGODIR, which multirust-rs *used* to set // before installation moved from ~/.multirust/bin to ~/.cargo/bin. // If installation running under the old multirust via `cargo run`, // then CONFIG.CARGODIR will be set during installation, causing the @@ -836,7 +848,7 @@ fn install_deletes_legacy_multirust_bins() { fn legacy_upgrade_installs_to_correct_location() { setup(&|config| { let fake_cargo = config.rustupdir.join(".multirust/cargo"); - let mut cmd = clitools::cmd(config, "rustup-setup", &["-y"]); + let mut cmd = clitools::cmd(config, "rustup-init", &["-y"]); cmd.env("CARGO_HOME", format!("{}", fake_cargo.display())); assert!(cmd.output().unwrap().status.success()); @@ -850,22 +862,22 @@ fn legacy_upgrade_installs_to_correct_location() { #[test] fn readline_no_stdin() { setup(&|config| { - expect_err(config, &["rustup-setup"], + expect_err(config, &["rustup-init"], "unable to read from stdin for confirmation"); }); } #[test] fn multirust_setup_works_with_weird_names() { - // Browsers often rename bins to e.g. rustup-setup(2).exe. + // Browsers often rename bins to e.g. rustup-init(2).exe. setup(&|config| { let ref old = config.exedir.join( - &format!("rustup-setup{}", EXE_SUFFIX)); + &format!("rustup-init{}", EXE_SUFFIX)); let ref new = config.exedir.join( - &format!("rustup-setup(2){}", EXE_SUFFIX)); + &format!("rustup-init(2){}", EXE_SUFFIX)); fs::rename(old, new).unwrap(); - expect_ok(config, &["rustup-setup(2)", "-y"]); + expect_ok(config, &["rustup-init(2)", "-y"]); let multirust = config.cargodir.join(&format!("bin/multirust{}", EXE_SUFFIX)); assert!(multirust.exists()); }); @@ -880,7 +892,7 @@ fn doesnt_write_wrong_path_type_to_reg() { use winapi::*; setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE).unwrap(); @@ -911,7 +923,7 @@ fn windows_handle_empty_path_registry_key() { let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE).unwrap(); let _ = environment.delete_value("PATH"); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE).unwrap(); @@ -943,7 +955,7 @@ fn windows_uninstall_removes_semicolon_from_path() { // not leaving behind any semi-colons environment.set_value("PATH", &"foo").unwrap(); - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE).unwrap(); @@ -978,7 +990,7 @@ fn install_doesnt_mess_with_a_non_unicode_path() { }; environment.set_raw_value("PATH", ®_value).unwrap(); - expect_stderr_ok(config, &["rustup-setup", "-y"], + expect_stderr_ok(config, &["rustup-init", "-y"], "the registry key HKEY_CURRENT_USER\\Environment\\PATH does not contain valid Unicode. \ Not modifying the PATH variable"); @@ -997,7 +1009,7 @@ fn uninstall_doesnt_mess_with_a_non_unicode_path() { use winapi::*; setup(&|config| { - expect_ok(config, &["rustup-setup", "-y"]); + expect_ok(config, &["rustup-init", "-y"]); let root = RegKey::predef(HKEY_CURRENT_USER); let environment = root.open_subkey_with_flags("Environment", KEY_READ | KEY_WRITE).unwrap();