]> git.e2factory.org Git - e2factory.git/commitdiff
plugin support: extend api to register functions to run during
authorGordon Hecker <gh@emlix.com>
Tue, 2 Mar 2010 13:04:31 +0000 (14:04 +0100)
committerGordon Hecker <gh@emlix.com>
Tue, 2 Mar 2010 14:10:12 +0000 (15:10 +0100)
collect_project(). Includes bugfix: Check return code from
registered functions

Signed-off-by: Gordon Hecker <gh@emlix.com>
local/e2tool.lua

index d9772feed386fa3ad342d7b41d3256b1c3273c9f..de79191f538bf0206660217e6c80a39b24ad4820 100644 (file)
@@ -747,7 +747,10 @@ The newest configuration syntax supported by the tools is %s.
   end
 
   for _,f in ipairs(info.ftab.collect_project_info) do
-    f(info)
+    rc, re = f(info)
+    if not rc then
+      e2lib.abort(e:cat(re))
+    end
   end
   return info, nil
 end
@@ -2762,6 +2765,14 @@ function sourceconfig(name)
   return sourcedir(name,"config")
 end
 
+function register_collect_project_info(info, func)
+  if type(info) ~= "table" or type(func) ~= "function" then
+    return false, new_error("register_collect_project_info: invalid argument")
+  end
+  table.insert(info.ftab.collect_project_info, func)
+  return true, nil
+end
+
 function register_check_result(info, func)
   if type(info) ~= "table" or type(func) ~= "function" then
     return false, new_error("register_check_result: invalid argument")