docker: extend "cc" command to accept compiler

When calling our cross-compilation images we want to call something
other than the default cc.

Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Fam Zheng <famz@redhat.com>
This commit is contained in:
Alex Bennée 2018-04-12 17:18:12 +01:00
parent 5e03c2d816
commit 99cfdb8662

View file

@ -419,6 +419,8 @@ class CcCommand(SubCommand):
def args(self, parser):
parser.add_argument("--image", "-i", required=True,
help="The docker image in which to run cc")
parser.add_argument("--cc", default="cc",
help="The compiler executable to call")
parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
help="""Extra paths to (ro) mount into container for
reading sources""")
@ -432,7 +434,7 @@ def run(self, args, argv):
if args.paths:
for p in args.paths:
cmd += ["-v", "%s:%s:ro,z" % (p, p)]
cmd += [args.image, "cc"]
cmd += [args.image, args.cc]
cmd += argv
return Docker().command("run", cmd, args.quiet)