Repository navigation
feat(pkgdef): support the initial package set - #3035
Open
mikeland73 wants to merge 1 commit into
Open
mikeland73 wants to merge 1 commit into
mikeland73 wants to merge 1 commit into
Conversation
Implement what the initial package definitions need:
- Platforms a version is not published for: a 404 from a checksum file
or index, a checksum list without the file, a jq expression that
matches nothing or a GitHub release without the asset is ErrNoArtifact.
Lock leaves those systems out and fails only when none has an artifact;
installing on a left-out system is an error naming where the version is
available.
- install.lookup reads the artifact URL and checksum from a JSON index
(python-build-standalone via uv's index, Temurin, zig).
- install.version_overrides apply partial installs to versions matching a
constraint such as "<11" (pnpm, yarn, deno).
- versions may be a list of sources (yarn 1 and 2+ are different npm
packages). github_releases and http_json URLs with {{.Page}} paginate
lazily, stopping at the first page with a match.
- Versions with +build metadata (21.0.5+11) compare and prefix-match.
- sha512 digests and SRI strings, a sha512_url checksum type, and a
github_release type that reads GitHub's asset digests. devbox.lock gets
an omitempty sha512 per system.
- binaries are made executable after extraction and must exist after
install. post_install hooks run with /bin/sh and /usr/bin:/bin on PATH.
- Metadata requests are memoized per client, so locking four systems
fetches an index once. Install fingerprints include the version, since
overrides can make versions install differently.
- ensureStateIsUpToDate reloads plugin configs after installing, so a
version changed in devbox.json gets its definition's env and init hook
in the same run instead of the next one.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This branch has not been deployed
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.
Summary
Fifth PR of the package definitions stack. Implements the format features from #3034 that the initial package set needs, and fixes a wiring bug the package tests found.
Platforms a version isn't published for. A 404 from a checksum file or index, a checksum list without the file, a jq expression that matches nothing, or a GitHub release without the asset all mean
ErrNoArtifact.Lockleaves that system out and fails only when no platform has an artifact. Installing on a system the lock entry leaves out is a user error that names the platforms the version is available for.New format features:
install.lookup: read the URL and checksum from a JSON index with a jq expression. Used by python, java and zig.install.version_overrides: partial installs for versions matching a constraint (<11,>=2, <4). They apply before system overrides, and a version override can carry its own system overrides.versionsas a list of sources, combined.github_releasesreads 100 per page, andhttp_jsonpaginates when its URL contains{{.Page}}. Resolution stops at the first page with a match, solatestcosts one request.+buildmetadata compare correctly and prefix-match (21.0.12matches21.0.12+101). Build metadata containing letters is not a pre-release.sha256:/sha512:prefixes and SRI digests; a newsha512_urltype; andgithub_release, which reads GitHub's asset digests through the authenticated API.devbox.lockgets anomitemptysha512per system.binariesare made executable after extraction and must exist after install.post_installruns through/bin/sh, with/usr/bin:/binappended toPATH.splitList.Other library changes:
Wiring fix. After a version was changed in
devbox.json, the firstdevbox runresolved and installed it but ran without the definition's env and init hook (JAVA_HOME,RUSTUP_TOOLCHAIN, the python venv). Plugin configs are built at config load, before the lock entry exists.ensureStateIsUpToDatenow reloads includes after installing when the project has package definitions.Test plan
github_releasedigests (with token, null digest, missing asset); sha512 verification, including against the marker;binarieschmod and the missing-binary error; hooks with an emptyPATH; combined version sources; pagination forhttp_jsonand GitHub releases (stops early, stops at a 404 or a short page); version overrides precedence and validation; build metadata; constraintstestscripts/pkgdef: editingdevbox.jsonto a version not yet indevbox.lockapplies env and init hook in the same run. This fails without the fixgo test ./internal/..., golangci-lint and gofumpt clean🤖 Generated with Claude Code