[Buildbot-devel] Using wildcards in a ShellCommand shell script
J. Félix Ontañón
fontanon at emergya.es
Tue Apr 8 14:56:42 UTC 2008
El Tue, 8 Apr 2008 08:29:36 -0500
"Charles Lepple" <clepple at gmail.com> escribió:
> 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*".
Fantastic. It works !!! Thanks.
But, i can't understand then the meaning of type commands as a list of
strings.
> 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).
>
Yes i've realized myself that special characters makes the things
harder.
Thanks Charles.
More information about the devel
mailing list