[Buildbot-devel] setting the description field for ShellCommand

Gerald Combs gerald at ethereal.com
Thu Nov 3 15:44:08 UTC 2005


My solution was to add "WarnCommand" and "HaltCommand" steps:

class WarnCommand(ShellCommand):
    def __init__(self, description=None, **kwargs):
        ShellCommand.__init__(self, **kwargs)
        self.description = description
        self.descriptionDone = description

    name = "warncommand"
    warnOnWarnings = True
    warnOnFailure = True

class HaltCommand(ShellCommand):
    def __init__(self, description=None, **kwargs):
        ShellCommand.__init__(self, **kwargs)
        self.description = description
        self.descriptionDone = description

    name = "haltcommand"
    warnOnWarnings = True
    haltOnFailure = True


I like the idea of a modified ShellCommand better, however.


Dobes Vandermeer wrote:
> I had the exact same problem, but I modified ShellCommand directly;
> probably we're not the only two -- Here's the patch hopefully Brian
> will be so kind as to apply it (or make his own version of it):
> 
> Index: process/step.py
> ===================================================================
> RCS file: /cvsroot/buildbot/buildbot/buildbot/process/step.py,v
> retrieving revision 1.75
> diff -u -r1.75 step.py
> --- process/step.py	24 Oct 2005 22:42:03 -0000	1.75
> +++ process/step.py	27 Oct 2005 23:02:18 -0000
> @@ -699,7 +699,14 @@
>          # that we create, but first strip out the ones that we pass to
>          # BuildStep (like haltOnFailure and friends)
>          self.workdir = kwargs['workdir'] # required by RemoteShellCommand
> +
> +        self.description = kwargs.get('description', [])
> +        if not self.description:
> +            self.description = kwargs.get('name')
> +        self.descriptionDone = kwargs.get('descriptionDone')
> +
>          buildstep_kwargs = {}
> +
>          for k in kwargs.keys()[:]:
>              if k in self.__class__.parms:
>                  buildstep_kwargs[k] = kwargs[k]
> @@ -727,10 +734,14 @@
>                       text, so a simple noun is appropriate ('compile',
>                       'tests' ...)
>          """
> -
> +
>          if done and self.descriptionDone is not None:
> +            if isinstance(self.descriptionDone,str):
> +                return [self.descriptionDone]
>              return self.descriptionDone
>          if self.description is not None:
> +            if isinstance(self.description,str):
> +                return [self.description]
>              return self.description
> 
>          words = self.cmd.command
> 
> 
> On 11/1/05, John Blair <John.Blair at sun.com> wrote:
> 
>>I need to run commands before our source tree is ready for buildbot to
>>run "make".  I've been using ShellCommand to do this, but b/c it shows
>>the first 2 words in the command the resulting column in the waterfall
>>display is very wide.
>>
>>To allow me to run arbitrary shell commands and set the displayed
>>description field, I wrote this object:
>>
>>
>>class DescribedShellCommand(ShellCommand):
>>
>>    name = "described shell command"
>>    warnOnFailure = True
>>
>>    def __init__(self, **kwargs):
>>        self.description = kwargs['description']
>>        self.descriptionDone = kwargs['descriptionDone']
>>        ShellCommand.__init__(self, **kwargs)
>>
>>
>>This lets me write steps like this in the master.cfg file:
>>
>>s(step.DescribedShellCommand,
>>                command = ["cp", "foo/bar/baz/Makefile.foo", "."],
>>                description = ["build", "prep"],
>>                descriptionDone = ["prep done"])
>>
>>
>>Is there a better way to do this than what I've done?
>>
>> -john.
>>
>>
>>
>>-------------------------------------------------------
>>SF.Net email is sponsored by:
>>Tame your development challenges with Apache's Geronimo App Server. Download
>>it for free - -and be entered to win a 42" plasma tv or your very own
>>Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
>>_______________________________________________
>>Buildbot-devel mailing list
>>Buildbot-devel at lists.sourceforge.net
>>https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>>
> 
> 
> 
> -------------------------------------------------------
> SF.Net email is sponsored by:
> Tame your development challenges with Apache's Geronimo App Server. Download
> it for free - -and be entered to win a 42" plasma tv or your very own
> Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
> _______________________________________________
> Buildbot-devel mailing list
> Buildbot-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/buildbot-devel






More information about the devel mailing list