rustup icon indicating copy to clipboard operation
rustup copied to clipboard

chocolatey installer

Open ctaggart opened this issue 8 years ago • 43 comments

There is already another general issue titled Consider packaging rustup & this request is specific to chocolatey. It would be great to be able to do:

choco install rustup

It is currently possible to install the rust gnu package with the rust package, but that is not what I want. I want to manage rust with rustup.

I should be able to create the package pretty easily. I just need the URL to download a specific version of rust-init.exe so that the script can validate the checksum.

ctaggart avatar Jan 07 '17 21:01 ctaggart

So just like in appveyor.yml, where it has:

curl -sSf -o rustup-init.exe https://win.rustup.rs/

It should be great if there was an optional version parameter, so that something like this would work?

curl -sSf -o rustup-init.exe https://win.rustup.rs/?version=1.0.0

Not as important, but is there a way to get or download the sha256 that I see?

ctaggart avatar Jan 07 '17 21:01 ctaggart

I took a crack at it and published a prerelease. Code is here https://github.com/ctaggart/rustup.rs. We'll need to test on a fresh Windows, but this should install Visual C++ & then Rust targeting VC.

choco install vcbuildtools
choco install rustup -version 1.0.0-beta1 -pre

https://chocolatey.org/packages/rustup/

ctaggart avatar Jan 08 '17 05:01 ctaggart

Chocolatey's automated testing failed, which is pretty cool. Here is the output. https://gist.github.com/choco-bot/c87cef0bfe95885db32a3cf614667d46#file-install-txt-L281-L289

Looks like it times out, waiting for the prompt. I'll pass the -y flag in to allow the silent install.

PS C:\Users\c> C:\Users\c\Downloads\rustup-init.exe --help
rustup-init 1.0.0 (17b6d21 2016-12-15)
The installer for rustup

USAGE:
    rustup-init.exe [FLAGS] [OPTIONS]

FLAGS:
    -v, --verbose           Enable verbose output
    -y                      Disable confirmation prompt.
        --no-modify-path    Don't configure the PATH environment variable
    -h, --help              Prints help information
    -V, --version           Prints version information

OPTIONS:
        --default-host <default-host>              Choose a default host triple
        --default-toolchain <default-toolchain>    Choose a default toolchain to install
PS C:\Users\c>

ctaggart avatar Jan 08 '17 17:01 ctaggart

beta2 failed the Chocolatey automated tests. It timed out after the default of 45 minutes. It is working fine on both of my laptops:

C:\WINDOWS\system32>choco install rustup --version 1.0.0-beta2
Chocolatey v0.10.3
Installing the following packages:
rustup
By installing you accept licenses for the packages.

rustup v1.0.0-beta2 - Possibly broken
rustup package files install completed. Performing other installation steps.
Downloading rustup-init
  from 'https://win.rustup.rs/?version=1.0.0'
Progress: 100% - Completed download of C:\Users\c\AppData\Local\Temp\chocolatey\rustup\1.0.0-beta2\rustup-init.exe (7.21 MB).
Download of rustup-init.exe (7.21 MB) completed.
Hashes match.
Installing rustup-init...
info: syncing channel updates for 'stable-x86_64-pc-windows-msvc'
info: downloading component 'rustc'
info: downloading component 'rust-std'
info: downloading component 'cargo'
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'cargo'
info: default toolchain set to 'stable'
rustup-init has been installed.
Only an exit code of non-zero will fail the package by default. Set
 `--failonstderr` if you want error messages to also fail a script. See
 `choco -h` for details.
Environment Vars (like PATH) have changed. Close/reopen your shell to
 see the changes (or in powershell/cmd.exe just type `refreshenv`).
 The install of rustup was successful.
  Software installed as 'EXE', install location is likely default.

Chocolatey installed 1/1 packages. 0 packages failed.
 See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

You use Chocolatey? You are amazing! Are you ready to take the next
 step and look even smarter with more awesome features?
 https://chocolatey.org/compare

ctaggart avatar Jan 08 '17 21:01 ctaggart

I uninstalled Visual C++ Build Tools and tried again. It looks to be prompting, even though I told it not to with a -y.

C:\WINDOWS\system32>"C:\Users\c\AppData\Local\Temp\chocolatey\rustup\1.0.0-beta2\rustup-init.exe" -y

Rust Visual C++ prerequisites

Rust requires the Microsoft C++ build tools for Visual Studio 2013 or later,
but they don't seem to be installed.

The easiest way to acquire the build tools is by installing Microsoft Visual
C++ Build Tools 2015 which provides just the Visual C++ build tools:

  http://landinghub.visualstudio.com/visual-cpp-build-tools

Alternately, you can install Visual Studio 2015 or Visual Studio 2013 and
during install select the "C++ tools":

  https://www.visualstudio.com/downloads/

Install the C++ build tools before proceeding.

If you will be targetting the GNU ABI or otherwise know what you are doing then
it is fine to continue installation without the build tools, but otherwise,
install the C++ build tools before proceeding.

Continue? (Y/n)

ctaggart avatar Jan 09 '17 00:01 ctaggart

Highly likely you have an unknown dependency you don't see until you try to run your install against a system like the test environment which doesn't have anything more than the stock ISO install of Windows 2012 R2 on it.

