From: Tobias Ulmer Date: Wed, 4 Dec 2013 14:42:24 +0000 (+0100) Subject: Define syntax_file global and use it X-Git-Tag: e2factory-2.3.15rc1~306 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=233f18585686f09b199b1a4d742c469f82a67091;p=e2factory.git Define syntax_file global and use it Removes another static field from the info table. Signed-off-by: Tobias Ulmer --- diff --git a/generic/e2lib.lua b/generic/e2lib.lua index 4b60d73..8f77bca 100644 --- a/generic/e2lib.lua +++ b/generic/e2lib.lua @@ -87,6 +87,7 @@ e2lib.globals = strict.lock({ global_interface_version_file = ".e2/global-version", project_location_file = ".e2/project-location", e2version_file = ".e2/e2version", + syntax_file = ".e2/syntax", logrotate = 5, -- configurable via config.log.logrotate _version = "e2factory, the emlix embedded build system, version " .. buildconfig.VERSION, diff --git a/global/e2-create-project.lua b/global/e2-create-project.lua index 41de794..784fe38 100644 --- a/global/e2-create-project.lua +++ b/global/e2-create-project.lua @@ -258,7 +258,7 @@ local function e2_create_project(arg) { filename = "proj/licences", content=licences }, { filename = "proj/env", content=env }, { filename = "proj/config", content=pconfig }, - { filename = ".e2/syntax", content=syntax }, + { filename = e2lib.globals.syntax_file, content=syntax }, { filename = e2lib.globals.e2version_file, content=e2version }, { filename = ".gitignore", content=gitignore }, } diff --git a/local/e2tool.lua b/local/e2tool.lua index f3000a3..a72c97a 100644 --- a/local/e2tool.lua +++ b/local/e2tool.lua @@ -766,24 +766,30 @@ end -- @return bool -- @return an error object on failure local function check_config_syntax_compat(info) - local e = err.new("checking configuration syntax compatibilitly failed") - local l, re = eio.file_read_line(info.config_syntax_file) + local re, e, sf, l + + e = err.new("checking configuration syntax compatibilitly failed") + sf = e2lib.join(info.root, e2lib.globals.syntax_file) + + l, re = eio.file_read_line(sf) if not l then return false, e:cat(re) end + for _,m in ipairs(info.config_syntax_compat) do m = string.format("^%s$", m) if l:match(m) then - return true, nil + return true end end + local s = [[ Your configuration syntax is incompatible with this tool version. Please read the configuration Changelog, update your project configuration and finally insert the new configuration syntax version into %s Configuration syntax versions supported by this version of the tools are:]] - e2lib.logf(2, s, info.config_syntax_file) + e2lib.logf(2, s, sf) for _,m in ipairs(info.config_syntax_compat) do e2lib.logf(2, "%s", m) end @@ -1278,7 +1284,6 @@ function e2tool.collect_project_info(info, skip_load_config) -- check for configuration compatibility info.config_syntax_compat = buildconfig.SYNTAX - info.config_syntax_file = ".e2/syntax" rc, re = check_config_syntax_compat(info) if not rc then e2lib.finish(1)