break
end
end
- local build_script = e2lib.join(info.root,
- e2tool.resultbuildscript(info.results[resultname].directory))
+ local build_script =
+ e2tool.resultbuildscript(info.results[resultname].directory, info.root)
if not e2lib.isfile(build_script) then
e:append("build-script does not exist: %s", build_script)
end
return false, e:append("not located in a project directory")
end
- rc, re = e2tool.lcd(info, ".")
- if not rc then
- return false, e:cat(re)
- end
-
info.ftab = strict.lock({
collect_project_info = {}, -- f(info)
check_result = {}, -- f(info, resultname)
local e = err.new("reading chroot config failed")
local t = {}
local rc, re =
- load_user_config(info, "proj/chroot", t, "chroot", "e2chroot")
+ load_user_config(info, e2lib.join(info.root, "proj/chroot"),
+ t, "chroot", "e2chroot")
if not rc then
return false, e:cat(re)
end
local function gather_source_paths(info, basedir, sources)
sources = sources or {}
- local currdir = e2lib.join(info.root, e2tool.sourcedir(basedir))
+ local currdir = e2tool.sourcedir(basedir, info.root)
for entry, re in e2lib.directory(currdir) do
if not entry then
return false, re
entry = e2lib.join(basedir, entry)
end
- local fullentry = e2lib.join(info.root, e2tool.sourcedir(entry))
- local s = e2lib.stat(fullentry, false)
+ local sdir = e2tool.sourcedir(entry, info.root)
+ local sconfig = e2tool.sourceconfig(entry, info.root)
+ local s = e2lib.stat(sdir, false)
if s.type == "directory" then
- if e2lib.exists(e2tool.sourceconfig(entry)) then
+ if e2lib.exists(sconfig) then
table.insert(sources, entry)
else
-- try subfolder
for _,src in ipairs(sources) do
local list, re
- local path = e2tool.sourceconfig(src)
+ local path = e2tool.sourceconfig(src, info.root)
local types = { "e2source", }
local rc, re = e2tool.verify_src_res_pathname_valid_chars(src)
if not rc then
local function gather_result_paths(info, basedir, results)
results = results or {}
- local currdir = e2lib.join(info.root, e2tool.resultdir(basedir))
+ local currdir = e2tool.resultdir(basedir, info.root)
for entry, re in e2lib.directory(currdir) do
if not entry then
return false, re
entry = e2lib.join(basedir, entry)
end
- local fullentry = e2lib.join(info.root, e2tool.resultdir(entry))
- local s = e2lib.stat(fullentry, false)
+ local resdir = e2tool.resultdir(entry, info.root)
+ local resconfig = e2tool.resultconfig(entry, info.root)
+ local s = e2lib.stat(resdir, false)
if s.type == "directory" then
- if e2lib.exists(e2tool.resultconfig(entry)) then
+ if e2lib.exists(resconfig) then
table.insert(results, entry)
else
-- try subfolder
for _,res in ipairs(results) do
local list, re
- local path = e2tool.resultconfig(res)
+ local path = e2tool.resultconfig(res, info.root)
local types = { "e2result", }
local rc, re = e2tool.verify_src_res_pathname_valid_chars(res)
local rc, re
- local rc, re = load_user_config(info, info.root .. "/proj/config",
+ local rc, re = load_user_config(info, e2lib.join(info.root, "proj/config"),
info, "project", "e2project")
if not rc then
return false, re
end
-- licences
- rc, re = load_user_config(info, info.root .. "/proj/licences",
+ rc, re = load_user_config(info, e2lib.join(info.root, "proj/licences"),
info, "licences", "e2licence")
if not rc then
return false, e:cat(re)
return true, nil
end
---- chdir to a directory relative to info.root
--- @param info
--- @param dir string: directory
--- @return bool
--- @return an error object on failure
-function e2tool.lcd(info, dir)
- local e = err.new("chdir failed")
- local abspath = e2lib.join(info.root, dir)
- local rc, re = e2lib.chdir(abspath)
- if not rc then
- return false, e:cat(re)
- end
- return true
-end
-
--- register collect project info.
function e2tool.register_collect_project_info(info, func)
if type(info) ~= "table" or type(func) ~= "function" then