ferventcoder avatar Jan 09 '17 02:01 ferventcoder

@ferventcoder, that is correct. It is prompting when Visual C++ Build Tools is not installed. It shouldn't be doing that when -y is passed, so I logged bug #916.

ctaggart avatar Jan 09 '17 02:01 ctaggart

Ah, didn't see the timing of that :)

ferventcoder avatar Jan 09 '17 02:01 ferventcoder

@ctaggart Great work on this, sorry I didn't reply sooner.

I'm not sure what the plan is here for rustup, whether we want to bring more different packaging scenarios into the release process, or whether it will stay separate. @brson ?

Diggsey avatar May 03 '17 22:05 Diggsey

What work needs to be done on this and how can I help? Came looking after I saw someone ask on Twitter for a one-liner to install rustup.

chriskrycho avatar Aug 19 '17 23:08 chriskrycho

Yes please. I have some chocolatey scripts so I can go from fresh VM to writing code with minimal hassle. rustup support would be welcomed.

shaleh avatar Nov 23 '17 08:11 shaleh

Error, the checksum for rustup-init.exe has changed, causing the Chocolatey recipe to fail. On my machine, the new sha256 checksum is b33a82c54199a427172fec8957760ae7c9a7b7a13b0814bdddb4438e7f88e801.

mcandre avatar Feb 23 '18 20:02 mcandre

To avoid the checksum problem, I think it makes sense to bundle the rustup-init.exe inside the choco package instead of downloading it from the web. Or getting the sha from the web as well (less secure). In case it lags behind, you will possibly get the older version, which could be then self-updated with rustup update.

vors avatar Jun 02 '18 08:06 vors

I think it makes sense to bundle the rustup-init.exe inside the choco package instead of downloading it from the web. Or getting the sha from the web as well (less secure).

Bundling would be the only option available between these two. Getting checksum at runtime circumvents the security measure - thus it won't pass moderation.

ferventcoder avatar Jun 02 '18 11:06 ferventcoder

Bundling sounds like a great option. Is this something someone else can pick up? This is not something I have time for right now.

ctaggart avatar Jun 04 '18 17:06 ctaggart

@ctaggart I can try. Do you mind giving me package management permissions on choco https://chocolatey.org/profiles/vors ?

vors avatar Jun 05 '18 03:06 vors

@vors Done

ctaggart avatar Jun 05 '18 04:06 ctaggart

Please include multi rust in place of rust up. I'd I remember correctly 6 months back that was the tool recommended officially

SRGOM avatar Jun 05 '18 04:06 SRGOM

@SRGOM No, it is the opposite. https://github.com/brson/multirust https://www.rust-lang.org/en-US/install.html

ctaggart avatar Jun 05 '18 04:06 ctaggart

Great!

Repo: https://github.com/vors/choco-rustup @ctaggart I reused your paket template, but converted it to nuspec to avoid additional dependency on paket.

I published the rustup.1.11.0-beta1.nupkg Please try it out with

choco install rustup -pre

If everything works, I will publish the package without -beta1 prefix.

vors avatar Jun 05 '18 06:06 vors

@vors I tried this out and it worked perfectly on my Windows 10 machine.

It didn't seem to affect anything, but I ran choco install visualstudio2017-workload-vctools instead of choco install vcbuildtools as mentioned above.

tcr avatar Jun 28 '18 00:06 tcr

I also tried it, and it works fine.

Although I did not use either visualstudio2017-workload-vctools nor vcbuildtools, but installed those without chocolatey.

But rustup was installed just fine, and contained the newest version of itself, etc..

CGMossa avatar Jun 14 '19 11:06 CGMossa

Oh sorry, totally dropped the ball on it. Looks like we should publish

vors avatar Jun 14 '19 17:06 vors

@vors please do

rbtcollins avatar Jun 25 '19 07:06 rbtcollins

Published, awaiting choco automated test / review

vors avatar Jul 06 '19 17:07 vors

@ferventcoder I fixed the package so it passes the tests, can you stamp it?

vors avatar Jul 12 '19 00:07 vors

@vors The community moderators will take a look and move that if they haven't already.

ferventcoder avatar Aug 02 '19 23:08 ferventcoder

They haven't already as reviewed - package is not good enough to be published and requires maintainer to fix it.

majkinetor avatar Aug 06 '19 11:08 majkinetor

I don't have a windows machine and energy to take another iteration on it at the moment. Please, continue to use choco install rustup -pre for the time being.

vors avatar Aug 14 '19 17:08 vors

Apparently the checksum has changed again, breaking the choco package.

Error - hashes do not match. Actual value was '9F9E33FA4759075EC60E4DA13798D1D66A4C2F43C5500E08714399313409DCF5'.
ERROR: Checksum for 'C:\Users\appveyor\AppData\Local\Temp\1\chocolatey\rustup.install\1.19.0\rustup-init.exe' did not meet 'E325B428A0FF9132B59EC586E85B1DB4EAA66ACC13B3DAF8090520D2E7694388' for checksum type 'sha256'. Consider passing the actual checksums through with --checksum --checksum64 once you validate the checksums are appropriate. A less secure option is to pass --ignore-checksums if necessary.

exarkun avatar Jan 07 '20 16:01 exarkun