]> git.e2factory.org Git - e2factory.git/commitdiff
results: allow assigning environment to results in result configuration
authorGordon Hecker <gh@emlix.com>
Thu, 29 Apr 2010 08:23:15 +0000 (10:23 +0200)
committerGordon Hecker <gh@emlix.com>
Mon, 3 May 2010 08:06:32 +0000 (10:06 +0200)
This is done by assigning a dictionary to the 'env' attribute
of a result configuration.
The environment configured this way is merged into the environment
and overrides variables from the project wide configuration files.

BuildId is handled by merging these variables into the result
specific environment before BuildId calculation.

Signed-off-by: Gordon Hecker <gh@emlix.com>
doc/manual/results.text
local/e2tool.lua
templates/local/result

index 43b99a9264628faaea5bb66f7190e7f411c90c23..d60e9173022f84a8fe7fbbea153495706d53d793 100644 (file)
@@ -9,6 +9,7 @@ following keys:
 *   sources list of sources
 *   chroot list of chroot groups
 *   depends list of dependencies
+*   env dictionary of environment variables
 
 To use the `collect_project` feature the following keys must be used
 in addition:
@@ -47,6 +48,9 @@ Example configuration:
         depends = {
             "toolchain",
         },
+        env = {
+            key = "val",
+        },
     }
 
 Example (using the `collect_project` flag)
index 4207f9613f6bc6e51b22e77b69fcdc3b30c7fa73..c475cf0253d85ca2077e7fc8dc96996f82a0a3d2 100644 (file)
@@ -1925,6 +1925,27 @@ function check_result(info, resultname)
                        end
                end
        end
+       if res.env and type(res.env) ~= "table" then
+               e:append("result has invalid `env' attribute")
+       else
+               if not res.env then
+                       e2lib.warnf("WDEFAULT",
+                               "result has no `env' attribute. "..
+                               "Defaulting to empty dictionary")
+                       res.env = {}
+               end
+               for k,v in pairs(res.env) do
+                       if type(k) ~= "string" then
+                               e:append("in `env' dictionary: "..
+                                   "key is not a string: %s", tostring(k))
+                       elseif type(v) ~= "string" then
+                               e:append("in `env' dictionary: "..
+                                   "value is not a string: %s", tostring(v))
+                       else
+                               res._env:set(k, v)
+                       end
+               end
+       end
        if not res.buildno then
                res.bn = {}
                res.buildno = "0"
index 01dc2baa27589521a417af4c055652ceeacbb29d..0750b0bb093616daf174bbde9c84b478b1bca264 100644 (file)
@@ -7,6 +7,8 @@ e2result {
        depends = { },
        -- a list of chroot groups
        chroot = { },
+       -- an environment dictionary
+       env = { },
        -- use the collect_project feature for this result?
        collect_project = false,
        -- collect_project_default_result = "<result>",