diff mbox series

[v2,16/21] docker: add env parser to docker.py build step

Message ID 20180629205232.27190-17-alex.bennee@linaro.org
State New
Headers show
Series Travis, Code Coverage and Cross Build updates | expand

Commit Message

Alex Bennée June 29, 2018, 8:52 p.m. UTC
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.bennee@linaro.org>

---
 tests/docker/docker.py | 8 ++++++++
 1 file changed, 8 insertions(+)

-- 
2.17.1

Comments

Alex Bennée July 2, 2018, 1:28 p.m. UTC | #1
Alex Bennée <alex.bennee@linaro.org> writes:

> We need to pass environment variables down to the debbootstrap.pre

> script to be able to specify build parameters.


This is stale, we don't need it as we inherit the environment set by the
calling make.

--
Alex Bennée
diff mbox series

Patch

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):