table.insert(entry[".fix"], k)
end
--- Debugging tools
---
--- e2tool.show_project_info(INFO)
---
--- Performs a simple dump of the project information in INFO.
-
-function e2tool.show_project_info(info)
- print("name:", info.name)
- print("root:", info.root)
- print("results: ", info.servers[result_server_name].url)
- print("\nsources:")
- for i, src in pairs(info.sources) do
- print()
- for k, v in pairs(src) do
- if k == "file" then
- for f, t in pairs(v) do
- print("", k, t.server, t.name)
- end
- else
- print("", k, v)
- end
- end
- end
- print("\nresults:")
- for i, res in pairs(info.results) do
- print()
- for k, v in pairs(res) do
- print("", k, v)
- if type(v) == "table" and k ~= ".fix" then
- for u, b in pairs(v) do
- print("", "", u, b)
- end
- end
- end
- end
- print("\nservers:")
- for i, srv in pairs(info.servers) do
- print("", srv.name, srv.url)
- end
- print("\ndefault results:")
- for k, v in pairs(info.default_results) do
- print("", v)
- end
-end
-
-
-- Dependency management
--
-- e2tool.dsort(INFO) -> ARRAY
return e2tool.dlist_recursive(info, info.default_results)
end
-
--- Server handling
---
--- e2tool.lookup_server(INFO, SRV) -> ABSOLUTE_PATH, BOOLEAN
---
--- For a given project internal server name, returns its absolute path
--- and true if the server is the project directory itself, false otherwise
---
--- e2tool.find_server(INFO, PATH) -> SERVERNAME, RELATIVE_PATH
---
--- Return servername and relative path for given PATH or nil.
-
-function e2tool.lookup_server(info, srv)
- e2lib.log(1, "e2tool.lookup_server() is deprecated")
- local path, e = cache.file_path(info.cache, srv, "", {})
- if not path then
- e2lib.abort(e)
- return nil
- end
- return path
-end
-
---- e2tool.valid_server
--- @param info info data
--- @param srv string: server name
--- @return true if the server is valid, false otherwise
-function e2tool.valid_server(info, srv)
- if info.servers[srv] then
- return true
- end
- return false
-end
-
-function e2tool.find_server(info, path)
- e2lib.log(1, "e2tool.find_server() is deprecated and may not work")
- -- XXX find all callers and replace with something else
- if #path > 0 then
- local statf
- local s = e2util.realpath(info.root)
- if s then
- statf = e2util.stat(s)
- if statf and statf.type == "directory" and "/" ~= string.sub(s, -1) then
- s = s .. "/"
- end
- end
- local p = e2util.realpath(path)
- if p then
- statf = e2util.stat(p)
- if statf and statf.type == "directory" and "/" ~= string.sub(p, -1) then
- p = p .. "/"
- end
- if #p >= #s + 2 and s == string.sub(p, 1, #s) then
- return ".", string.sub(p, #s + 1)
- end
- for k, v in pairs(info.servers) do
- if string.match(v.path, ":") then
- return path, ""
- end
- s = e2util.realpath(v.path)
- if #p >= #s + 2 and s == string.sub(p, 1, #s) then
- return k, string.sub(p, #s + 2)
- end
- end
- end
- end
- return nil
-end
-
-
-- Retrieval of files information
--
-- e2tool.expanded_files_list(INFO, SOURCE)