cli/manifest/rocks: luarocks adapter over lib/luarocks#1312
Merged
Conversation
9672c2a to
2a8fabb
Compare
2a8fabb to
09ea70e
Compare
patapenka-alexey
approved these changes
Jul 2, 2026
sssciel
approved these changes
Jul 6, 2026
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
09ea70e to
4f606ae
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.
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 rocksbuild on.Part of TNTP-8230