[Buildbot-devel] Using wildcards in a ShellCommand shell script
Charles Lepple
clepple at gmail.com
Tue Apr 8 13:29:36 UTC 2008
On Tue, Apr 8, 2008 at 4:55 AM, J. Félix Ontañón <fontanon at emergya.es> wrote:
> Hi all,
>
> After some BuildSteps, the result in the slave's builder workdir its:
>
> app/
> |
> |--- build
> | | ----- foo.c
> | ` ----- Makefile <--- This generates foo in ../
> `--- foo <---- As you can see
>
>
> So this ShellCommand Subclass works !!!
>
> class UploadDebSrc(ShellCommand):
> command = ["ls", "../foo"]
>
> def __init__(self, **kwargs):
> ShellCommand.__init__(self, **kwargs)
>
>
> But why that ShellCommand fails !!!
>
> class UploadDebSrc(ShellCommand):
> command = ["ls", "../f*"]
>
> def __init__(self, **kwargs):
> ShellCommand.__init__(self, **kwargs)
>
>
> I need to use wildcards as * or ? in my ShellCommands.
If you pass the shell command in as a list of strings, it doesn't
actually get executed in a shell, so the wildcards are not expanded.
You probably want:
["sh", "-c", "ls", "../f*"]
- or -
"ls ../f*".
Beware that if you need to pass special characters like quotes or
backslashes, the shell (plus Python's quoting rules) can make this
very difficult (especially if you use the second form).
--
- Charles Lepple
More information about the devel
mailing list