Re: [Qemu-devel] [PATCH v1 06/24] docker: extend "cc" command to accept compiler

2018-04-12 Thread Fam Zheng
On Tue, 04/10 20:39, Alex Bennée wrote:
> When calling our cross-compilation images we want to call something
> other than the default cc.

Makes sense to me!

> 
> Signed-off-by: Alex Bennée 
> ---
>  tests/docker/docker.py | 18 +++---
>  1 file changed, 15 insertions(+), 3 deletions(-)
> 
> diff --git a/tests/docker/docker.py b/tests/docker/docker.py
> index 8733266153..9444f4bea4 100755
> --- a/tests/docker/docker.py
> +++ b/tests/docker/docker.py
> @@ -397,6 +397,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",
> +help="The compiler executable to call")

If add "default='cc'" to this call, we don't need the 'if args.cc' check below.

>  parser.add_argument("--source-path", "-s", nargs="*", dest="paths",
>  help="""Extra paths to (ro) mount into container 
> for
>  reading sources""")
> @@ -407,9 +409,19 @@ class CcCommand(SubCommand):
>  cwd = os.getcwd()
>  cmd = ["--rm", "-w", cwd,
> "-v", "%s:%s:rw" % (cwd, cwd)]
> -for p in args.paths:
> -   cmd += ["-v", "%s:%s:ro,z" % (p, p)]
> -cmd += [args.image, "cc"]
> +
> +if args.paths:
> +for p in args.paths:
> +cmd += ["-v", "%s:%s:ro,z" % (p, p)]

I'm not sure the introduction of this if condition belongs to this patch, or is
necessary at all. Could you confirm?

Thanks.

Fam

> +
> +cmd += [args.image]
> +
> +# The compile command we are running
> +if args.cc:
> +cmd += [args.cc]
> +else:
> +cmd += ["cc"]
> +
>  cmd += argv
>  return Docker().command("run", cmd, True)
>  
> -- 
> 2.16.2
> 



[Qemu-devel] [PATCH v1 06/24] docker: extend "cc" command to accept compiler

2018-04-10 Thread Alex Bennée
When calling our cross-compilation images we want to call something
other than the default cc.

Signed-off-by: Alex Bennée 
---
 tests/docker/docker.py | 18 +++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 8733266153..9444f4bea4 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -397,6 +397,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",
+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""")
@@ -407,9 +409,19 @@ class CcCommand(SubCommand):
 cwd = os.getcwd()
 cmd = ["--rm", "-w", cwd,
"-v", "%s:%s:rw" % (cwd, cwd)]
-for p in args.paths:
-   cmd += ["-v", "%s:%s:ro,z" % (p, p)]
-cmd += [args.image, "cc"]
+
+if args.paths:
+for p in args.paths:
+cmd += ["-v", "%s:%s:ro,z" % (p, p)]
+
+cmd += [args.image]
+
+# The compile command we are running
+if args.cc:
+cmd += [args.cc]
+else:
+cmd += ["cc"]
+
 cmd += argv
 return Docker().command("run", cmd, True)
 
-- 
2.16.2