local rc, re, e
local t, path, cgroup
- path = e2lib.join(info.root, "proj/chroot")
+ path = e2lib.join(e2tool.root(), "proj/chroot")
e = err.new("loading chroot config %q failed", path)
t = nil
local function shadow_config_up(info, src_res, pathname)
local cf, cfdir
if src_res == "src" then
- cf = e2tool.sourceconfig(pathname, info.root)
- cfdir = e2tool.sourcedir(pathname, info.root)
+ cf = e2tool.sourceconfig(pathname, e2tool.root())
+ cfdir = e2tool.sourcedir(pathname, e2tool.root())
elseif src_res == "res" then
- cf = e2tool.resultconfig(pathname, info.root)
- cfdir = e2tool.resultdir(pathname, info.root)
+ cf = e2tool.resultconfig(pathname, e2tool.root())
+ cfdir = e2tool.resultdir(pathname, e2tool.root())
else
return false, err.new("unexpected value in src_res")
end
local function shadow_config_down(info, src_res, pathname)
local cf, cfdir
if src_res == "src" then
- cf = e2tool.sourceconfig(pathname, info.root)
- cfdir = e2tool.sourcedir(pathname, info.root)
+ cf = e2tool.sourceconfig(pathname, e2tool.root())
+ cfdir = e2tool.sourcedir(pathname, e2tool.root())
elseif src_res == "res" then
- cf = e2tool.resultconfig(pathname, info.root)
- cfdir = e2tool.resultdir(pathname, info.root)
+ cf = e2tool.resultconfig(pathname, e2tool.root())
+ cfdir = e2tool.resultdir(pathname, e2tool.root())
else
return false, err.new("unexpected value in src_res")
end
end
local pathname = e2tool.src_res_name_to_path(name)
- local cf = e2tool.sourceconfig(pathname, info.root)
- local cfdir = e2tool.sourcedir(pathname, info.root)
+ local cf = e2tool.sourceconfig(pathname, e2tool.root())
+ local cfdir = e2tool.sourcedir(pathname, e2tool.root())
if e2lib.isfile(cf) then
return false, e:append("refusing to overwrite config in %s", cfdir)
end
local pathname = e2tool.src_res_name_to_path(name)
- local cf = e2tool.sourceconfig(pathname, info.root)
+ local cf = e2tool.sourceconfig(pathname, e2tool.root())
return editor(cf)
end
end
local pathname = e2tool.src_res_name_to_path(name)
- local cfdir = e2tool.resultdir(pathname, info.root)
- local cf = e2tool.resultconfig(pathname, info.root)
- local bs = e2tool.resultbuildscript(pathname, info.root)
+ local cfdir = e2tool.resultdir(pathname, e2tool.root())
+ local cf = e2tool.resultconfig(pathname, e2tool.root())
+ local bs = e2tool.resultbuildscript(pathname, e2tool.root())
local cftemplate = e2lib.join(info.local_template_path, "result")
local bstemplate = e2lib.join(info.local_template_path, "build-script")
end
local pathname = e2tool.src_res_name_to_path(name)
- local cf = e2tool.resultconfig(pathname, info.root)
+ local cf = e2tool.resultconfig(pathname, e2tool.root())
return editor(cf)
end
end
local pathname = e2tool.src_res_name_to_path(name)
- local cf = e2tool.resultbuildscript(pathname, info.root)
+ local cf = e2tool.resultbuildscript(pathname, e2tool.root())
return editor(cf)
end
error(re)
end
- local rc, re = e2lib.chdir(info.root)
+ local rc, re = e2lib.chdir(e2tool.root())
if not rc then
error(re)
end
bc = res:build_config()
e = err.new("entering playground")
-
+
rc, re = eio.file_write(e2lib.join(bc.c, bc.profile),
res:build_settings():profile())
if not rc then
if not rc then
return false, e:cat(re)
end
- local f = e2lib.join(info.root, "playground")
+ local f = e2lib.join(e2tool.root(), "playground")
local s = e2lib.lstat(f)
if s and s.type == "symbolic-link" then
rc, re = e2lib.unlink(f)
info = e2tool.info()
- for x, re in e2lib.directory(info.root .. "/proj/init") do
+ for x, re in e2lib.directory(e2tool.root() .. "/proj/init") do
if not x then
return false, e:cat(re)
end
if not e2lib.is_backup_file(x) then
local location = e2lib.join("proj/init", x)
- local abslocation = e2lib.join(info.root, location)
+ local abslocation = e2lib.join(e2tool.root(), location)
local destdir = e2lib.join(bc.T, "init")
if not e2lib.isfile(abslocation) then
-- init files
info = e2tool.info()
- for fn, re in e2lib.directory(e2lib.join(info.root, "proj/init")) do
+ for fn, re in e2lib.directory(e2lib.join(e2tool.root(), "proj/init")) do
if not fn then
return false, e:cat(re)
end
if not buildid then
return false, e:cat(re)
end
- lnk = e2lib.join(info.root, "out", res:get_name(), "last")
+ lnk = e2lib.join(e2tool.root(), "out", res:get_name(), "last")
location = e2lib.join(location, res:get_name(), buildid, "result.tar")
-- if we don't have cache or server on local fs, fetch a copy into "out"
local function opendebuglogfile(info)
local rc, re, e, logfile, debuglogfile
- rc, re = e2lib.mkdir_recursive(e2lib.join(info.root, "log"))
+ rc, re = e2lib.mkdir_recursive(e2lib.join(e2tool.root(), "log"))
if not rc then
e = err.new("error making log directory")
return false, e:cat(re)
end
- logfile = e2lib.join(info.root, "log/debug.log")
+ logfile = e2lib.join(e2tool.root(), "log/debug.log")
rc, re = e2lib.rotate_log(logfile)
if not rc then
return false, re
if not info.root then
return false, e:append("not located in a project directory")
end
+ e2tool.root(info.root)
-- load local plugins
local ctx = { -- plugin context
info = info,
}
- local plugindir = e2lib.join(info.root, ".e2/plugins")
+ local plugindir = e2lib.join(e2tool.root(), ".e2/plugins")
rc, re = plugin.load_plugins(plugindir, ctx)
if not rc then
return false, e:cat(re)
local re, e, sf, l
e = err.new("checking configuration syntax compatibilitly failed")
- sf = e2lib.join(info.root, e2lib.globals.syntax_file)
+ sf = e2lib.join(e2tool.root(), e2lib.globals.syntax_file)
l, re = eio.file_read_line(sf)
if not l then
e2lib.finish(1)
end
- info.local_template_path = e2lib.join(info.root, ".e2/lib/e2/templates")
+ info.local_template_path = e2lib.join(e2tool.root(), ".e2/lib/e2/templates")
rc, re = e2lib.init2() -- configuration must be available
if not rc then
e2lib.logf(4, "VERSIONSTRING: %s", buildconfig.VERSIONSTRING)
-- read .e2/proj-location
- local plf = e2lib.join(info.root, e2lib.globals.project_location_file)
+ local plf = e2lib.join(e2tool.root(), e2lib.globals.project_location_file)
local line, re = eio.file_read_line(plf)
if not line then
return false, e:cat(re)
return false, e:cat(re)
end
- rc, re = cache.setup_cache_local(info.cache, info.root, info.project_location)
+ rc, re = cache.setup_cache_local(info.cache, e2tool.root(), info.project_location)
if not rc then
return false, e:cat(re)
end
return false, e:cat(re)
end
- local f = e2lib.join(info.root, e2lib.globals.e2version_file)
+ local f = e2lib.join(e2tool.root(), e2lib.globals.e2version_file)
local v, re = e2lib.parse_e2versionfile(f)
if not v then
return false, re
-- read global interface version and check if this version of the local
-- tools supports the version used for the project
- local givf = e2lib.join(info.root, e2lib.globals.global_interface_version_file)
+ local givf = e2lib.join(e2tool.root(), e2lib.globals.global_interface_version_file)
local line, re = eio.file_read_line(givf)
if not line then
return false, e:cat(re)
".e2/version",
}
for _,f in ipairs(deprecated_files) do
- local path = e2lib.join(info.root, f)
+ local path = e2lib.join(e2tool.root(), f)
if e2lib.exists(path) then
e2lib.warnf("WDEPRECATED", "File exists but is no longer used: `%s'", f)
end
if e2option.opts["check"] then
local dirty, mismatch
- rc, re, mismatch = generic_git.verify_head_match_tag(info.root,
+ rc, re, mismatch = generic_git.verify_head_match_tag(e2tool.root(),
project.release_id())
if not rc then
if mismatch then
end
end
- rc, re, dirty = generic_git.verify_clean_repository(info.root)
+ rc, re, dirty = generic_git.verify_clean_repository(e2tool.root())
if not rc then
if dirty then
e = err.new("project repository is not clean")
if e2option.opts["check-remote"] then
rc, re = generic_git.verify_remote_tag(
- e2lib.join(info.root, ".git"), project.release_id())
+ e2lib.join(e2tool.root(), ".git"), project.release_id())
if not rc then
e:append("verifying remote tag failed")
return false, e:cat(re)
local rc, re, e
local path, ltable
- path = e2lib.join(info.root, "proj/licences")
+ path = e2lib.join(e2tool.root(), "proj/licences")
e2lib.logf(3, "loading licence config %q", path)
e = err.new("loading licence config %q failed", path)
return false, re
end
- path = e2lib.join(info.root, "proj/config")
+ path = e2lib.join(e2tool.root(), "proj/config")
prj = nil
local g = {
assert(info)
if project.chroot_arch() == "x86_32" then
- return e2lib.join(info.root, ".e2/bin/e2-linux32")
+ return e2lib.join(e2tool.root(), ".e2/bin/e2-linux32")
end
return ""
-- catch proj/init/*
hc = hash.hash_start()
- for f, re in e2lib.directory(e2lib.join(info.root, "proj/init")) do
+ for f, re in e2lib.directory(e2lib.join(e2tool.root(), "proj/init")) do
if not f then
return false, re
end
-- .e2/extensions
local extensions
- extensions, re = e2lib.read_extension_config(info.root)
+ extensions, re = e2lib.read_extension_config(e2tool.root())
if not extensions then
return false, re
end
end
local info = e2tool.info()
- local path = e2lib.join(info.root, file)
+ local path = e2lib.join(e2tool.root(), file)
local mt = {
__index = function(t, key)
end
local build_script =
- e2tool.resultbuildscript(self:get_name_as_path(), info.root)
+ e2tool.resultbuildscript(self:get_name_as_path(), e2tool.root())
if not e2lib.isfile(build_script) then
e:append("build-script does not exist: %s", build_script)
end
bc.Tc = e2lib.join("/", builddir)
bc.r = self:get_name()
bc.chroot_call_prefix = project.chroot_call_prefix()
- bc.buildlog = string.format("%s/log/build.%s.log", info.root, self:get_name())
+ bc.buildlog = string.format("%s/log/build.%s.log", e2tool.root(), self:get_name())
bc.scriptdir = "script"
bc.build_driver_file = "build-driver"
bc.buildrc_file = "buildrc"
local currdir, resdir, resconfig, s
results = results or {}
- currdir = e2tool.resultdir(basedir, info.root)
+ currdir = e2tool.resultdir(basedir, e2tool.root())
for entry, re in e2lib.directory(currdir) do
if not entry then
return false, re
entry = e2lib.join(basedir, entry)
end
- resdir = e2tool.resultdir(entry, info.root)
- resconfig = e2tool.resultconfig(entry, info.root)
+ resdir = e2tool.resultdir(entry, e2tool.root())
+ resconfig = e2tool.resultconfig(entry, e2tool.root())
s = e2lib.stat(resdir)
if s.type == "directory" then
if e2lib.exists(resconfig) then
string = e2lib.safe_string_table(),
}
- path = e2tool.resultconfig(cfg, info.root)
+ path = e2tool.resultconfig(cfg, e2tool.root())
rc, re = e2lib.dofile2(path, g)
if not rc then
return false, e:cat(re)
local currdir, sdir, sconfig, s
sources = sources or {}
- currdir = e2tool.sourcedir(basedir, info.root)
+ currdir = e2tool.sourcedir(basedir, e2tool.root())
for entry, re in e2lib.directory(currdir) do
if not entry then
return false, re
entry = e2lib.join(basedir, entry)
end
- sdir = e2tool.sourcedir(entry, info.root)
- sconfig = e2tool.sourceconfig(entry, info.root)
+ sdir = e2tool.sourcedir(entry, e2tool.root())
+ sconfig = e2tool.sourceconfig(entry, e2tool.root())
s = e2lib.stat(sdir)
if s.type == "directory" then
if e2lib.exists(sconfig) then
string = e2lib.safe_string_table(),
}
- path = e2tool.sourceconfig(cfg, info.root)
+ path = e2tool.sourceconfig(cfg, e2tool.root())
rc, re = e2lib.dofile2(path, g)
if not rc then
return false, e:cat(re)
return false, e:cat(re)
end
- for fn, re in e2lib.directory(e2lib.join(info.root, "proj/init")) do
+ for fn, re in e2lib.directory(e2lib.join(e2tool.root(), "proj/init")) do
if not fn then
return false, e:cat(re)
end
return false, e:cat(re)
end
- for f, re in e2lib.directory(e2lib.join(info.root, "proj/init"), false) do
+ for f, re in e2lib.directory(e2lib.join(e2tool.root(), "proj/init"), false) do
if not f then
return false, e:cat(re)
end
-- split the working directory into dirname and basename as some cvs clients
-- don't like slashes (e.g. in/foo) in their checkout -d<path> argument
- workdir = e2lib.dirname(e2lib.join(info.root, src:get_working()))
+ workdir = e2lib.dirname(e2lib.join(e2tool.root(), src:get_working()))
argv = {
"-d", cvsroot,
return false, e:cat(re)
end
elseif sourceset == "working-copy" then
- rc, re = e2lib.cp(e2lib.join(info.root, src:get_working()),
+ rc, re = e2lib.cp(e2lib.join(e2tool.root(), src:get_working()),
e2lib.join(buildpath, src:get_name()), true)
if not rc then
return false, e:cat(re)
return false, e:cat(re)
end
- workdir = e2lib.join(info.root, src:get_working())
+ workdir = e2lib.join(e2tool.root(), src:get_working())
argv = { "update", "-R" }
rc, re = cvs_tool(argv, workdir)
function cvs.working_copy_available(info, sourcename)
local src = source.sources[sourcename]
- local dir = e2lib.join(info.root, src:get_working())
+ local dir = e2lib.join(e2tool.root(), src:get_working())
if not e2lib.isdir(dir) then
return false, err.new("working copy for %s is not available", sourcename)
end
return false, e:cat(re)
end
- gitdir = e2lib.join(info.root, src:get_working(), ".git")
+ gitdir = e2lib.join(e2tool.root(), src:get_working(), ".git")
if sourceset == "branch" or (sourceset == "lazytag" and src:get_tag() == "^") then
ref = string.format("refs/heads/%s", src:get_branch())
e2lib.logf(2, "updating %s [%s]", src:get_working(), src:get_branch())
- gitwc = e2lib.join(info.root, src:get_working())
+ gitwc = e2lib.join(e2tool.root(), src:get_working())
gitdir = e2lib.join(gitwc, ".git")
argv = generic_git.git_new_argv(gitdir, gitwc, "fetch")
src = source.sources[sourcename]
e = err.new("fetching source failed: %s", sourcename)
- work_tree = e2lib.join(info.root, src:get_working())
+ work_tree = e2lib.join(e2tool.root(), src:get_working())
git_dir = e2lib.join(work_tree, ".git")
e2lib.logf(2, "cloning %s:%s [%s]", src:get_server(), src:get_location(),
return false, e:cat(re)
end
- srcdir = e2lib.join(info.root, src:get_working())
+ srcdir = e2lib.join(e2tool.root(), src:get_working())
destdir = e2lib.join(buildpath, sourcename)
rc, re = e2lib.mkdir_recursive(destdir)
if sourceset == "working-copy" then
local empty
- srcdir = e2lib.join(info.root, src:get_working())
+ srcdir = e2lib.join(e2tool.root(), src:get_working())
empty = true
for f, re in e2lib.directory(srcdir, true) do
function git.working_copy_available(info, sourcename)
local rc
local src = source.sources[sourcename]
- local gitwc = e2lib.join(info.root, src:get_working())
+ local gitwc = e2lib.join(e2tool.root(), src:get_working())
if not e2lib.isdir(gitwc) then
return false, err.new("working copy for %s is not available", sourcename)
return false, e:cat(re)
end
- argv = generic_git.git_new_argv(nil, e2lib.join(info.root, src:get_working()))
+ argv = generic_git.git_new_argv(nil, e2lib.join(e2tool.root(), src:get_working()))
table.insert(argv, "archive")
table.insert(argv, "--format=tar") -- older versions don't have "tar.gz"
table.insert(argv, string.format("--prefix=%s/", sourcename))
end
elseif sourceset == "working-copy" then
argv = {
- "-C", e2lib.join(info.root, src:get_working()),
+ "-C", e2lib.join(e2tool.root(), src:get_working()),
string.format("--transform=s,^./,./%s/,", sourcename),
"--exclude=.git",
"-czf",
-- check if branch exists
local src = source.sources[sourcename]
- local gitdir = e2lib.join(info.root, src:get_working(), ".git")
+ local gitdir = e2lib.join(e2tool.root(), src:get_working(), ".git")
local ref = string.format("refs/heads/%s", src:get_branch())
local id
local src = source.sources[sourcename]
- if not e2lib.isdir(e2lib.join(info.root, src:get_working())) then
+ if not e2lib.isdir(e2lib.join(e2tool.root(), src:get_working())) then
return false, err.new("working copy for %s is not available", sourcename)
end
return true
src = source.sources[sourcename]
e = err.new("fetching source failed: %s", sourcename)
- work_tree = e2lib.join(info.root, src:get_working())
+ work_tree = e2lib.join(e2tool.root(), src:get_working())
git_dir = e2lib.join(work_tree, ".git")
e2lib.logf(2, "cloning %s:%s [%s]", src:get_server(), src:get_location(),
return false, e:cat(re)
end
- worktree = e2lib.join(info.root, src:get_working())
+ worktree = e2lib.join(e2tool.root(), src:get_working())
argv = generic_git.git_new_argv(false, false, "clone",
"--mirror", worktree, destdir)
rc, re = generic_git.git(argv)
elseif sourceset == "working-copy" then
local argv = {
"-a",
- e2lib.join(info.root, src:get_working(), ""),
+ e2lib.join(e2tool.root(), src:get_working(), ""),
e2lib.join(buildpath, sourcename),
}
rc, re = e2lib.rsync(argv)
e2lib.logf(2, "updating %s [%s]", src:get_working(), src:get_branch())
- gitwc = e2lib.join(info.root, src:get_working())
+ gitwc = e2lib.join(e2tool.root(), src:get_working())
gitdir = e2lib.join(gitwc, ".git")
argv = generic_git.git_new_argv(gitdir, gitwc, "fetch")
-- check if branch exists
local src = source.sources[sourcename]
- local gitdir = e2lib.join(info.root, src:get_working(), ".git")
+ local gitdir = e2lib.join(e2tool.root(), src:get_working(), ".git")
local ref = string.format("refs/heads/%s", src:get_branch())
local id
if sourceset == "tag" or sourceset == "branch" then
local tmpdir = e2lib.mktempdir()
- local worktree = e2lib.join(info.root, src:get_working())
+ local worktree = e2lib.join(e2tool.root(), src:get_working())
local destdir = e2lib.join(tmpdir, sourcename, ".git")
rc, re = e2lib.mkdir_recursive(destdir)
end
elseif sourceset == "working-copy" then
rc, rc = e2lib.tar({"-czf", e2lib.join(sourcedir, archive),
- "-C", e2lib.join(info.root, src:get_working(), ".."), sourcename})
+ "-C", e2lib.join(e2tool.root(), src:get_working(), ".."), sourcename})
if not rc then
return false, e:cat(re)
end
return true
end
- local argv = { "checkout", svnurl, info.root .. "/" .. src:get_working() }
+ local argv = { "checkout", svnurl, e2tool.root() .. "/" .. src:get_working() }
rc, re = svn_tool(argv)
if not rc then
return false, e:cat(re)
end
elseif sourceset == "working-copy" then
- -- cp -R info.root/src.working/src.workingcopy_subdir build_path
- local s = e2lib.join(info.root, src:get_working(),
+ -- cp -R e2tool.root()/src.working/src.workingcopy_subdir build_path
+ local s = e2lib.join(e2tool.root(), src:get_working(),
src:get_workingcopy_subdir())
local d = e2lib.join(build_path, src:get_name())
rc, re = e2lib.cp(s, d, true)
local rc, re
local src = source.sources[sourcename]
- local dir = e2lib.join(info.root, src:get_working())
+ local dir = e2lib.join(e2tool.root(), src:get_working())
if not e2lib.isdir(dir) then
return false, err.new("working copy for %s is not available", sourcename)
end
end
-- check if the configured branch and tag exist
local d
- d = e2lib.join(info.root, src:get_working(), src:get_branch())
+ d = e2lib.join(e2tool.root(), src:get_working(), src:get_branch())
if not e2lib.isdir(d) then
e:append("branch does not exist: %s", src:get_branch())
end
- d = e2lib.join(info.root, src:get_working(), src:get_tag())
+ d = e2lib.join(e2tool.root(), src:get_working(), src:get_tag())
if not e2lib.isdir(d) then
e:append("tag does not exist: %s", src:get_tag())
end
local rc, re
local e = err.new("updating source '%s' failed", sourcename)
local src = source.sources[sourcename]
- local workdir = e2lib.join(info.root, src:get_working())
+ local workdir = e2lib.join(e2tool.root(), src:get_working())
rc, re = svn_tool({ "update" }, workdir)
if not rc then
return false, e:cat(re)