[users at bb.net] Continue build based on content in file

Jonas Kvinge jonas at timeoutofmind.net
Fri Aug 14 15:23:01 UTC 2020


Hi,

I'm trying to make a builder stop based on the content of a file.

In this function I read INCLUDE_GIT_REVISION from cmake/Version.cmake to
see if it is set to ON or OFF.

Example code:

def MakePPABuilder(distro, ppa_type, ppa_path):

  f = factory.BuildFactory()

  git_args = GitArgs("strawberry", "ppa")
  git_args["mode"] = "full"
  git_args["method"] = "fresh"
  f.addStep(git.Git(**git_args))

  f.addStep(
    steps.SetPropertyFromCommand(
      name="get INCLUDE_GIT_REVISION",
      workdir="source",
      command=["sh", "-c", "sed -n 's/^set(INCLUDE_GIT_REVISION
\\(.*\\))/\\1/p' cmake/Version.cmake"],
      property="git_revision_prop",
      haltOnFailure=True
    )
  )

include_git_revision=util.Interpolate("%(prop:git_revision_prop)s")

If I write:

if include_git_revision == ['something']:
  return f

Then it always returns from the function, and never continues
independent of what include_git_revision is set to.

if I write the same line with not, then it always continues.

If I simply echo the value set by util.Interpolate, it looks fine,
correctly set to ON or OFF from the Version.cmake file.

  f.addStep(
    shell.ShellCommand(
      name="echo",
      workdir="source",
      command=["echo", ppa_type, include_git_revision],
      haltOnFailure=True
    )
  )

The if line works fine with the parameter variables, ie: ppa_type

The whole buildbot configuration is on
https://github.com/strawberrymusicplayer/strawberry-buildbot

Jonas




More information about the users mailing list