patch: hooks from zeta

This commit is contained in:
2026-08-17 19:23:32 -04:00
parent 159f7bfe83
commit 551ba34cab
6 changed files with 204 additions and 2 deletions
+10 -1
View File
@@ -97,7 +97,13 @@ end
-- The generated manifest uses archive mode (strip=1) and includes the
-- computed sha256 of the binary tarball. Optional fields (deps, files,
-- test) are included when present in the recipe.
function packager.write_manifest(recipe, tarball_sha256, pkg_dir, repo)
--
-- `hooks` (optional) is a list of stage-relative paths of packaged hook
-- files (usr/share/zeta/hooks/*.hook). When `recipe.files` is set, the
-- hook paths are merged into the emitted files whitelist so the hooks are
-- committed alongside the whitelisted files. When `recipe.files` is nil,
-- hooks are ignored (all staged files commit anyway).
function packager.write_manifest(recipe, tarball_sha256, pkg_dir, repo, hooks)
local repo = repo or "https://raw.githubusercontent.com/gretagen/zeta-packages/refs/heads/main"
local lines = {}
local function emit(fmt, ...)
@@ -129,6 +135,9 @@ function packager.write_manifest(recipe, tarball_sha256, pkg_dir, repo)
for _, f in ipairs(recipe.files) do
file_strs[#file_strs + 1] = string.format('"%s"', escape(f))
end
for _, h in ipairs(hooks or {}) do
file_strs[#file_strs + 1] = string.format('"%s"', escape(h))
end
emit(' files = { %s },', table.concat(file_strs, ", "))
end