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

nicolas.lecureuil nicolas.lecureuil nicolas.lecureuil at siveo.net
Wed Apr 5 08:56:40 UTC 2017


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)


and later in the config:


class DebComputeNewVersion(BuildStep):
# /!\ Add your variable to renderables otherwise you'll have
# a property object instance instead of a string (??)
renderables = [ "debver", "commit", "upstreamver" ]
name = "debnewversion"
debver = Property("debPkgDebVer")
upstreamver = Interpolate("%(prop:upstreamPkgVer)s")
commit = Property("revision")
prop = Property("efef")

def __init__(self, master_path, pkg_url, **kwargs):
BuildStep.__init__(self, **kwargs)
self.master_path = master_path
self.pkg = pkg_url

def start(self):
date = datetime.datetime.now().strftime("%Y%m%d%H%M%S")
newdebver = self.upstreamver + "+git" + date + "." + self.commit[:7]
print '# DebComputeNewVersion #'
print 'Debian package upstream version: '+str(self.debver)
print 'Upstream version found: '+str(self.upstreamver)
print 'New Debian package version: '+str(newdebver)
print '# End DebComputeNewVersion #'
self.setProperty("debPkgNewDebVer", newdebver, "DebComputeNewVersion")
self.setProperty("debPkgRev", "1", "DebComputeNewVersion")
self.setProperty("shortRev", self.commit[:7], "DebComputeNewVersion")
self.setProperty("masterPath", os.path.join(self.master.basedir, self.master_path, newdebver), "DebComputeNewVersion")
self.setProperty("pkgUrl", os.path.join(self.pkg, newdebver), "DebComputeNewVersion")
self.finished(SUCCESS)



the probleme is that str(self.upstreamver) is empty.


Do i use Interpolate in a bad way ?


thanks a lot for your help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildbot.net/pipermail/users/attachments/20170405/1e830b8e/attachment.html>


More information about the users mailing list