stackage: fall back to sha256 when sha1 is missing in stack-setup-2.yaml#196
Merged
shankerwangmiao merged 1 commit intotuna:masterfrom May 4, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Stackage mirror sync script to handle newer stack-setup-2.yaml entries that omit sha1 and provide only sha256, so syncing can continue for affected GHC metadata instead of failing with a KeyError.
Changes:
- Extend
StackageSession.download()to accept an optionalsha256checksum and pass it toaria2cwhensha1is absent. - Read each GHC entry into
metaand switch checksum lookup from hardcoded['sha1']access tometa.get(...)for graceful handling of mixed checksum formats.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+54
to
+55
| sha1=meta.get('sha1'), | ||
| sha256=meta.get('sha256'), |
Some GHC entries in upstream stack-setup-2.yaml (freebsd64-ino64 platform, versions 9.8.1 through 9.12.2) only provide sha256 without sha1. Previously the script hardcoded sha1 access, causing KeyError. - download() now accepts optional sha256, falls back to sha-256 checksum - load_stack_setup() explicitly selects sha1 or sha256; entries with neither checksum are skipped with a warning
88e92e0 to
afe1779
Compare
Contributor
Author
|
Good point — the call site should explicitly select sha1 or sha256 rather than silently allowing both to be None. Updated in the force-pushed commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Upstream
stack-setup-2.yaml(fromcommercialhaskell/stackage-content) has 921 GHC entries, but 8 entries under thefreebsd64-ino64platform (versions 9.8.1 through 9.12.2) only providesha256checksums withoutsha1.The script hardcoded
d['ghc'][platform][ver]['sha1'], causing aKeyErrorand sync failure whenever these entries appear.Fix
download()now accepts an optionalsha256keyword argumentsha1is available,sha-1checksum is used (backward compatible)sha1is missing butsha256is present,sha-256is used insteadmeta.get()for graceful degradationTested
stack-setup-2.yamlsha1continue to use sha-1 verification (unchanged)freebsd64-ino64entries with onlysha256now use sha-256 verification