Commit Graph
11 Commits
Author SHA1 Message Date
huntedbytheirs da19ac98b1 feat(build): invoke zeta-makepkg with conditional --force
- Add tofu.build module with runMakepkg() public API
- BuildException for missing binary, non-zero exit, missing output
- Real-time stdout/stderr streaming with last-20-lines stderr capture
- Conditional --force flag based on force parameter
- zetaToolchainPath resolution from Config
- 7 unittests using fake zeta-makepkg shell scripts
- pipeProcess + Redirect.stderr for tee approach
2026-08-08 18:05:07 -04:00
huntedbytheirs 7928b4d5f2 feat(resolve): generate build plan from constrained dep tree
Add generateBuildPlan() to tofu.resolve — filters constrained dep tree
to recipe-only packages, verifies cached recipes exist, and produces
an ordered BuildPlan ready for the build orchestrator (task 15).

- Skips binary-satisfied deps (Zeta handles those)
- Preserves topological order from constrained nodes (deps-first)
- Missing recipe files: re-fetch via injectable delegate seam
  (production wires tofu.fetch.fetchRecipe; tests inject mocks)
- Empty plan (all binary) → returns empty BuildPlan + log info
- Root always recipe — always included in plan
- 6 unittests: filter binary, fetch seam, missing no-seam,
  all-binary empty, root with binary dep, cache hit no-fetch
- dub test + dub build pass with warningsAsErrors
2026-08-08 17:58:25 -04:00
huntedbytheirs ba411e9fc4 feat(resolve): add version-constraint-aware dep resolution with binary fallback 2026-08-08 17:53:45 -04:00
huntedbytheirs 6a153ef1ac feat(deps): add dep tree builder with version constraint parsing
Port of ZETA lib/deps.lua depth-first resolution algorithm:
- DepNode/DepTree structs for topologically-ordered dependency trees
- resolveDepTree() with function-pointer seam for testability
- Cycle detection with full chain message (e.g. 'A -> B -> A')
- Memoization to skip already-resolved nodes
- Parses recipe.deps string[] into DepConstraint[] via DepConstraint.parse

7 unittests: constraint parsing, linear chain, self-cycle, mutual
cycle, missing dep propagation, diamond shared dep, leaf node.
2026-08-08 17:46:27 -04:00
huntedbytheirs b3cdde4d7c feat(cache): add recipe cache with index-version-based staleness check 2026-08-08 17:45:14 -04:00
huntedbytheirs d7d0d2ec6d feat(fetch): download ZUUR recipe directories to cache
Implements tofu.fetch module with fetchRecipe() that downloads
ZUUR recipe directories using a known-file strategy (no directory
listing assumed). Downloads .recipe (required), package.lua (optional),
build.sh (optional), and custom build_script references.

Key features:
- Light recipe scanning for build_system/build_script discovery
- 404 on .recipe → 'package not found' user-friendly error
- 404 on optional files → logged and skipped
- 404 on referenced build_script → real error
- Partial file cleanup on failure
- 5 unittests using python3 http.server for multi-file scenarios

8/8 modules pass, dub build succeeds with warnings-as-errors.
2026-08-08 17:38:41 -04:00
huntedbytheirs b367f21d29 feat(binary): check zuur/binary package.lua version against constraints 2026-08-08 17:38:21 -04:00
huntedbytheirs c876821cda feat(index): fetch and sandbox-parse ZUUR index.lua
- Module tofu.index: download index via tofu.http.get, sandbox parse via Lua subprocess
- Whitelist sandbox (ported from ZETA lib/sandbox.lua): index code has zero I/O/exec access
- Lua 5.1/5.2+ compatible: setfenv detection with fallback to load() env param
- JSON escaping: handles quotes, backslashes, control characters in string values
- Defensive parsing: skips entries with empty names or invalid pool values
- 10 unittest blocks: happy path, malicious os.execute/io.open blocked, lua not found, bad JSON, empty index, missing name skip, invalid pool skip, syntax error, string escaping
- Evidence: 7 modules pass unittests, dub build passes with warnings-as-errors
2026-08-08 17:37:59 -04:00
huntedbytheirs 777de734f8 feat(http): add synchronous HTTP client with std.net.curl 2026-08-08 17:30:34 -04:00
huntedbytheirs c545879115 feat(version): port rpm-style version comparison from ZETA 2026-08-08 17:22:06 -04:00
huntedbytheirs c331416623 feat(log): add colored NO_COLOR-aware logging 2026-08-08 17:16:50 -04:00