@@ -11,10 +11,12 @@ import json
import os
import sys
import subprocess
-import errno
+import pathlib
import utils
+exported_properties = ['DISTRO', 'MACHINE', 'SDKMACHINE', 'PACKAGE_CLASSES']
+
parser = utils.ArgParser(description='Runs configurations in json.conf.')
parser.add_argument('target',
@@ -58,7 +60,8 @@ parser.add_argument('--workername',
help="the name of the worker the build is running on")
parser.add_argument('-j', '--json-outputfile',
action='store',
- default="",
+ default=None,
+ type=pathlib.Path,
help="the file to store json information about the build in")
parser.add_argument('--stepname',
action='store',
@@ -94,17 +97,26 @@ if arch == "qemux86" or arch == "qemux86-64":
else:
ourconfig["HELPERSTMACHTARGS"] = "-a -t machine -t toolchain-user"
-# Find out the number of steps this target has
+# Find out the number of steps this target has and properties
maxsteps = 0
stepnum = 0
+properties = {}
if args.target in ourconfig['overrides']:
+ target = ourconfig['overrides'][args.target]
maxsteps = 1
- for v in ourconfig['overrides'][args.target]:
+ for v in target:
if v.startswith("step"):
n = int(v[4:])
- if n <= maxsteps:
- continue
- maxsteps = n
+ if n > maxsteps:
+ maxsteps = n
+
+ # Get properties values for this build step, falling back to
+ # defaults if they are not set.
+ for prop in exported_properties:
+ for propdict in (target[v], target, ourconfig['defaults']):
+ if prop in propdict:
+ properties.setdefault(prop, set()).add(propdict[prop])
+ break
hp.printheader("Target task %s has %d steps" % (args.target, maxsteps))
@@ -377,8 +389,15 @@ elif args.phase == "finish" and args.stepname == "builddir-cleanup":
runcmd(["mv", args.builddir, args.builddir + "-renamed"])
if args.json_outputfile:
- with open(args.json_outputfile, "w") as f:
+ with args.json_outputfile.open("w") as f:
json.dump(jsonconfig, f, indent=4, sort_keys=True)
+ properties_outfile = args.json_outputfile.with_stem(f"{args.json_outputfile.stem}-properties")
+ properties = {k: list(v)[0] if len(v) == 1 else list(v)
+ for k, v in properties.items()}
+
+ with properties_outfile.open("w") as f:
+ json.dump(properties, f, indent=4, sort_keys=True)
+
sys.exit(0)
Extract some important build configuration values, allowing to add them to buildbot properties. Output filename is based on the one of --json-outputfile, so no additional argument is needed: the arguments list remain the same in all yocto-autobuilder-helper branches, with or without this commit. Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> --- scripts/run-config | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-)