diff options
| author | Ross Burton <ross.burton@arm.com> | 2025-05-16 11:42:06 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-05-19 17:35:43 +0100 |
| commit | 8576e869a2cb4699e016d04d337f6caf09996348 (patch) | |
| tree | af5d0809b7c80c5118824fc25dafcce84ca3dbee | |
| parent | 3d131ece589cbe0a167328e78bf79985f5fb43fb (diff) | |
| download | poky-8576e869a2cb4699e016d04d337f6caf09996348.tar.gz | |
buildstats-diff: find last two buildstats files if none are specified
If no buildstats directories are specified, then find the last two runs
under BUILDDIR.
(From OE-Core rev: 6ed0a13ae68a5e41a43ebd97d9ed154080a7101b)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rwxr-xr-x | scripts/buildstats-diff | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/scripts/buildstats-diff b/scripts/buildstats-diff index c9aa76a8fa..df1df432f1 100755 --- a/scripts/buildstats-diff +++ b/scripts/buildstats-diff | |||
| @@ -12,6 +12,7 @@ import glob | |||
| 12 | import logging | 12 | import logging |
| 13 | import math | 13 | import math |
| 14 | import os | 14 | import os |
| 15 | import pathlib | ||
| 15 | import sys | 16 | import sys |
| 16 | from operator import attrgetter | 17 | from operator import attrgetter |
| 17 | 18 | ||
| @@ -251,11 +252,32 @@ Script for comparing buildstats of two separate builds.""" | |||
| 251 | "average over them") | 252 | "average over them") |
| 252 | parser.add_argument('--only-task', dest='only_tasks', metavar='TASK', action='append', default=[], | 253 | parser.add_argument('--only-task', dest='only_tasks', metavar='TASK', action='append', default=[], |
| 253 | help="Only include TASK in report. May be specified multiple times") | 254 | help="Only include TASK in report. May be specified multiple times") |
| 254 | parser.add_argument('buildstats1', metavar='BUILDSTATS1', help="'Left' buildstat") | 255 | parser.add_argument('buildstats1', metavar='BUILDSTATS1', nargs="?", help="'Left' buildstat") |
| 255 | parser.add_argument('buildstats2', metavar='BUILDSTATS2', help="'Right' buildstat") | 256 | parser.add_argument('buildstats2', metavar='BUILDSTATS2', nargs="?", help="'Right' buildstat") |
| 256 | 257 | ||
| 257 | args = parser.parse_args(argv) | 258 | args = parser.parse_args(argv) |
| 258 | 259 | ||
| 260 | if args.buildstats1 and args.buildstats2: | ||
| 261 | # Both paths specified | ||
| 262 | pass | ||
| 263 | elif args.buildstats1 or args.buildstats2: | ||
| 264 | # Just one path specified, this is an error | ||
| 265 | parser.print_usage(sys.stderr) | ||
| 266 | print("Either specify two buildstats paths, or none to use the last two paths.", file=sys.stderr) | ||
| 267 | sys.exit(1) | ||
| 268 | else: | ||
| 269 | # No paths specified, try to find the last two buildstats | ||
| 270 | try: | ||
| 271 | buildstats_dir = pathlib.Path(os.environ["BUILDDIR"]) / "tmp" / "buildstats" | ||
| 272 | paths = sorted(buildstats_dir.iterdir()) | ||
| 273 | args.buildstats2 = paths.pop() | ||
| 274 | args.buildstats1 = paths.pop() | ||
| 275 | print(f"Comparing {args.buildstats1} -> {args.buildstats2}\n") | ||
| 276 | except KeyError: | ||
| 277 | parser.print_usage(sys.stderr) | ||
| 278 | print("Build environment has not been configured, cannot find buildstats", file=sys.stderr) | ||
| 279 | sys.exit(1) | ||
| 280 | |||
| 259 | # We do not nedd/want to read all buildstats if we just want to look at the | 281 | # We do not nedd/want to read all buildstats if we just want to look at the |
| 260 | # package versions | 282 | # package versions |
| 261 | if args.ver_diff: | 283 | if args.ver_diff: |
