waf: allow cross-execute program to have arguments with spaces
authorUri Simchoni <urisimchoni@gmail.com>
Tue, 19 May 2015 08:09:55 +0000 (11:09 +0300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 20 May 2015 09:19:11 +0000 (11:19 +0200)
When cross-compiling samba using the cross-execute method,
allow the cross-excute command to have arguments that contain
spaces by quoting them.

For example:

./configure --cross-compile '--cross-execute=ce-program "par am"'

In this case, for each cross test whose binary is /path/testprog,
waf shall run the equivalent of running from a shell:
ce-program "par am" /path/testprog

This is useful for passing an arbitrary argument list to a subprocess
of the cross-execute program, such as in buildtools/examples/run_on_target.py

Signed-off-by: Uri Simchoni <urisimchoni@gmail.com>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
buildtools/wafsamba/samba_cross.py

index 8213e1718d311948006b4872bfb11c29d7ce414a..8911d4c8b0f1434bdc8e5870e0e7fca7445e6d49 100644 (file)
@@ -2,6 +2,7 @@
 
 import Utils, Logs, sys, os, Options, re
 from Configure import conf
+import shlex
 
 real_Popen = None
 
@@ -113,7 +114,7 @@ class cross_Popen(Utils.pproc.Popen):
             # when --cross-execute is set, then change the arguments
             # to use the cross emulator
             i = args.index('--cross-execute')
-            newargs = args[i+1].split()
+            newargs = shlex.split(args[i+1])
             newargs.extend(args[0:i])
             if use_answers:
                 p = real_Popen(newargs,