Skip to content

cli/manifest/rocks: luarocks adapter over lib/luarocks#1312

Merged
bigbes merged 4 commits into
v3from
bigbes/tntp-8230-luarocks-bridge
Jul 6, 2026
Merged

cli/manifest/rocks: luarocks adapter over lib/luarocks#1312
bigbes merged 4 commits into
v3from
bigbes/tntp-8230-luarocks-bridge

Conversation

@bigbes

@bigbes bigbes commented Jun 29, 2026

Copy link
Copy Markdown
Collaborator

Add lib/luarocks, a pure-Go implementation of the LuaRocks subset needed to manage rocks inside a Tarantool installation, as part of the tt root module (not a separate Go module). It is the engine the manifest luarocks-adapter (cli/manifest/rocks) and the rewritten tt rocks build on.

  • lib/luarocks: add pure-Go LuaRocks engine
  • cli/rocks: run tt rocks on lib/luarocks, drop submodule
  • cli/manifest/rocks: luarocks adapter over lib/luarocks
  • ci: allow ISC license for go-git's emirpasic/gods dependency
  • rocks: drop internal design-doc tags and stale provenance from comments
  • test/integration/aeon: tidy mock server go.mod for updated tt deps

Part of TNTP-8230

@bigbes bigbes force-pushed the bigbes/tntp-8230-luarocks-bridge branch 2 times, most recently from 9672c2a to 2a8fabb Compare June 30, 2026 11:55
@bigbes bigbes force-pushed the bigbes/tntp-8230-luarocks-bridge branch from 2a8fabb to 09ea70e Compare July 1, 2026 21:30
bigbes added 4 commits July 6, 2026 20:58
Add lib/luarocks, a pure-Go implementation of the LuaRocks subset needed to
manage rocks inside a Tarantool installation, as part of the tt root module
(not a separate Go module). It is the engine the manifest luarocks-adapter
(cli/manifest/rocks) and the rewritten `tt rocks` build on; it embeds
Tarantool's LuaRocks fork (the luarocks-3.9.2-tarantool branch) for its
gopher-lua backend.

gopher-lua is bumped v1.1.1 -> v1.1.2, and go-git becomes a direct dependency
of the root go.mod for the http/git source fetcher.

The package is not yet consumed: cli/rocks still runs the embedded-luarocks
submodule and the adapter does not exist. Both land in follow-up commits.

Part of TNTP-8230
Replace the embedded-LuaRocks `tt rocks` engine with the in-tree pure-Go
LuaRocks engine (lib/luarocks). The hand-rolled gopher-lua loader and its
module preload map are gone; Exec now builds a luarocks.Config from the tt
environment and dispatches the verbatim argv through the BackendLua engine,
which runs the same upstream LuaRocks CLI as before.

* Remove the cli/rocks/third_party/luarocks git submodule and the
  cli/rocks/extra/ Lua shims (wrapper/hardcoded/macosx) - the embedded
  upstream LuaRocks now lives in lib/luarocks/internal/luarocks.
* Keep GetTarantoolPrefix, the --server/TT_CLI_REPO_ROCKS repo-path glue and
  the five TT_CLI_TARANTOOL_* env writes byte-for-byte, so build/local.go's
  `rocks make` hand-off and hardcoded.lua's compile-time contract are
  unchanged. The completions embed (used by `tt completion`) stays.

To preserve `tt rocks` behavior the client facade gains an Exec(ctx, progname,
argv) passthrough over a new non-capturing luaEngine.callRaw: programmatic
methods capture and reshape output, but the escape hatch must let LuaRocks
print to the terminal verbatim. progname is threaded through so usage still
reads "tt rocks" (and "tt rocks admin"), matching the old wrapper.lua.

Part of TNTP-8230
Add cli/manifest/rocks, the single point in tt that knows about
lib/luarocks. It builds a luarocks.Config from the tt environment, hands
out a client factory, and wraps the primitives the resolver, build and
registry layers compose. Policy (lock building, namespace layout, CLI
surface) stays with the callers; the adapter returns primitives.

* BuildConfig maps a TarantoolInfo (executable, prefix, version) plus
  tree/working-dir to luarocks.Config, defaulting servers to
  rocks.tarantool.org then luarocks.org and marking rocks.tarantool.org
  insecure (upstream luarocks distrusts its certificate).
* Ordered multi-server resolve (first-found-wins): query servers in
  order, first with the rock wins; a dependency's registry field pins a
  single server. The ordered index satisfies luarocks.RemoteIndex so the
  resolver can consume it directly. Generic rocks from luarocks.org go
  through the same fetch/build path as Tarantool rocks.
* Checksum extracts source.md5 as "md5:<hex>"; absent md5 returns
  ("", false) so the caller fixes the fallback (content-hash or empty).
* Metadata fetches+evals a rock's rockspec; FetchSource fetches the
  upstream source honoring source.tag/branch.
* Search/Download wrap the facade on BackendLua (the native backend does
  not implement them) so callers need not know the backend.
* Flags re-exports build.DeriveFlags bound to the config: one source of
  per-OS cc flags for both the rock builtin backend and the manifest
  c / lua-c component backends.

Extend the strict cli/manifest .golangci.yml depguard allowlist with
github.com/tarantool/tt/lib/luarocks. Tests drive resolve against fake
manifest-index servers (httptest) and cover config build, md5 extraction
and the per-OS cc flags.

Part of TNTP-8230
lib/luarocks pulls in go-git, whose transitive dependency
github.com/emirpasic/gods is dual-licensed BSD-2-Clause + ISC: it ships a few
ISC-licensed files alongside its BSD-2-Clause code. The lichen check
(.lichen.yaml) did not list ISC, so `mage checklicenses` failed the build.

ISC is a permissive, OSI/FSF-approved license equivalent to MIT / 2-clause
BSD. It has no copyleft - the only obligation is to preserve the copyright
notice - so it imposes nothing on tt's own code, and is strictly more
permissive than the MPL-2.0 / CC-BY-SA-4.0 already on the allow list. Add it.

Part of TNTP-8230
@bigbes bigbes force-pushed the bigbes/tntp-8230-luarocks-bridge branch from 09ea70e to 4f606ae Compare July 6, 2026 18:00
@bigbes bigbes merged commit 45154ab into v3 Jul 6, 2026
21 checks passed
@bigbes bigbes deleted the bigbes/tntp-8230-luarocks-bridge branch July 6, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants