-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Use Repair-WinGetPackageManager as a fallback install method #137066
Conversation
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.
For some reason, I could not get the script to work on my VM. Didn't have much time to debug, but I suspect it's cause I messed something up in my VM. I'll see if I can find the time to debug, but I assume the script is working at your end, so I'm fine with the PR;
~/winget-pkgs .\Tools\SandboxTest.ps1 .\manifests\j\jqlang\jq\1.6\
--> Validating Manifest
Manifest validation succeeded.
Get-Content: C:\Users\User\winget-pkgs\Tools\SandboxTest.ps1:143
Line |
143 | $_.Value = ($((Get-Content "Env:$($_.Name)") + ";$($_.Value …
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| Cannot process argument because the value of argument "path" is not valid. Change the value of the "path" argument and run the operation again.
* Fix ScriptAnalyzer warnings * Add Try-Catch * Update comment
Seems it was an issue with variable parsing. Not sure why it wasn't showing up for me earlier, but this should be fixed now. |
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.
Got the script running with the latest commits;
Just realized having these changes does mean we got rid of the local caching we used to do with the binaries; Each run is significantly slower now😥For validating manifests locally, I don't know if I value the script never breaking over script breaking once a while but allowing me to validate much faster every time. I'll leave this to you though
That is a good point and is something I noticed as well. I wonder if both could be implemented; Try using the local cache, and if theres a hash error, instead of throwing and exiting the script, use the Repair-WinGetPackageManager method |
I like the sound of that, but given my understanding of its implementation, that may mean users won't notice a hash mismatch as the script won't ever fail. If a user isn't aware of this context, they may never realize that the script is executing sub-optimally and don't report an issue to update the hashes. Maybe we can have better messaging in the script to inform user of the hash mismatch and encourage the user to open an issue at https://github.com/microsoft/winget-pkgs? |
I think that I can add a message either way |
@mdanish-kh - That was easier than I thought it would be, whenever you want to take a look at it. Easiest way to trigger the fallback is to manually set the hash to an incorrect value |
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.
Love this, just a few minor comments
From @stephengillie's point in #136894, this PR
entirely removesreduces the dependency of the SandboxTest script to check the hash of VCLibs, UI.Xaml, or WinGet. If the hash does not match or the file can't be downloaded, the SandboxTest script will now install theMicrosoft.Winget.Client
PowerShell module from the PSGallery and will use theRepair-WinGetPackageManager
function to bootstrap and install WinGet instead of failing outright.This ensures that if, or when, microsoft/winget-cli#3380 is completed, the SandboxTest script will not break.
However, it does mean that it takes longer to bootstrap as the cmdlets will need to download VCLibs, UIXaml, and the correct version of WinGet every time the sandbox is opened - whereas the current script copies them from the disk of the user's devicecc @mdanish-kh / @stephengillie / @denelon
Microsoft Reviewers: Open in CodeFlow