aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorV1K1NGbg <victor@ilchev.com>2024-07-13 00:40:44 +0300
committerV1K1NGbg <victor@ilchev.com>2024-08-05 20:49:17 +0300
commit4e22238dee4edc0e2a8a5a9dc67d2527f58fa1b1 (patch)
tree4d61c309b907ea8cdbf689a705f5db4f7e8b2e48
parent47343ebfbb5e8565dae31678a39bf8b90d20e9bf (diff)
downloadluarocks-4e22238dee4edc0e2a8a5a9dc67d2527f58fa1b1.tar.gz
luarocks-4e22238dee4edc0e2a8a5a9dc67d2527f58fa1b1.tar.bz2
luarocks-4e22238dee4edc0e2a8a5a9dc67d2527f58fa1b1.zip
second try
-rw-r--r--src/luarocks/core/manif.lua12
-rw-r--r--src/luarocks/core/manif.tl10
2 files changed, 11 insertions, 11 deletions
diff --git a/src/luarocks/core/manif.lua b/src/luarocks/core/manif.lua
index ec491383..da4aef9f 100644
--- a/src/luarocks/core/manif.lua
+++ b/src/luarocks/core/manif.lua
@@ -1,4 +1,4 @@
1local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local table = _tl_compat and _tl_compat.table or table 1local _tl_compat; if (tonumber((_VERSION or ''):match('[%d.]*$')) or 0) < 5.3 then local p, m = pcall(require, 'compat53.module'); if p then _tl_compat = m end end; local assert = _tl_compat and _tl_compat.assert or assert; local ipairs = _tl_compat and _tl_compat.ipairs or ipairs; local table = _tl_compat and _tl_compat.table or table
2 2
3local persist = require("luarocks.core.persist") 3local persist = require("luarocks.core.persist")
4local cfg = require("luarocks.core.cfg") 4local cfg = require("luarocks.core.cfg")
@@ -71,12 +71,12 @@ end
71 71
72function manif.manifest_loader(file, repo_url, lua_version) 72function manif.manifest_loader(file, repo_url, lua_version)
73 local manifest, err, errcode = persist.load_into_table(file) 73 local manifest, err, errcode = persist.load_into_table(file)
74 if type(err) == "string" then 74 if not manifest then
75 return nil, "Failed loading manifest for " .. repo_url .. ": " .. err, errcode 75 return nil, "Failed loading manifest for " .. repo_url .. ": " .. tostring(err), errcode
76 end 76 end
77 77
78 manif.cache_manifest(repo_url, lua_version, manifest) 78 manif.cache_manifest(repo_url, lua_version, manifest)
79 return manifest 79 return manifest, nil, nil
80end 80end
81 81
82 82
@@ -85,6 +85,7 @@ end
85 85
86 86
87function manif.fast_load_local_manifest(repo_url) 87function manif.fast_load_local_manifest(repo_url)
88 assert(type(repo_url) == "string")
88 89
89 local cached_manifest = manif.get_cached_manifest(repo_url) 90 local cached_manifest = manif.get_cached_manifest(repo_url)
90 if cached_manifest then 91 if cached_manifest then
@@ -100,8 +101,7 @@ function manif.load_rocks_tree_manifests(deps_mode)
100 path.map_trees(deps_mode, function(tree) 101 path.map_trees(deps_mode, function(tree)
101 local manifest = manif.fast_load_local_manifest(path.rocks_dir(tree)) 102 local manifest = manif.fast_load_local_manifest(path.rocks_dir(tree))
102 if manifest then 103 if manifest then
103 local tree_manifest = { tree = tree, manifest = manifest } 104 table.insert(trees, { tree = tree, manifest = manifest })
104 table.insert(trees, tree_manifest)
105 end 105 end
106 end) 106 end)
107 return trees 107 return trees
diff --git a/src/luarocks/core/manif.tl b/src/luarocks/core/manif.tl
index dd45890e..f3ba3c20 100644
--- a/src/luarocks/core/manif.tl
+++ b/src/luarocks/core/manif.tl
@@ -71,12 +71,12 @@ end
71-- error message and error code ("open", "load", "run"). 71-- error message and error code ("open", "load", "run").
72function manif.manifest_loader(file: string, repo_url: string, lua_version: string): Manifest, string, string 72function manif.manifest_loader(file: string, repo_url: string, lua_version: string): Manifest, string, string
73 local manifest, err, errcode: {any: any}, {any: any} | string, string = persist.load_into_table(file) 73 local manifest, err, errcode: {any: any}, {any: any} | string, string = persist.load_into_table(file)
74 if err is string then 74 if not manifest then
75 return nil, "Failed loading manifest for "..repo_url..": " ..err, errcode 75 return nil, "Failed loading manifest for "..repo_url..": " ..tostring(err), errcode
76 end 76 end
77 77
78 manif.cache_manifest(repo_url, lua_version, manifest as Manifest) -- No runtime check if manifest is actually a Manifest! 78 manif.cache_manifest(repo_url, lua_version, manifest as Manifest) -- No runtime check if manifest is actually a Manifest!
79 return manifest as Manifest 79 return manifest as Manifest, nil, nil
80end 80end
81 81
82--- Load a local manifest describing a repository. 82--- Load a local manifest describing a repository.
@@ -85,6 +85,7 @@ end
85-- @return table or (nil, string, string): A table representing the manifest, 85-- @return table or (nil, string, string): A table representing the manifest,
86-- or nil followed by an error message and an error code, see manifest_loader. 86-- or nil followed by an error message and an error code, see manifest_loader.
87function manif.fast_load_local_manifest(repo_url: string): Manifest | nil, string, string 87function manif.fast_load_local_manifest(repo_url: string): Manifest | nil, string, string
88 assert(type(repo_url) == "string")
88 89
89 local cached_manifest = manif.get_cached_manifest(repo_url) 90 local cached_manifest = manif.get_cached_manifest(repo_url)
90 if cached_manifest then 91 if cached_manifest then
@@ -100,8 +101,7 @@ function manif.load_rocks_tree_manifests(deps_mode: string): {Tree_manifest}
100 path.map_trees(deps_mode, function(tree: cfg.Tree) 101 path.map_trees(deps_mode, function(tree: cfg.Tree)
101 local manifest= manif.fast_load_local_manifest(path.rocks_dir(tree)) 102 local manifest= manif.fast_load_local_manifest(path.rocks_dir(tree))
102 if manifest then 103 if manifest then
103 local tree_manifest: Tree_manifest = {tree=tree, manifest=manifest} 104 table.insert(trees, {tree=tree, manifest=manifest})
104 table.insert(trees, tree_manifest)
105 end 105 end
106 end) 106 end)
107 return trees 107 return trees