dep-fetcher 0.1.1: Case F — accept packaged installs without .git when manifest version matches pin

This commit is contained in:
Axel Meyer
2026-05-31 02:27:43 +02:00
parent ed3e6aceb0
commit 5bf9a891f8
2 changed files with 27 additions and 9 deletions

View File

@@ -420,6 +420,17 @@ M._detect_conflicts = detect_conflicts
-- C — dirty : commits-past-tag or working-tree dirty → warn
-- D — wrong-tag : describe != pinned-tag → silent checkout
-- E — broken : describe fails entirely → error
-- F — packaged : lib dir exists, no .git/, manifest.lib version
-- matches pin → accept (cmake-staged install)
local function manifest_version_matches(lib_dir, expected_version)
local f = io.open(lib_dir .. "/manifest.lib", "rb")
if not f then return false end
local content = f:read("*a")
f:close()
local m, _ = json_decode(content)
return m ~= nil and m.version == expected_version
end
local function run_state_check(unique_closure, install_root,
gitea_base, warnings, errors)
local git = require("lib-core.git")
@@ -430,7 +441,13 @@ local function run_state_check(unique_closure, install_root,
local pinned = "v" .. e.version
if not git.is_repo(lib_dir) then
-- Case A: clone @ pinned-tag.
-- No .git dir present. Two sub-cases:
-- F — packaged install: dir exists with a manifest.lib at
-- the right version (cmake --install layout). Accept.
-- A — missing: dir absent or manifest mismatch → clone.
if manifest_version_matches(lib_dir, e.version) then
-- Case F: packaged install, no action needed.
else
local ok, gerr = git.clone(url, lib_dir, pinned)
if not ok then
table.insert(errors, {
@@ -439,6 +456,7 @@ local function run_state_check(unique_closure, install_root,
message = tostring(gerr),
})
end
end
else
local desc, derr = git.describe(lib_dir)
if not desc then

View File

@@ -1,6 +1,6 @@
{
"id": "lib-management.dep-fetcher",
"version": "0.1.0",
"version": "0.1.1",
"api_min": "0.1",
"deps": [
{"id": "lib-core.git", "version": "0.1.0"}