From d9b260653dd3a84a5a62a226cabcc9d96cb6bdcf Mon Sep 17 00:00:00 2001 From: Tobias Ulmer Date: Tue, 30 Aug 2016 18:53:40 +0200 Subject: [PATCH] project: move chroot_call_prefix() to better location Signed-off-by: Tobias Ulmer --- local/e2tool.lua | 9 --------- local/project.lua | 18 ++++++++++++++++-- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/local/e2tool.lua b/local/e2tool.lua index 9ad5375..4d97518 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -525,15 +525,6 @@ function e2tool.collect_project_info(info, skip_load_config) rc = cache.new_cache_entry(info.cache, info.proj_storage_server_name, nil, nil, info.default_repo_server, info.project_location) - -- prefix the chroot call with this tool (switch to 32bit on amd64) - -- XXX not in buildid, as it is filesystem location dependent... - info.chroot_call_prefix = {} - info.chroot_call_prefix["x86_32"] = - e2lib.join(info.root, ".e2/bin/e2-linux32") - -- either we are on x86_64 or we are on x86_32 and refuse to work anyway - -- if x86_64 mode is requested. - info.chroot_call_prefix["x86_64"] = "" - local f = e2lib.join(info.root, e2lib.globals.e2version_file) local v, re = e2lib.parse_e2versionfile(f) if not v then diff --git a/local/project.lua b/local/project.lua index c3031a2..055a22a 100644 --- a/local/project.lua +++ b/local/project.lua @@ -19,6 +19,7 @@ -- more details. local project = {} +package.loaded["project"] = project local buildconfig = require("buildconfig") local e2lib = require("e2lib") @@ -102,8 +103,9 @@ local function load_prj_cfg(prj) e2lib.warnf("WDEFAULT", " chroot_arch defaults to x86_32") prj.chroot_arch = "x86_32" end - if not info.chroot_call_prefix[prj.chroot_arch] then - return false, err.new("chroot_arch is set to an invalid value") + + if prj.chroot_arch ~= "x86_32" and prj.chroot_arch ~= "x86_64" then + return false, err.new("chroot_arch is set to an unknown architecture") end -- get host system architecture @@ -186,6 +188,18 @@ function project.chroot_arch() return _prj.chroot_arch end +function project.chroot_call_prefix() + local info + info = e2tool.info() + assert(info) + + if project.chroot_arch() == "x86_32" then + return e2lib.join(info.root, ".e2/bin/e2-linux32") + end + + return "" +end + --- Iterator that returns the deploy results as string. -- @return Iterator function. function project.deploy_results_iter() -- 2.39.5