Open o-l-a-v opened 2 months ago
Thank you for opening this issue, we will look into it.
Hi @o-l-a-v, I noticed https://github.com/Beaver-Notes/Beaver-Notes/releases/tag/3.5.0 puts SHA256s in the release description:
https://github.com/PowerShell/PowerShell/releases/tag/v7.4.4 uses a different format:
How does Scoop extract this information from plaintext?
I have a PR on Beaver Notes for Scoop that shows the info Scoop needs to fetch the SHA256 checksums:
Here's the manifest for pwsh, looks like it fetches SHA256 info from release info too:
Here's info on the Scoop app manifest:
Here's Scoop main manifest repos, see if you can find more examples there:
Edit: And I believe the logic for getting new versions is found inside here:
Which calls Invoke-AutoUpdate
from here:
Thanks @o-l-a-v, but I think you misunderstand my question.
In other words, how is 6461dd3fda39fc65e30c7642f863b9e1dabe32885043094e1d8a79dffcef1dcb
extracted from https://github.com/PowerShell/PowerShell/releases/tag/v7.4.4 to https://github.com/ScoopInstaller/Main/blob/75c4fa28f734a4849633a8bd920013bf7d93911a/bucket/pwsh.json#L16 ? Is this a manual process? Or is there a standard format? I would like to know which format you want us to use to provide the SHA256s.
BTW, I noticed Scoop computes the SHA256 of https://azcliprod.blob.core.windows.net/zip/azure-cli-2.63.0-x64.zip by itself: https://github.com/ScoopInstaller/Main/blob/75c4fa28f734a4849633a8bd920013bf7d93911a/bucket/azure-cli.json#L13
As the feature request states: Scoop can calculate SHA256 by downloading the artifact. But if checksum is already made available and Scoop is told were to look, it does not have to 1) download the artifact and 2) calculate hash.
Scoop has logic to autoupdate manifests. If we add hash ("autoupdate":{"hash": {}}
) property to the manifest JSON, Scoop will try to find the checksums depending on the logic. So for Beaver-Notes https://github.com/ScoopInstaller/Extras/pull/13661/files:
{
...
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/$version/Beaver-notes.$version.portable.exe#/dl.7z"
},
"arm64": {
"url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/download/$version/Beaver-notes.$version.portable.arm64.exe#/dl.7z"
}
},
"hash": {
"url": "https://github.com/Beaver-Notes/Beaver-Notes/releases/tag/$version",
"regex": "$sha256.*?$basename"
}
}
}
And for pwsh https://github.com/ScoopInstaller/Main/blob/master/bucket/pwsh.json:
{
...
"autoupdate": {
"architecture": {
"64bit": {
"url": "https://github.com/PowerShell/PowerShell/releases/download/v$version/PowerShell-$version-win-x64.zip"
},
"32bit": {
"url": "https://github.com/PowerShell/PowerShell/releases/download/v$version/PowerShell-$version-win-x86.zip"
},
"arm64": {
"url": "https://github.com/PowerShell/PowerShell/releases/download/v$version/PowerShell-$version-win-arm64.zip"
}
},
"hash": {
"url": "$baseurl/hashes.sha256"
}
}
}
There are som find_hash_in_x
functions inside here:
You could probably also just add checksum files to the GitHub release instead of adding it as plain text, if you prefer that.
Thank you for the detailed explanation. find_hash_in_textfile
looks a little bit fragile. I think creating a hashes.sha256
with sha256sum --binary *
is a more formal and reliable implementation. We will consider this as a feature request.
BTW, we can reuse the code from https://github.com/PowerShell/PowerShell/blob/a1774fd9332925f7635e0832b64b2d158e3a3745/.pipelines/templates/release-githubtasks.yml#L88-L104
Related command
Add checksums (SHA256) to releases for all files, be it files hosted on GitHub (MSI, source code), and files from
azcliprod.blob.core.windows.net
(ZIP, MSI etc.).Is your feature request related to a problem? Please describe.
azcliprod.blob.core.windows.net
is so slow.Describe the solution you'd like
Add a list to GitHub releases with SHA256, like Beaver Notes does:
Describe alternatives you've considered
None.
Additional context
None.