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

nicolas.lecureuil nicolas.lecureuil nicolas.lecureuil at siveo.net
Thu Apr 6 07:18:33 UTC 2017


> Le 5 avril 2017 à 17:20, Pierre Tardy <tardyp at gmail.com> a écrit :
> 
>     Hi Nicolas
> 
>     On Wed, Apr 5, 2017 at 10:57 AM nicolas.lecureuil nicolas.lecureuil <nicolas.lecureuil at siveo.net mailto: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
> 

Hi,


i have forgottent a big detail, i am using bb 0.8.9 ( as i need to port to bb 0.9.x in a second step but i want as a first step a working buildbot ( i am not that far from this :) )


so if i use:

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


for now i have :

self.addStep(UpstreamGetVersion(workdir=self._workdir))
self.addStep(DebComputeNewVersion(master_path=self._base_master_path, pkg_url=self._base_pkg_url))

if i use



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


i obtain  :


LINE: pulse-agent-plugins (grep: setup.py: Aucun fichier ou dossier de ce type+git20170405233946.ea174fc-1) UNRELEASED; urgency=medium


which means something like   "no file or folder"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170406/74549d03/attachment.html>


More information about the users mailing list