We need to pass environment variables down to the debbootstrap.pre
script to be able to specify build parameters.

Signed-off-by: Alex Bennée <alex.ben...@linaro.org>
---
 tests/docker/docker.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index b279836154..388e86ada2 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -293,6 +293,8 @@ class BuildCommand(SubCommand):
         parser.add_argument("--add-current-user", "-u", dest="user",
                             action="store_true",
                             help="Add the current user to image's passwd")
+        parser.add_argument("--env", "-E", action='append', nargs=1,
+                            help="Set FOO=BAR in envronment")
         parser.add_argument("tag",
                             help="Image Tag")
         parser.add_argument("dockerfile",
@@ -302,6 +304,12 @@ class BuildCommand(SubCommand):
         dockerfile = open(args.dockerfile, "rb").read()
         tag = args.tag
 
+        # Process env setting
+        if args.env:
+            for e in args.env:
+                (env, val) = e[0].split("=")
+                os.environ[env] = val
+
         dkr = Docker()
         if "--no-cache" not in argv and \
            dkr.image_matches_dockerfile(tag, dockerfile):
-- 
2.17.1


Reply via email to