quick hotfix + feat

hotfix for 404 url and
new feat for custom repo root (before /packages/)
This commit is contained in:
2026-08-07 15:00:01 -04:00
parent dd01ccb258
commit 78f48879bf
2 changed files with 15 additions and 4 deletions
+11 -1
View File
@@ -69,6 +69,8 @@ Commands:
Flags:
--output <dir> Output repository root (default: .)
Creates packages/<name>/ with tarball + package.lua
--repo <url> Base URL for generated package.lua manifests
(default: https://raw.githubusercontent.com/gretagen/...)
-j, --jobs <N> Number of parallel build jobs (default: nproc)
--no-index Don't update packages/index.lua after building
--keep-work Don't remove the build work directory
@@ -99,6 +101,7 @@ local function parse_cli(args)
help = false,
recipe = nil,
jobs = nil, -- nil = auto-detect (nproc)
repo = "https://raw.githubusercontent.com/gretagen/zeta-packages/refs/heads/main",
}
local i = 1
@@ -115,6 +118,13 @@ local function parse_cli(args)
return nil
end
opts.output = args[i]
elseif a == "--repo" then
i = i + 1
if i > #args then
io.stderr:write("error: --repo requires a URL argument\n")
return nil
end
opts.repo = args[i]
elseif a == "--no-index" then
opts.no_index = true
elseif a == "--keep-work" then
@@ -216,7 +226,7 @@ local function run_build(recipe_path, opts)
local tarball_sha256 = packager.create_tarball(stage_dir, tarball_path)
-- 10. Write package.lua manifest
packager.write_manifest(r, tarball_sha256, pkg_dir)
packager.write_manifest(r, tarball_sha256, pkg_dir, opts.repo)
-- 11. Update index
if not opts.no_index then
+4 -3
View File
@@ -97,7 +97,8 @@ 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)
function packager.write_manifest(recipe, tarball_sha256, pkg_dir, repo)
local repo = repo or "https://raw.githubusercontent.com/gretagen/zeta-packages/refs/heads/main"
local lines = {}
local function emit(fmt, ...)
lines[#lines + 1] = string.format(fmt, ...)
@@ -107,8 +108,8 @@ function packager.write_manifest(recipe, tarball_sha256, pkg_dir)
emit(' name = "%s",', recipe.name)
emit(' version = "%s",', recipe.version)
emit(' summary = "%s",', escape(recipe.summary))
emit(' url = "https://github.com/gretagen/zeta-packages/packages/%s/%s-%s.tar.gz",',
recipe.name, recipe.name, recipe.version)
emit(' url = "%s/packages/%s/%s-%s.tar.gz",',
repo, recipe.name, recipe.name, recipe.version)
emit(' sha256 = "%s",', tarball_sha256)
if #recipe.deps > 0 then