-
Notifications
You must be signed in to change notification settings - Fork 7.1k
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
Allow use of build module on unknown Linux distros #11146
Conversation
What family of distro's does this work with? |
Arch Linux at the very least (in fact, community-maintained Arch packages are mentioned here, but they are being built manually), probably also its derivatives. And I suppose some Gentoo people could also make use of this. I can successfully build PowerShell on my Arch PC with this change when using the build module. |
@Saancreed some feature that rely on native component may not work, such as WinRM based remoting. |
@TravisEz13 for which I think it's fair to warn. But I don't see a specific need to hamper efforts to expand PS's possibilities on "not supported" architectures. The warning message seems appropriate and still allows enterprising users the ability to at least try despite the potential for some missing / broken bits and pieces. 🙂 |
@TravisEz13 That is true, and frankly I'm not sure if I can somehow check that. But if some features are indeed broken, then using binaries built and linked against whatever glibc and openssl some distros currently use can help more than it can hurt. @vexx32 Yep, if Arch users can make (parts of) PowerShell work that it's worth to make an AUR package, then they will use it even if some things don't work. |
@Saancreed Thanks for your contribution! I think we need to add new explicit switch parameter (-SkipLinuxDistroCheck with a comment that it is not supported) to enable the scenario without a risk to break supported build scenario. |
@iSazonov Supported build scenarios shouldn't be affected by this change at all, so introducing extra switch seems redundant (and makes the change not as simple as I orginally intended). The message itself is still printed to the console as warning, which preserves its visibility but still makes it clear to the user that building in such environments is not officially supported. That said, if PowerShell team prefers a switch over succeeding with a warning, I can try and rewrite this PR into something like that. |
We change Build.psm1 module frequently. I believe the new switch will protect both the proposed scenario and regular build scenarios too. Also for the switch we could add a comment that the scenario is not supported and not recommended. |
I tend to agree with @iSazonov . The error message can tell you about the switch to bypass the check. |
@iSazonov @TravisEz13 Sounds fair, but one issue I can see is that the error is thrown when the module is imported, and there we can pass arguments only with |
You could update the message to inform user how bypass. So if we import the module without the argument we get throw and the message ("use ipmo .\Build.psm1 -ArgumentList SkipLinuxDistroCheck"). If we import with the argument we don't throw and get only warning that the scenario is not supported. |
@TravisEz13 @iSazonov Any thoughts on the second iteration of this PR? |
restarted static analysis |
@PoshChan Please remind me in 1 day |
@TravisEz13, this is the reminder you requested 1 day ago |
@PoshChan Please remind me in 5 days |
@TravisEz13, this is the reminder you requested 5 days ago |
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
@Saancreed Please resolve merge conflicts. @TravisEz13 The PR is waiting your review. |
🎉 Handy links: |
PR Summary
The build module
build.psm1
currently throws an error when imported on unrecognized Linux distributions. This PR allows the module to be used in such cases, while preserving the "not supported" message as warning.PR Context
Building PowerShell Core on distros like Arch Linux, while unsupported by Microsoft / PowerShell Team, is already possible as long as build dependencies are provided by the user. In such cases, the most simple way to do so would be to skip the toolchain bootstrapping steps as outlined here and ensure that they are satisfied by distro-specific tools (Arch: a
PKGBUILD
withdepends
andmakedepends
ensures that necessary runtime and/or build packages are provided bypacman
). After that, we could usebuild.psm1
to build PowerShell from source, which is currently not possible because of hard exception thrown fromGet-EnvironmentInformation
function, even though the build could still continue and succeed as normal.PR Checklist
.h
,.cpp
,.cs
,.ps1
and.psm1
files have the correct copyright headerWIP:
or[ WIP ]
to the beginning of the title (theWIP
bot will keep its status check atPending
while the prefix is present) and remove the prefix when the PR is ready.