dep-fetcher 0.1.1: Case F — accept packaged installs without .git when manifest version matches pin
This commit is contained in:
34
init.lua
34
init.lua
@@ -420,6 +420,17 @@ M._detect_conflicts = detect_conflicts
|
|||||||
-- C — dirty : commits-past-tag or working-tree dirty → warn
|
-- C — dirty : commits-past-tag or working-tree dirty → warn
|
||||||
-- D — wrong-tag : describe != pinned-tag → silent checkout
|
-- D — wrong-tag : describe != pinned-tag → silent checkout
|
||||||
-- E — broken : describe fails entirely → error
|
-- 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,
|
local function run_state_check(unique_closure, install_root,
|
||||||
gitea_base, warnings, errors)
|
gitea_base, warnings, errors)
|
||||||
local git = require("lib-core.git")
|
local git = require("lib-core.git")
|
||||||
@@ -430,14 +441,21 @@ local function run_state_check(unique_closure, install_root,
|
|||||||
local pinned = "v" .. e.version
|
local pinned = "v" .. e.version
|
||||||
|
|
||||||
if not git.is_repo(lib_dir) then
|
if not git.is_repo(lib_dir) then
|
||||||
-- Case A: clone @ pinned-tag.
|
-- No .git dir present. Two sub-cases:
|
||||||
local ok, gerr = git.clone(url, lib_dir, pinned)
|
-- F — packaged install: dir exists with a manifest.lib at
|
||||||
if not ok then
|
-- the right version (cmake --install layout). Accept.
|
||||||
table.insert(errors, {
|
-- A — missing: dir absent or manifest mismatch → clone.
|
||||||
lib_id = e.lib_id,
|
if manifest_version_matches(lib_dir, e.version) then
|
||||||
kind = "net-fail",
|
-- Case F: packaged install, no action needed.
|
||||||
message = tostring(gerr),
|
else
|
||||||
})
|
local ok, gerr = git.clone(url, lib_dir, pinned)
|
||||||
|
if not ok then
|
||||||
|
table.insert(errors, {
|
||||||
|
lib_id = e.lib_id,
|
||||||
|
kind = "net-fail",
|
||||||
|
message = tostring(gerr),
|
||||||
|
})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local desc, derr = git.describe(lib_dir)
|
local desc, derr = git.describe(lib_dir)
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"id": "lib-management.dep-fetcher",
|
"id": "lib-management.dep-fetcher",
|
||||||
"version": "0.1.0",
|
"version": "0.1.1",
|
||||||
"api_min": "0.1",
|
"api_min": "0.1",
|
||||||
"deps": [
|
"deps": [
|
||||||
{"id": "lib-core.git", "version": "0.1.0"}
|
{"id": "lib-core.git", "version": "0.1.0"}
|
||||||
|
|||||||
Reference in New Issue
Block a user