Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an install.ps1 PowerShell script to install opam on Windows #5906

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

kit-ty-kate
Copy link
Member

@kit-ty-kate kit-ty-kate commented Apr 3, 2024

Fixes #5800

@kit-ty-kate kit-ty-kate added the PR: WIP Not for merge at this stage label Apr 3, 2024
@dra27 dra27 self-assigned this Apr 8, 2024
@rjbou rjbou requested a review from dra27 April 8, 2024 12:46
@kit-ty-kate kit-ty-kate added this to the 2.2.0~beta3 milestone Apr 10, 2024
@kit-ty-kate kit-ty-kate removed this from the 2.2.0~beta3 milestone May 7, 2024
@kit-ty-kate kit-ty-kate marked this pull request as ready for review May 23, 2024 16:04
@kit-ty-kate kit-ty-kate added PR: WAITING FOR REVIEW and removed PR: WIP Not for merge at this stage labels May 23, 2024
@kit-ty-kate kit-ty-kate added this to the 2.2.0~rc1 milestone Jun 11, 2024
@kit-ty-kate
Copy link
Member Author

kit-ty-kate commented Jun 12, 2024

I have a branch used for kit-ty-kate/opam@windows-installer...windows-installer.debug, which improves the behaviour of the current script on Github Action, however I'm not particularly happy with the code and hasn't been tested outside of Github Action.

It would be nice to have the two version merged

@kit-ty-kate
Copy link
Member Author

kit-ty-kate commented Jun 18, 2024

I merged the necessary changes for the script to also work on GitHub Actions as well as some improvements as directed by David in kit-ty-kate/opam@windows-installer...windows-installer-2

@dra27 when you have some time could you double-check the diff before i merge the windows-installer-2 branch into this one? I've tested it with a variety of configurations and i am relatively confident with it.

EDIT: i merged the two. This is ready to review

@kit-ty-kate kit-ty-kate force-pushed the windows-installer branch 2 times, most recently from 45acb3a to d8c5851 Compare June 21, 2024 01:00
@dra27 dra27 removed their request for review June 21, 2024 13:42
@dra27
Copy link
Member

dra27 commented Jun 21, 2024

@mtelvers - please could you give this a final look over? (and many thanks for the suggestions and improvements so far!)

Copy link
Contributor

@mtelvers mtelvers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

$PATH = [Environment]::GetEnvironmentVariable('PATH', $loc)
if (-not ($PATH -split ';' -contains $OpamBinDir)) {
[Environment]::SetEnvironmentVariable('PATH', "$OpamBinDir;$PATH", $loc)
if ($loc -eq 'PROCESS') {
Copy link
Contributor

@mtelvers mtelvers Jun 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could dispense with the if ($loc -eq 'PROCESS') comparison by moving the Write-Host block to after the foreach loop.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that should be -ne... the idea was the message is only displayed if the registry is actually updated... although maybe that's over-thinking it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The registry will be updated exactly once by the loop either machine or user.
It can still be after and use $EnvTarget rather than $loc in the Write-Host.
It's a trivial point. Let's not spend more time on it. :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not on a subsequent install though - if the user uses the script a second time (registry already updated), then the registry is updated zero times and at that point I was trying to suppress the message?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, very good point!

Copy link
Collaborator

@rjbou rjbou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, working smoothly!

@dra27 dra27 merged commit ca32ab3 into ocaml:master Jun 21, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide an installer and an install target on Windows
4 participants