end
--- Calculate chroot group id.
--- @param info Info table.
-- @return Chroot group ID or false on error.
-- @return Error object on failure.
-function chroot.chroot:chrootgroupid(info)
+function chroot.chroot:chrootgroupid()
local rc, re, e, hc
if self._chrootgroupid then
--- Load and validate chroot configuration. Populates chroot.groups_byname,
-- chroot.groups_sorted and chroot.groups_default.
--- @param info Info table.
-- @return True on success, false on error.
-- @return Error object on failure
-function chroot.load_chroot_config(info)
+function chroot.load_chroot_config()
local rc, re, e
local t, path, cgroup
error(re)
end
- local info, re = e2tool.local_init(nil, "build-numbers")
- if not info then
+ rc, re = e2tool.local_init(nil, "build-numbers")
+ if not rc then
error(re)
end
local keep_chroot = opts["keep"]
-- apply flags to the selected results
- rc, re = e2tool.select_results(info, resultvec, force_rebuild,
- keep_chroot, build_mode, playground)
+ rc, re = e2tool.select_results(resultvec, force_rebuild, keep_chroot,
+ build_mode, playground)
if not rc then
error(re)
end
end
end
- rc, re = e2tool.print_selection(info, sel_res)
+ rc, re = e2tool.print_selection(sel_res)
if not rc then
error(re)
end
end
--- Find whether upstream config files hide this source/result.
-local function shadow_config_up(info, src_res, pathname)
+local function shadow_config_up(src_res, pathname)
local cf, cfdir
if src_res == "src" then
cf = e2tool.sourceconfig(pathname, e2tool.root())
err.new("config in %s would shadow the new %s", cfdir, thing)
end
- return shadow_config_up(info, src_res, e2lib.dirname(pathname))
+ return shadow_config_up(src_res, e2lib.dirname(pathname))
end
--- Find whether downstream sources/results would be hidden by creating
-- config here.
-local function shadow_config_down(info, src_res, pathname)
+local function shadow_config_down(src_res, pathname)
local cf, cfdir
if src_res == "src" then
cf = e2tool.sourceconfig(pathname, e2tool.root())
end
if e2lib.isdir(e2lib.join(cfdir, f)) then
- return shadow_config_down(info, src_res, e2lib.join(pathname, f))
+ return shadow_config_down(src_res, e2lib.join(pathname, f))
end
end
return false, e:append("refusing to overwrite config in %s", cfdir)
end
- rc, re = shadow_config_up(info, "src", pathname)
+ rc, re = shadow_config_up("src", pathname)
if not rc then
return false, e:cat(re)
end
- rc, re = shadow_config_down(info, "src", pathname)
+ rc, re = shadow_config_down("src", pathname)
if not rc then
return false, e:cat(re)
end
e:append("refusing to overwrite build-script in %s", cfdir)
end
- rc, re = shadow_config_up(info, "res", pathname)
+ rc, re = shadow_config_up("res", pathname)
if not rc then
return false, e:cat(re)
end
- rc, re = shadow_config_down(info, "res", pathname)
+ rc, re = shadow_config_down("res", pathname)
if not rc then
return false, e:cat(re)
end
end
--- cache chroot files
- -- @param info the info table
-- @return bool
-- @return nil, an error string on error
- local function cache_chroot(info)
+ local function cache_chroot()
local grp, rc, re
for _,g in ipairs(chroot.groups_sorted) do
grp = chroot.groups_byname[g]
if opts.chroot then
e2lib.log(2, "caching chroot files")
- local rc, re = cache_chroot(info)
+ local rc, re = cache_chroot()
if not rc then
e:append("Error: Caching chroot files failed")
e:cat(re)
table.insert(cmd, "-c")
table.insert(cmd, res:build_settings():command())
- local info = e2tool.info()
- e2tool.set_umask(info)
+ e2tool.set_umask()
rc, re = e2lib.callcmd(cmd, {})
if not rc then
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
return false, e:cat(re)
end
-- return code depends on user commands. Ignore.
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
return true
end
function e2build.build_process_class:helper_chroot_remove(res)
local e = err.new("removing chroot failed")
local rc, re, bc
- local info = e2tool.info()
bc = res:build_config()
- e2tool.set_umask(info)
+ e2tool.set_umask()
rc, re = e2lib.e2_su_2_2({"remove_chroot_2_3", bc.base})
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
if not rc then
return e:cat(re)
end
---
function e2build.build_process_class:_setup_chroot(res, return_flags)
- local rc, re, bc, info
+ local rc, re, bc
local e = err.new("error setting up chroot")
-- create the chroot path and create the chroot marker file without root
-- permissions. That makes sure we have write permissions here.
return false, e:cat(re)
end
- info = e2tool.info()
- e2tool.set_umask(info)
+ e2tool.set_umask()
rc, re = e2lib.e2_su_2_2({"set_permissions_2_3", bc.base})
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
if not rc then
return false, e:cat(re)
end
return false, e:cat(re)
end
- e2tool.set_umask(info)
+ e2tool.set_umask()
local argv = { "extract_tar_2_3", bc.base, tartype, path }
rc, re = e2lib.e2_su_2_2(argv)
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
if not rc then
return false, e:cat(re)
end
---
function e2build.build_process_class:_install_build_script(res, return_flags)
- local rc, re, e, bc, location, destdir, info
+ local rc, re, e, bc, location, destdir
bc = res:build_config()
location = e2tool.resultbuildscript(res:get_name_as_path())
destdir = e2lib.join(bc.T, "script")
- info = e2tool.info()
rc, re = cache.fetch_file(cache.cache(), cache.server_names().dot,
location, destdir)
---
function e2build.build_process_class:_install_init_files(res, return_flags)
- local rc, re, info
+ local rc, re
local bc = res:build_config()
local e = err.new("installing init files")
- info = e2tool.info()
-
for x, re in e2lib.directory(e2tool.root() .. "/proj/init") do
if not x then
return false, e:cat(re)
---
function e2build.build_process_class:_install_build_driver(res, return_flags)
local e, rc, re
- local bc, bd, destdir, buildrc_noinit_file, info, buildrc_file
+ local bc, bd, destdir, buildrc_noinit_file, buildrc_file
local build_driver_file
e = err.new("generating build driver script failed")
end
-- init files
- info = e2tool.info()
for fn, re in e2lib.directory(e2lib.join(e2tool.root(), "proj/init")) do
if not fn then
return false, e:cat(re)
---
function e2build.build_process_class:_install_build_time_dependencies(res, return_flags)
local e, rc, re
- local dependslist, info, dep, destdir
+ local dependslist, dep, destdir
dependslist = res:depends_list()
- info = e2tool.info()
-
for dependsname in dependslist:iter() do
dep = result.results[dependsname]
destdir = e2lib.join(res:build_config().T, "dep", dep:get_name())
function e2build.build_process_class:_fix_permissions(res, return_flags)
local rc, re, bc
local e = err.new("fixing permissions failed")
- local info = e2tool.info()
e2lib.log(3, "fix permissions")
- e2tool.set_umask(info)
+ e2tool.set_umask()
bc = res:build_config()
local argv = { "chroot_2_3", bc.base, "chown", "-R", "root:root", bc.Tc }
rc, re = e2lib.e2_su_2_2(argv)
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
if not rc then
return false, e:cat(re)
end
- e2tool.set_umask(info)
+ e2tool.set_umask()
argv = { "chroot_2_3", bc.base, "chmod", "-R", "u=rwX,go=rX", bc.Tc }
rc, re = e2lib.e2_su_2_2(argv)
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
if not rc then
return false, e:cat(re)
end
function e2build.build_process_class:_runbuild(res, return_flags)
local rc, re, out, bc, cmd
local e = err.new("build failed")
- local info = e2tool.info()
e2lib.logf(3, "building %s ...", res:get_name())
eio.fwrite(out, output)
end
- e2tool.set_umask(info)
+ e2tool.set_umask()
cmd, re = tools.get_tool_flags_argv("e2-su-2.2")
if not cmd then
eio.fclose(out)
return false, e:cat(re)
end
- e2tool.reset_umask(info)
+ e2tool.reset_umask()
if rc ~= 0 then
eio.fclose(out)
e = err.new("build script for %s failed with exit status %d", res:get_name(), rc)
-- @return True on success, false on validation failure
-- @return Error object on failure
function e2tool.file_class:validate_set_servloc(server, location)
- local info
-
if server == nil then
return false, err.new("file entry without 'server' attribute")
end
return false, err.new("'server' can't be empty")
end
- info = e2tool.info()
-
if not cache.valid_server(cache.cache(), server) then
return false, err.new("file entry with unknown server: %s", server)
end
-- @return error object on failure.
function e2tool.file_class:_compute_checksum(digest_type, flags)
assert(digest_type == digest.SHA1 or digest_type == digest.SHA256)
- local rc, re, info, path, dt
-
- info = e2tool.info()
+ local rc, re, path, dt
path, re = cache.fetch_file_path(cache.cache(), self._server, self._location,
flags)
-- @return error object on failure.
function e2tool.file_class:_compute_remote_checksum(digest_type)
assert(digest_type == digest.SHA1 or digest_type == digest.SHA256)
- local rc, re, info, surl, u, checksum
-
- info = e2tool.info()
+ local rc, re, surl, u, checksum
surl, re = cache.remote_url(cache.cache(), self._server, self._location)
if not surl then
-- @return True if verify succeeds, False otherwise
-- @return Error object on failure.
function e2tool.file_class:checksum_verify()
- local rc, re, e, digest_types, cs_cache, cs_remote, cs_fetch, checksum, info
+ local rc, re, e, digest_types, cs_cache, cs_remote, cs_fetch, checksum
local checksum_conf
e = err.new("error verifying checksum of %s", self:servloc())
- info = e2tool.info()
-
digest_types = {}
if self:sha1() or project.checksums_sha1() then
table.insert(digest_types, digest.SHA1)
-- @field host_umask Default umask of the process (decimal number).
-- @field project_location string: project location relative to the servers
-- @field local_template_path Path to the local templates (string).
--- @field cache The cache object.
local _info = false
--- Open debug logfile.
--- @param info Info table.
-- @return True on success, false on error.
-- @return Error object on failure.
-local function opendebuglogfile(info)
+local function opendebuglogfile()
local rc, re, e, logfile, debuglogfile
rc, re = e2lib.mkdir_recursive(e2lib.join(e2tool.root(), "log"))
return info
end
- rc, re = opendebuglogfile(info)
+ rc, re = opendebuglogfile()
if not rc then
return false, e:cat(re)
end
end
-- read project configuration
- rc, re = project.load_project_config(info)
+ rc, re = project.load_project_config()
if not rc then
return false, e:cat(re)
end
-- chroot config
- rc, re = chroot.load_chroot_config(info)
+ rc, re = chroot.load_chroot_config()
if not rc then
return false, e:cat(re)
end
-- licences
- rc, re = licence.load_licence_config(info)
+ rc, re = licence.load_licence_config()
if not rc then
return false, e:cat(re)
end
-- sources
- rc, re = source.load_source_configs(info)
+ rc, re = source.load_source_configs()
if not rc then
return false, e:cat(re)
end
-- results
- rc, re = result.load_result_configs(info)
+ rc, re = result.load_result_configs()
if not rc then
return false, e:cat(re)
end
end
end
- rc, re = policy.init(info)
+ rc, re = policy.init()
if not rc then
return false, e:cat(re)
end
--- select (mark) results based upon a list of results usually given on the
-- command line. Parameters are assigned to all selected results.
--- @param info the info structure
-- @param results table: list of result names
-- @param force_rebuild bool
-- @param keep_chroot bool
-- @param playground bool
-- @return bool
-- @return an error object on failure
-function e2tool.select_results(info, results, force_rebuild, keep_chroot, build_mode, playground)
+function e2tool.select_results(results, force_rebuild, keep_chroot, build_mode, playground)
local rc, re, res, settings
for _,resultname in ipairs(results) do
end
--- Print selection status for a list of results
--- @param info
-- @param resultvec table: list of result names
-- @return bool
-- @return an error object on failure
-function e2tool.print_selection(info, resultvec)
+function e2tool.print_selection(resultvec)
for _,resultname in ipairs(resultvec) do
local e = err.new("error printing selected results")
local res = result.results[resultname]
--- Load project licence config, validate, and populate the licences,
-- licences_sorted tables with licence objects.
--- @param info Info table.
-- @return True on success, false on error
-- @return Error object on failure.
-function licence.load_licence_config(info)
+function licence.load_licence_config()
local rc, re, e
local path, ltable
end
--- Initialize policy module.
--- @param info Info table.
-- @return True on success, false on error.
-- @return Error object on failure.
-function policy.init(info)
+function policy.init()
local e = err.new("checking policy")
-- check if all required servers exist
--- Initialise the project module, load and check proj/config. Needs to be
-- called before using name() etc.
--- @param info Info table.
-- @return True on success, false on error.
-- @return Error object on failure.
-function project.load_project_config(info)
+function project.load_project_config()
local rc, re, e
local path, prj
end
function project.chroot_call_prefix()
- local info
- info = e2tool.info()
- assert(info)
-
if project.chroot_arch() == "x86_32" then
return e2lib.join(e2tool.root(), ".e2/bin/e2-linux32")
end
-- value after the first call.
-- @return Project ID or false on error.
-- @return Error object on failure
-function project.projid(info)
+function project.projid()
local re, hc, cs
if _projid_cache then
end
end
- local info = e2tool.info()
local path = e2lib.join(e2tool.root(), file)
local mt = {
self._build_settings = false
local e = err.new("in result %s:", self._name)
- local rc, re, info
+ local rc, re
rc, re = e2lib.vrfy_dict_exp_keys(rawres, "e2result config", {
"chroot",
end
end
-
- info = e2tool.info()
-
if rawres.env and type(rawres.env) ~= "table" then
e:append("result has invalid `env' attribute")
else
---
function result.result_class:build_config()
- local rc, re, e, buildid, bc, tmpdir, builddir, info
+ local rc, re, e, buildid, bc, tmpdir, builddir
- info = e2tool.info()
- assertIsTable(info)
e = err.new("preparing build config for %s failed", self:get_name())
buildid, re = self:buildid()
-- @return BuildID or false on error.
-- @return Error object on failure.
function result.result_class:buildid()
- local e, rc, re, info, hc, id, build_mode
+ local e, rc, re, hc, id, build_mode
build_mode = self:build_mode()
if self._buildid then
end
e = err.new("error calculating BuildID for result: %s", self:get_name())
- info = e2tool.info()
hc = hash.hash_start()
-- basic_result
-- chroot
for groupname in self:chroot_list():iter() do
- id, re = chroot.groups_byname[groupname]:chrootgroupid(info)
+ id, re = chroot.groups_byname[groupname]:chrootgroupid()
if not id then
return false, e:cat(re)
end
end
-- project
- id, re = project.projid(info)
+ id, re = project.projid()
if not id then
return false, e:cat(re)
end
-- @section end
--- Gather result paths.
--- @param info Info table.
-- @param basedir Nil or directory from where to start scanning for more
-- results. Only for recursion.
-- @param results Nil or table of result paths. Only for recursion.
-- @return Table with result paths, or false on error.
-- @return Error object on failure.
-local function gather_result_paths(info, basedir, results)
+local function gather_result_paths(basedir, results)
local rc, re
local currdir, resdir, resconfig, s
table.insert(results, entry)
else
-- try subfolder
- rc, re = gather_result_paths(info, entry, results)
+ rc, re = gather_result_paths(entry, results)
if not rc then
return false, re
end
---
local function load_rawres(cfg)
local e, rc, re
- local rawres, loadcnt, g, path, res, info
+ local rawres, loadcnt, g, path, res
e = err.new("error loading result configuration")
return false, e
end
- info = e2tool.info()
rawres = nil
loadcnt = 0
g = {
--- Search, load and verify all result configs. On success, all results are
--available as objects in result.results[].
--- @param info Info table
-- @return True on success, false on error.
-- @return Error object on failure.
-function result.load_result_configs(info)
+function result.load_result_configs()
local rc, re, e, configs, res
- configs, re = gather_result_paths(info)
+ configs, re = gather_result_paths()
if not configs then
return false, re
end
source.sources = {}
--- Gather source paths.
--- @param info Info table.
-- @param basedir Nil or directory from where to start scanning for more
-- sources. Only for recursion.
-- @param sources Nil or table of source paths. Only for recursion.
-- @return Table with source paths, or false on error.
-- @return Error object on failure.
-local function gather_source_paths(info, basedir, sources)
+local function gather_source_paths(basedir, sources)
local rc, re
local currdir, sdir, sconfig, s
sources = sources or {}
table.insert(sources, entry)
else
-- try sub directory
- rc, re = gather_source_paths(info, entry, sources)
+ rc, re = gather_source_paths(entry, sources)
if not rc then
return false, re
end
--- Search, load and verify all source configs. On success, all sources
--available as objects in source.sources[] etc.
--- @param info Info table
-- @return True on success, false on error.
-- @return Error object on failure.
-function source.load_source_configs(info)
+function source.load_source_configs()
local rc, re, e
local g, rawsrc, loadcnt, configs, path, src
e = err.new("error loading source configuration")
- configs, re = gather_source_paths(info)
+ configs, re = gather_source_paths()
if not configs then
return false, e:cat(re)
end
assert(type(rawsrc) == "table" and rawsrc.name and rawsrc.type)
assert(type(ismandatory) == "boolean")
- local info = e2tool.info()
-
if ismandatory and rawsrc.server == nil then
return false, err.new("source has no `server' attribute")
end
-- @return an error object on failure
local function _build_collect_project(self, res, return_flags)
- local function write_build_driver(info, resultname, destdir)
+ local function write_build_driver(resultname, destdir)
local rc, re, e, res, bd, buildrc_noinit_file, buildrc_file, bc
local build_driver_file
return false, e:cat(re)
end
-- generate build driver
- rc, re = write_build_driver(info, depname, destdir)
+ rc, re = write_build_driver(depname, destdir)
if not rc then
return false, e:cat(re)
end
--------------------------------------------------------------------------------
--- Build the cvsroot string.
--- @param info Info table.
-- @param sourcename Source name.
-- @return CVSROOT string or false on error.
-- @return Error object on failure.
-local function mkcvsroot(info, sourcename)
+local function mkcvsroot(sourcename)
local cvsroot, src, surl, u, re
src = source.sources[sourcename]
return true
end
- cvsroot, re = mkcvsroot(info, sourcename)
+ cvsroot, re = mkcvsroot(sourcename)
if not cvsroot then
return false, e:cat(re)
end
e = err.new("cvs.prepare_source failed")
src = source.sources[sourcename]
- cvsroot, re = mkcvsroot(info, sourcename)
+ cvsroot, re = mkcvsroot(sourcename)
if not cvsroot then
return false, re
end
assert(type(sourceset) == "string" and #sourceset > 0)
local rc, re
- local hc, surl, svnurl, argv, out, svnrev, lid, svnrev, info, licences
+ local hc, surl, svnurl, argv, out, svnrev, lid, svnrev, licences
if self._sourceids[sourceset] then
return self._sourceids[sourceset]
hash.hash_append(hc, lid)
end
- info = e2tool.info()
- assert(type(info) == "table")
-
surl, re = cache.remote_url(cache.cache(), self._server, self._location)
if not surl then
return false, re