]> git.e2factory.org Git - e2factory.git/commitdiff
Define syntax_file global and use it
authorTobias Ulmer <tu@emlix.com>
Wed, 4 Dec 2013 14:42:24 +0000 (15:42 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:17 +0000 (15:41 +0100)
Removes another static field from the info table.

Signed-off-by: Tobias Ulmer <tu@emlix.com>
generic/e2lib.lua
global/e2-create-project.lua
local/e2tool.lua

index 4b60d7389f589902a5957106755f09f357007d21..8f77bcab7b7316256a99ab66361802b7147a3d3f 100644 (file)
@@ -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,
index 41de794922fec75f18dae65cddfbe63ce1fe03d9..784fe3868a59f92327163e2f847c24acdcc51a92 100644 (file)
@@ -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 },
     }
index f3000a3ede53dcabcac77e51ace0d233cb6caeb9..a72c97a93f886b09446929f2da918b25ea5c2040 100644 (file)
@@ -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)