-
Notifications
You must be signed in to change notification settings - Fork 0
fix(ci): accept multi-arch Scoop manifests in validator #11
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -37,18 +37,64 @@ jobs: | |
| import glob | ||
| import json | ||
|
|
||
| required = {"version", "description", "homepage", "license", "url", "hash"} | ||
| # Top-level keys every manifest must carry. | ||
| top_required = {"version", "description", "homepage", "license"} | ||
| # url + hash may live either at the root OR nested under | ||
| # architecture.{32bit,64bit,arm64}.* for multi-arch manifests | ||
| # (GoReleaser v2, modern Scoop). Either shape is valid. | ||
| arch_required = {"url", "hash"} | ||
| arch_keys = {"64bit", "32bit", "arm64"} | ||
|
Comment on lines
+40
to
+46
|
||
|
|
||
| files = glob.glob("bucket/*.json") | ||
| if not files: | ||
| print("No Scoop manifests found") | ||
| raise SystemExit(0) | ||
|
|
||
| errors = [] | ||
| for path in files: | ||
| with open(path, "r", encoding="utf-8") as f: | ||
| data = json.load(f) | ||
| missing = required - set(data) | ||
| if missing: | ||
| raise SystemExit(f"{path}: missing required keys: {', '.join(sorted(missing))}") | ||
|
|
||
| missing_top = top_required - set(data) | ||
| if missing_top: | ||
| errors.append(f"{path}: missing top-level keys: {', '.join(sorted(missing_top))}") | ||
| continue | ||
|
|
||
| root_has_url_hash = arch_required.issubset(data.keys()) | ||
| arch = data.get("architecture") | ||
|
|
||
| if root_has_url_hash: | ||
| # Single-arch manifest — fine. | ||
| continue | ||
|
|
||
| if not isinstance(arch, dict) or not arch: | ||
| errors.append( | ||
| f"{path}: must have top-level url+hash OR an architecture.{{64bit|32bit|arm64}} block" | ||
| ) | ||
| continue | ||
|
|
||
| present_arches = [a for a in arch_keys if a in arch] | ||
| if not present_arches: | ||
| errors.append( | ||
| f"{path}: architecture block has no known arch key ({', '.join(sorted(arch_keys))})" | ||
| ) | ||
| continue | ||
|
|
||
| for a in present_arches: | ||
| block = arch.get(a) | ||
| if not isinstance(block, dict): | ||
| errors.append(f"{path}: architecture.{a} is not an object") | ||
| continue | ||
| missing = arch_required - set(block) | ||
| if missing: | ||
| errors.append( | ||
| f"{path}: architecture.{a} missing: {', '.join(sorted(missing))}" | ||
| ) | ||
|
|
||
| if errors: | ||
| for e in errors: | ||
| print(e) | ||
| raise SystemExit(1) | ||
| print(f"Validated {len(files)} Scoop manifest(s)") | ||
| PY | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,7 @@ | |
|
|
||
| Unified package repository for every `jbcom/*` project — Homebrew, | ||
| Scoop, and Chocolatey from one git tree. Public package index at | ||
| <https://jbcom.github.io/pkgs/>. | ||
| <https://jonbogaty.com/pkgs/>. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. While updating the documentation for the new domain, please note that the 'Validation' section later in this file (lines 121-131) still contains the 'legacy' validation logic that the PR description claims to be replacing. If the validator logic is indeed being updated in this PR (though currently missing from the diff), the example script in the README should also be updated to ensure local validation remains consistent with CI. |
||
|
|
||
| ## Install | ||
|
|
||
|
|
@@ -142,7 +142,7 @@ PY | |
|
|
||
| `deploy.yml` runs on every push to `main` using `withastro/action@v6`. | ||
| The built site is deployed to GitHub Pages at | ||
| <https://jbcom.github.io/pkgs/>. | ||
| <https://jonbogaty.com/pkgs/>. | ||
|
|
||
| ## License | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,10 +8,11 @@ import { ViteToml } from "vite-plugin-toml"; | |
| import tailwindcss from "@tailwindcss/vite"; | ||
|
|
||
| // jbcom/pkgs — package index site | ||
| // Served at https://jbcom.github.io/pkgs per Astro's GitHub Pages guide. | ||
| // Served at https://jonbogaty.com/pkgs/ via GitHub Pages custom-domain | ||
| // routing. jbcom.github.io/pkgs/ 301-redirects here automatically. | ||
|
|
||
| export default defineConfig({ | ||
| site: "https://jbcom.github.io", | ||
| site: "https://jonbogaty.com", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a significant discrepancy between the pull request title/description and the actual code changes. The PR title and summary describe a fix for the Scoop manifest validator to support multi-architecture manifests, but the provided diffs only contain changes related to a domain migration (from |
||
| base: "/pkgs", | ||
|
Comment on lines
+11
to
16
|
||
| integrations: [ | ||
| vue(), | ||
|
|
||
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.
arch_keysis a Pythonset, so iteration order is not guaranteed. This can makepresent_archesand the subsequent error output order nondeterministic across Python versions/runs. Use an ordered sequence (e.g., a list/tuple) forarch_keys, and derivepresent_archeswith that order (or sort explicitly).