quick hotfix + feat
hotfix for 404 url and new feat for custom repo root (before /packages/)
This commit is contained in:
@@ -69,6 +69,8 @@ Commands:
|
|||||||
Flags:
|
Flags:
|
||||||
--output <dir> Output repository root (default: .)
|
--output <dir> Output repository root (default: .)
|
||||||
Creates packages/<name>/ with tarball + package.lua
|
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)
|
-j, --jobs <N> Number of parallel build jobs (default: nproc)
|
||||||
--no-index Don't update packages/index.lua after building
|
--no-index Don't update packages/index.lua after building
|
||||||
--keep-work Don't remove the build work directory
|
--keep-work Don't remove the build work directory
|
||||||
@@ -99,6 +101,7 @@ local function parse_cli(args)
|
|||||||
help = false,
|
help = false,
|
||||||
recipe = nil,
|
recipe = nil,
|
||||||
jobs = nil, -- nil = auto-detect (nproc)
|
jobs = nil, -- nil = auto-detect (nproc)
|
||||||
|
repo = "https://raw.githubusercontent.com/gretagen/zeta-packages/refs/heads/main",
|
||||||
}
|
}
|
||||||
|
|
||||||
local i = 1
|
local i = 1
|
||||||
@@ -115,6 +118,13 @@ local function parse_cli(args)
|
|||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
opts.output = args[i]
|
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
|
elseif a == "--no-index" then
|
||||||
opts.no_index = true
|
opts.no_index = true
|
||||||
elseif a == "--keep-work" then
|
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)
|
local tarball_sha256 = packager.create_tarball(stage_dir, tarball_path)
|
||||||
|
|
||||||
-- 10. Write package.lua manifest
|
-- 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
|
-- 11. Update index
|
||||||
if not opts.no_index then
|
if not opts.no_index then
|
||||||
|
|||||||
@@ -97,7 +97,8 @@ end
|
|||||||
-- The generated manifest uses archive mode (strip=1) and includes the
|
-- The generated manifest uses archive mode (strip=1) and includes the
|
||||||
-- computed sha256 of the binary tarball. Optional fields (deps, files,
|
-- computed sha256 of the binary tarball. Optional fields (deps, files,
|
||||||
-- test) are included when present in the recipe.
|
-- 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 lines = {}
|
||||||
local function emit(fmt, ...)
|
local function emit(fmt, ...)
|
||||||
lines[#lines + 1] = string.format(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(' name = "%s",', recipe.name)
|
||||||
emit(' version = "%s",', recipe.version)
|
emit(' version = "%s",', recipe.version)
|
||||||
emit(' summary = "%s",', escape(recipe.summary))
|
emit(' summary = "%s",', escape(recipe.summary))
|
||||||
emit(' url = "https://github.com/gretagen/zeta-packages/packages/%s/%s-%s.tar.gz",',
|
emit(' url = "%s/packages/%s/%s-%s.tar.gz",',
|
||||||
recipe.name, recipe.name, recipe.version)
|
repo, recipe.name, recipe.name, recipe.version)
|
||||||
emit(' sha256 = "%s",', tarball_sha256)
|
emit(' sha256 = "%s",', tarball_sha256)
|
||||||
|
|
||||||
if #recipe.deps > 0 then
|
if #recipe.deps > 0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user