-- @field root Project root directory (string).
-- @field ftab Table of build functions tables (table). See info.ftab table.
-- @see info.ftab
--- @field name string: project name
-- @field root_server string: url pointing to the project root
-- @field root_server_name string: name of the root server (".")
-- @field default_repo_server string: name of the default scm repo server
-- @field default_files_server string: name of the default files server
-- @field result_storage (deprecated)
--- @field default_results table: default result list
-- @field sources table: sources
-- @field sources_sorted table: sorted list of sources
-- @field results table: results
-- @field ghash table: temporary list keeps hashes for chroot groups
-- (generated by buildid_chrootgroup())
-- @field project_location string: project location relative to the servers
--- @field release_id string: release identifiert XXX where do we initialize it?
-- @field env table: env table
-- @field env_files table: list of env files
-- @field local_template_path Path to the local templates (string).
return false, e:append("duplicate source: %s", name)
end
- item.data.configfile = item.filename
info.sources[name] = item.data
end
end
return false, e:append("duplicate result: %s", name)
end
- item.data.configfile = item.filename
info.results[name] = item.data
end
end
return true, nil
end
+--- Read project configuration file.
+-- @return True on success, false on error.
+-- @return Error object on failure.
+local function read_project_config(info)
+
+ --- Project configuration table (e2project).
+ -- @table info.project
+ -- @field release_id Release identifier, usually a git tag (string).
+ -- @field name Name of project (string).
+ -- @field deploy_results List of results that should be archived on
+ -- --release builds (table containing strings).
+ -- @field default_results List of results that are built by default
+ -- (table containing strings).
+ -- @field chroot_arch Chroot architecture (string).
+
+ local rc, re
+
+ local rc, re = load_user_config(info, info.root .. "/proj/config",
+ info, "project", "e2project")
+ if not rc then
+ return false, re
+ end
+
+ local e = err.new("in project configuration:")
+ if not info.project.release_id then
+ e:append("key is not set: release_id")
+ end
+ if not info.project.name then
+ e:append("key is not set: name")
+ end
+ if not info.project.default_results then
+ e2lib.warnf("WDEFAULT", "in project configuration:")
+ e2lib.warnf("WDEFAULT",
+ "default_results is not set. Defaulting to empty list.")
+ info.project.default_results = {}
+ end
+ rc, re = listofstrings(info.project.deploy_results, true, true)
+ if not rc then
+ e:append("deploy_results is not a valid list of strings")
+ e:cat(re)
+ end
+ rc, re = listofstrings(info.project.default_results, true, false)
+ if not rc then
+ e:append("default_results is not a valid list of strings")
+ e:cat(re)
+ end
+ if not info.project.chroot_arch then
+ e2lib.warnf("WDEFAULT", "in project configuration:")
+ e2lib.warnf("WDEFAULT", " chroot_arch defaults to x86_32")
+ info.project.chroot_arch = "x86_32"
+ end
+ if not info.chroot_call_prefix[info.project.chroot_arch] then
+ e:append("chroot_arch is set to an invalid value")
+ end
+ local host_system_arch, re = e2lib.get_sys_arch()
+ if not host_system_arch then
+ e:cat(re)
+ elseif info.project.chroot_arch == "x86_64" and
+ host_system_arch ~= "x86_64" then
+ e:append("running on x86_32: switching to x86_64 mode is impossible.")
+ end
+ if e:getcount() > 1 then
+ return false, e
+ end
+
+ return true
+end
+
--- collect project info.
function e2tool.collect_project_info(info, skip_load_config)
local rc, re
end
-- read project configuration
- local rc, re = load_user_config(info, info.root .. "/proj/config",
- info, "project", "e2project")
+ rc, re = read_project_config(info)
if not rc then
return false, e:cat(re)
end
- info.project[".fix"] = nil
- local e = err.new("in project configuration:")
- if not info.project.release_id then
- e:append("key is not set: release_id")
- end
- if not info.project.name then
- e:append("key is not set: name")
- end
- if not info.project.default_results then
- e2lib.warnf("WDEFAULT", "in project configuration:")
- e2lib.warnf("WDEFAULT",
- "default_results is not set. Defaulting to empty list.")
- info.project.default_results = {}
- end
- rc, re = listofstrings(info.project.deploy_results, true, true)
- if not rc then
- e:append("deploy_results is not a valid list of strings")
- e:cat(re)
- end
- rc, re = listofstrings(info.project.default_results, true, false)
- if not rc then
- e:append("default_results is not a valid list of strings")
- e:cat(re)
- end
- if not info.project.chroot_arch then
- e2lib.warnf("WDEFAULT", "in project configuration:")
- e2lib.warnf("WDEFAULT", " chroot_arch defaults to x86_32")
- info.project.chroot_arch = "x86_32"
- end
- if not info.chroot_call_prefix[info.project.chroot_arch] then
- e:append("chroot_arch is set to an invalid value")
- end
- local host_system_arch, re = e2lib.get_sys_arch()
- if not host_system_arch then
- e:cat(re)
- elseif info.project.chroot_arch == "x86_64" and
- host_system_arch ~= "x86_64" then
- e:append("running on x86_32: switching to x86_64 mode is impossible.")
- end
- if e:getcount() > 1 then
- return false, e
- end
- info.release_id = info.project.release_id
- info.name = info.project.name
- info.default_results = info.project.default_results
-- chroot config
- info.chroot_config_file = "proj/chroot"
rc, re = read_chroot_config(info)
if not rc then
return false, e:cat(re)
-- licences
rc, re = load_user_config(info, info.root .. "/proj/licences",
- info, "licences", "e2licence")
+ info, "licences", "e2licence")
if not rc then
return false, e:cat(re)
end
- info.licences[".fix"] = nil
- -- privide sorted list of licences
+ -- provide sorted list of licences
info.licences_sorted = {}
for l,lic in pairs(info.licences) do
table.insert(info.licences_sorted, l)
for _,s in ipairs(r.sources) do
local src = info.sources[s]
local source_set = r.build_mode.source_set()
- local rc, re, sourceid =
- scm.sourceid(info, s, source_set)
+ local rc, re, sourceid = scm.sourceid(info, s, source_set)
if not rc then
return false, e:cat(re)
end