feat(cli): replace the xgenext2fs spawn with @deroll/genext2fs - #517
Draft
tuler wants to merge 1 commit into
Draft
feat(cli): replace the xgenext2fs spawn with @deroll/genext2fs#517tuler wants to merge 1 commit into
tuler wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 590525b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Contributor
Coverage Report
📁 File Coverage (20 files)
|
Build ext2 drives through the @deroll/genext2fs N-API bindings, instead of spawning xgenext2fs (falling back to running it inside the SDK docker image). The bindings are given the same block size, faketime and readjustment settings the command line used, so drives stay byte identical. Since building a drive no longer needs docker, the version test moves from the integration suite to the unit one, where it also covers building images and their reproducibility. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UTEd5g3mF849BATTstssR3
tuler
force-pushed
the
claude/replace-xgenext2fs-rhhnsk
branch
from
August 17, 2026 21:11
d02ec21 to
590525b
Compare
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.
Contributes to #72.
Important
Stacked on #509 — that is this PR's base branch, so the diff shown here is only the ext2 change. Retarget to
prerelease/v2-alphaonce #509 merges.That issue asks for the external programs the CLI drives to stop being spawned binaries, and notes that "instead of spawning binaries another possibility is to build NodeJS bindings to native code components". #509 does the emulator; this one does the ext2 generator.
xgenext2fsexeca, falling back todocker runin the SDK image@deroll/genext2fsDocker is still needed to build the root drive from a Dockerfile (riscv64 via QEMU), for squashfs drives (
mksquashfs), and for the servicesrunbrings up.What changed
src/exec/genext2fs.ts—empty,fromDirectoryandfromTarcallcreateImage/tarToExt2instead of spawning. The bindings get the same block size, faketime and readjustment settings the old command lines used, so drive contents are unchanged. Paths are resolved against the destination directory, since there is no subprocesscwdto lean on anymore, and the diagnostics the tool writes to stderr are forwarded to the same reporter as before.version()is now a synchronous lookup of the vendored xgenext2fs version rather than a--versionsubprocess.requiredVersionstays, so the test still guards that the vendored version is one the CLI supports.The builders drop the
sdkImageargument they only passed togenext2fs—buildEmptyloses the parameter entirely, the others still need it formksquashfs.Testing
tests/integration/exec/totests/unit/exec/, since building a drive no longer needs Docker. It grew along the way: it now builds an empty drive and asserts its size, builds one from a directory, asserts the "too few blocks" failure still surfaces, and asserts two builds of the same input are byte identical (the reproducibility thatfaketimebuys).tests/integration/builder/empty.test.tsno longer pulls the SDK image.Note on the dependency
This is a personal-scope package, unlike
@cartesi/machinein #509.@deroll/cm→@cartesi/machinewas already planned and has landed;@deroll/genext2fsis newer than that comment and is not named in the plan, so whether it also moves under@cartesi/*is an open question.Worth a look from whoever owns licensing: it is GPL-2.0-only, inherited from xgenext2fs which it compiles in, while the CLI is Apache-2.0.
@cartesi/machineis Apache-2.0, so this applies only to the ext2 dependency.Generated by Claude Code