-
-
Notifications
You must be signed in to change notification settings - Fork 311
Fix PATH on Windows #20
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
Conversation
eregon
commented
Feb 9, 2020
- See setup-ruby removes chocolatey from PATH #19
34f3cbd
to
04a6a07
Compare
windows.js
Outdated
@@ -62,7 +62,8 @@ async function linkMSYS2() { | |||
} | |||
|
|||
export function setupPath(msys2, rubyPrefix) { | |||
let path = process.env['PATH'].split(';') | |||
const originalPath = process.env['PATH'].split(';') | |||
let path = originalPath.slice() | |||
|
|||
// Remove conflicting dev tools from PATH | |||
path = path.filter(e => !e.match(/\b(Chocolatey|CMake|mingw64|OpenSSL|Strawberry)\b/)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MSP-Greg @slonopotamus What do you think is the best way to proceed?
- Remove this line entirely
- Make it an option to clean to path, and choose a default value
- Remove only
Chocolatey
from this line
What are the risks if we keep any of them in PATH?
Ideally I think a setup-*
action shouldn't remove anything in PATH except a conflicting tool (Ruby, done below).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are the risks if we keep any of them in PATH?
Confused people.
Ideally I think a setup-* action shouldn't remove anything in PATH except a conflicting tool.
I think that would be best. If people want to use MSYS2, they can use a windows specific action or MSYS2 commands.
But as mentioned, A windows specific option to clean the path and enable MSYS2 might be helpful. It's easy, and that's what the majority of Windows Ruby CI (that requires MinGW compile tools) is doing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But as mentioned, A windows specific option to clean the path and enable MSYS2 might be helpful. It's easy, and that's what the majority of Windows Ruby CI (that requires MinGW compile tools) is doing.
I think most people expect MSYS2 to be available by default.
And I would think there are cases where one wants both MSYS2 and installing packages with choco
. Or is that always problematic/a mistake?
With that thinking, if we add an option it would just be an option to clean the PATH, and otherwise leave it untouched (except adding/removing Ruby). I'd still add MSYS2 no matter what, as I don't think there is a need for "no MSYS2" (and therefore "cannot compile C extensions").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@slonopotamus For context, what do you want to install with Chocolatey?
Is it something that could be installed with MSYS2's pacman instead?
Do you need to be able to install C extensions on Ruby on Windows?
@MSP-Greg Would installing via pacman generally work better than with Chocolatey for use with Ruby?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would installing via pacman generally work better than with Chocolatey for use with Ruby?
I've helped a lot of extension gems/repos with Windows CI, and I don't recall ever using a 'Chocolatey package' for compiling. But, some repos may use it for other requirements.
Just some random software, totally Ruby-unrelated: graphviz, gnuplot, imagemagick. What I am actually trying to do is to convert asciidoctor-diagram appveyor.yml to GH-Actions. |
32 bit Ruby? Do you need that? I've asked for 32 bit MSYS2 tools on Actions, but they can't seem to decide about MSYS2. |
Err... I don't understand where you see that. As I said, I use Chocolatey for non-Ruby software. |
The matrix (shown below) is all 32 bit Ruby builds. Normally, 64 bit has a If you're not compiling anything for Ruby, it doesn't matter, but Actions is only 64 bit Rubies.
|
There are MSYS2 packages for all these 3: https://packages.msys2.org/base I think the advantage of using those (anyone correct me if I'm wrong, I'm not very familiar with Windows) is if any Ruby gem compiles against one of them there would be a much higher chance for it to work, since it would use the same kind of toolchain Ruby was compiled with. What does Chocolatey uses for the build toolchain? mingw-x64? MSYS2? Something else? |
Okay, no, I'm not trying to use 32-bit Ruby. Here's my work-in-progress workflow file (it doesn't work properly yet): https://github.com/slonopotamus/asciidoctor-diagram/blob/gh-actions/.github/workflows/ci.yml |
That's not specific to Chocolatey. One can install MSYS2 with Chocolatey. So, what it has is what GH decided to pre-install (I think). |
Chocolatey is used to just install Windows software. It's not a build environment.
The point about Chocolatey is that it is a convenient way to install and update programs on Windows without the need to go to multiple websites searching for installers. You may see Chocolatey on non-programmer machines, unlike MSYS2 that is kinda specific thing. You would normally use MSYS2 tools from within a MSYS2 shell. This is not the case of Chocolatey, it mostly provides native Windows software. |
Right, but those precompiled Chocolatey packages must have been compiled with some toolchain. As seen in https://github.com/eregon/setup-ruby-test/runs/434763137, there is a toolchain pre-installed in Chocolatey. I'm not sure which one it is but I'd guess MinGW. OK, I agree we should let users use Chocolatey if they want to. So how about not removing Chocolatey from the PATH, and see how that goes? I can also add an option to remove nothing but Ruby from the PATH.
Could you give an example of what could go wrong if we remove nothing but Ruby from the PATH, and still have MSYS2 paths at the start of the PATH? |
Chocolatey doesn't provide build infrastructure, it only handles installation step. You can just wrap pre-existing MSI package in Chocolatey and you don't need to know how and with what tools that MSI was created.
I think everything should be fine as long as you add whatever is needed for Ruby at the beginning of PATH. |
OK, I propose to just not remove anything from PATH then, except the system Ruby (no point to have 2 Ruby in PATH). @MSP-Greg Is that OK with you? |
Yes
I'd suggest waiting on it. We can always add to the README about windows compile issues... |
* It's quite verbose (22 lines) and there is no quiet flag.
* This might lead to more conflicts, but the flip side of a setup action removing capabilities seems worse and unexpected. * See #19
* It already ran on the feature branch.
c30207d
to
53b22d2
Compare
Merged and added notes in the README about Windows in 4f28d1c |