[users at bb.net] question about use of Interpolate

Pierre Tardy tardyp at gmail.com
Wed Apr 5 15:20:36 UTC 2017


Hi Nicolas

On Wed, Apr 5, 2017 at 10:57 AM nicolas.lecureuil nicolas.lecureuil <
nicolas.lecureuil at siveo.net> wrote:

> Hi,
>
>
> i use Buildbot to build deb packages.
>
> i have a small question because i use :
>
>
> class UpstreamGetVersion(ShellCommand):
> name ="upstreamgetversion"
> command='grep version setup.py | grep = | cut -d = -f2 | cut -d"\'" -f2 '
>
> def evaluateCommand(self, cmd):
> shell.SetPropertyFromCommand(command='grep version setup.py | grep = | cut
> -d = -f2 | cut -d"\'" -f2 ', property="upstreamPkgVer")
> return ShellCommand.evaluateCommand(self, cmd)
>
Your email agent mangled the whitespace, which does not make you code easy
to read.

looks like you are not using shell.SetPropertyFromCommand in the way it is
meant.
It is not a method you call in the evaluateCommand context, it is a step by
itself
So you don't need any custom evaluateCommand step, you just need

f1.addStep(shell.SetPropertyFromCommand(command='grep version setup.py |
grep = | cut -d = -f2 | cut -d"\'" -f2 ', property="upstreamPkgVer"))

Note that you can debug your properties setup in the properties tab of the
UI.

Then, it is recommended to use new style steps for your customizations.
It is exactly the same except you redefine run(), and you do "return
SUCCESS" instead of self.finished(SUCCESS).
Those new style steps are easier to use, and will avoid Buildbot to setup
 eight compatibility layer.
Last, you should know that self.getProperty() exists, and should simplify
your code.
Instead of printing, you can also call self.addLog:

stdio_log = self.addLog("stdio")
stdio_log.addStdout( 'Debian package upstream version:
{}'.format(self.debver))
You debug logs will be found in the buildbot UI instead of twisted.log

Regards
Pierre
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170405/6e675289/attachment.html>


More information about the users mailing list