mirror of
git://git.yoctoproject.org/yocto-autobuilder2.git
synced 2026-01-27 11:01:23 +01:00
builders: Improve the property fetching functionality
Rather than running specific commands on the builds, call a function in helper and read back the json properties in a generic way. This allows us to adapt the commands for the new layout from bitbake-setup. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
parent
49b6f636a3
commit
1d913d9a24
38
builders.py
38
builders.py
|
|
@ -96,6 +96,11 @@ def canStartBuild(builder, wfb, request):
|
|||
wfb.worker.exitQuarantine()
|
||||
return True
|
||||
|
||||
def extract_json_props(rc, stdout, stderr):
|
||||
if rc != 0 or stderr:
|
||||
return {}
|
||||
return json.loads(stdout)
|
||||
|
||||
def create_builder_factory():
|
||||
f = util.BuildFactory()
|
||||
|
||||
|
|
@ -127,18 +132,11 @@ def create_builder_factory():
|
|||
haltOnFailure=True,
|
||||
name="Unpack shared repositories"))
|
||||
|
||||
f.addStep(steps.SetPropertyFromCommand(command=util.Interpolate("cd %(prop:builddir)s/build; git rev-parse HEAD"),
|
||||
property="yp_build_revision",
|
||||
doStepIf=util.Property("yp_build_revision", default='') == '',
|
||||
haltOnFailure=True,
|
||||
name='Set build revision'))
|
||||
|
||||
f.addStep(steps.SetPropertyFromCommand(command=util.Interpolate("cd %(prop:builddir)s/build; git rev-parse --abbrev-ref HEAD"),
|
||||
property="yp_build_branch",
|
||||
doStepIf=util.Property("yp_build_branch", default='') == '',
|
||||
haltOnFailure=True,
|
||||
name='Set build branch'))
|
||||
|
||||
f.addStep(steps.SetPropertyFromCommand(
|
||||
command=util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/getproperties.py %(prop:builddir)s/build"),
|
||||
extract_fn=extract_json_props,
|
||||
name='Load build revisions',
|
||||
haltOnFailure=True))
|
||||
|
||||
f.addStep(RunConfigCheckSteps(posttrigger=False))
|
||||
|
||||
|
|
@ -330,17 +328,11 @@ def create_parent_builder_factory(buildername, waitname):
|
|||
haltOnFailure=True,
|
||||
name="Unpack shared repositories"))
|
||||
|
||||
factory.addStep(steps.SetPropertyFromCommand(command=util.Interpolate("cd %(prop:builddir)s/build; git rev-parse HEAD"),
|
||||
property="yp_build_revision",
|
||||
doStepIf=util.Property("yp_build_revision", default='') == '',
|
||||
haltOnFailure=True,
|
||||
name='Set build revision'))
|
||||
|
||||
factory.addStep(steps.SetPropertyFromCommand(command=util.Interpolate("cd %(prop:builddir)s/build; git rev-parse --abbrev-ref HEAD"),
|
||||
property="yp_build_branch",
|
||||
doStepIf=util.Property("yp_build_branch", default='') == '',
|
||||
haltOnFailure=True,
|
||||
name='Set build branch'))
|
||||
factory.addStep(steps.SetPropertyFromCommand(
|
||||
command=util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/getproperties.py %(prop:builddir)s/build"),
|
||||
extract_fn=extract_json_props,
|
||||
name='Load build revisions',
|
||||
haltOnFailure=True))
|
||||
|
||||
# run-config
|
||||
factory.addStep(RunConfigCheckSteps(posttrigger=False))
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user