From 22e033cd800c00d01ef3b43b664bb5b5e7b18aff Mon Sep 17 00:00:00 2001 From: mpeterv Date: Thu, 7 Apr 2016 22:51:30 +0300 Subject: Don't report missing manifests in 'luarocks list' --- src/luarocks/list.lua | 4 ++-- src/luarocks/manif_core.lua | 12 +++++++----- src/luarocks/search.lua | 2 +- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/src/luarocks/list.lua b/src/luarocks/list.lua index fddded03..99868028 100644 --- a/src/luarocks/list.lua +++ b/src/luarocks/list.lua @@ -93,8 +93,8 @@ function list.run(...) local results = {} for _, tree in ipairs(trees) do - local ok, err = search.manifest_search(results, path.rocks_dir(tree), query) - if not ok then + local ok, err, errcode = search.manifest_search(results, path.rocks_dir(tree), query) + if not ok and errcode ~= "open" then util.warning(err) end end diff --git a/src/luarocks/manif_core.lua b/src/luarocks/manif_core.lua index d719caa2..87fc16cf 100644 --- a/src/luarocks/manif_core.lua +++ b/src/luarocks/manif_core.lua @@ -18,16 +18,18 @@ manif_core.manifest_cache = {} -- @param file string: The local filename of the manifest file. -- @param repo_url string: The repository identifier. -- @param quick boolean: If given, skips type checking. +-- @return table or (nil, string, string): the manifest or nil, +-- error message and error code ("open", "load", "run" or "type"). function manif_core.manifest_loader(file, repo_url, quick) - local manifest, err = persist.load_into_table(file) + local manifest, err, errcode = persist.load_into_table(file) if not manifest then - return nil, "Failed loading manifest for "..repo_url..": "..err + return nil, "Failed loading manifest for "..repo_url..": "..err, errcode end local globals = err if not quick then local ok, err = type_check.type_check_manifest(manifest, globals) if not ok then - return nil, "Error checking manifest: "..err + return nil, "Error checking manifest: "..err, "type" end end @@ -39,8 +41,8 @@ end -- All functions that use manifest tables assume they were obtained -- through either this function or load_manifest. -- @param repo_url string: URL or pathname for the repository. --- @return table or (nil, string): A table representing the manifest, --- or nil followed by an error message. +-- @return table or (nil, string, string): A table representing the manifest, +-- or nil followed by an error message and an error code, see manifest_loader. function manif_core.load_local_manifest(repo_url) assert(type(repo_url) == "string") diff --git a/src/luarocks/search.lua b/src/luarocks/search.lua index 5e6cf50e..a06fdd45 100644 --- a/src/luarocks/search.lua +++ b/src/luarocks/search.lua @@ -170,7 +170,7 @@ end -- If the arch field is omitted, the local architecture (cfg.arch) -- is used. The special value "any" is also recognized, returning all -- matches regardless of architecture. --- @return true or, in case of errors, nil and an error message. +-- @return true or, in case of errors, nil, an error message and an optional error code. function search.manifest_search(results, repo, query) assert(type(results) == "table") assert(type(repo) == "string") -- cgit v1.2.3-55-g6feb