[elbe-devel] [PATCH 06/20] asciidoclog: add env_add keyword parameter to LogBase.chroot()

Torben Hohn torben.hohn at linutronix.de
Fri Oct 12 11:27:52 CEST 2018


allow specifying environment values via env_add. To retain the original
behaviour, the env_add dict is updated into the default_env.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/asciidoclog.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/elbepack/asciidoclog.py b/elbepack/asciidoclog.py
index 0c0f3da6..8c6d3cf7 100644
--- a/elbepack/asciidoclog.py
+++ b/elbepack/asciidoclog.py
@@ -61,12 +61,15 @@ class LogBase(object):
             if not allow_fail:
                 raise CommandError(cmd, ret)
 
-    def chroot(self, directory, cmd, allow_fail=False):
+    def chroot(self, directory, cmd, allow_fail=False, env_add=None):
 
         chroot_default_env = {"LANG": "C",
                               "LANGUAGE": "C",
                               "LC_ALL": "C"}
 
+        if env_add:
+            chroot_default_env.update(env_add)
+
         chcmd = "chroot %s %s" % (directory, cmd)
         self.do(chcmd, allow_fail=allow_fail, env_add=chroot_default_env)
 
-- 
2.11.0




More information about the elbe-devel mailing list