diff options
| author | Ross Burton <ross.burton@arm.com> | 2024-10-18 17:34:14 +0100 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-25 15:25:32 +0100 |
| commit | 9dd8d5d6d21417f2d3e2f466589e375380864ec4 (patch) | |
| tree | 7f83f854ced087ff99a7997865f53a0abefe3a3c /scripts | |
| parent | 9d287835b2ecec53f191863d3f5380ef397ade27 (diff) | |
| download | poky-9dd8d5d6d21417f2d3e2f466589e375380864ec4.tar.gz | |
buildstats-summary: look for buildstats if not specified
If the user hasn't specified a buildstats directory, use the latest
entry under $BUILDDIR.
(From OE-Core rev: aeb69fbe130dca37b39d4065ec983441e0052803)
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>
Diffstat (limited to 'scripts')
| -rwxr-xr-x | scripts/buildstats-summary | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/buildstats-summary b/scripts/buildstats-summary index b10c671b29..cc2a27722a 100755 --- a/scripts/buildstats-summary +++ b/scripts/buildstats-summary | |||
| @@ -87,7 +87,11 @@ def main(argv=None) -> int: | |||
| 87 | ) | 87 | ) |
| 88 | 88 | ||
| 89 | parser.add_argument( | 89 | parser.add_argument( |
| 90 | "buildstats", metavar="BUILDSTATS", help="Buildstats file", type=pathlib.Path | 90 | "buildstats", |
| 91 | metavar="BUILDSTATS", | ||
| 92 | nargs="?", | ||
| 93 | type=pathlib.Path, | ||
| 94 | help="Buildstats file, or latest if not specified", | ||
| 91 | ) | 95 | ) |
| 92 | parser.add_argument( | 96 | parser.add_argument( |
| 93 | "--sort", | 97 | "--sort", |
| @@ -116,6 +120,16 @@ def main(argv=None) -> int: | |||
| 116 | 120 | ||
| 117 | args = parser.parse_args(argv) | 121 | args = parser.parse_args(argv) |
| 118 | 122 | ||
| 123 | # If a buildstats file wasn't specified, try to find the last one | ||
| 124 | if not args.buildstats: | ||
| 125 | try: | ||
| 126 | builddir = pathlib.Path(os.environ["BUILDDIR"]) | ||
| 127 | buildstats_dir = builddir / "tmp" / "buildstats" | ||
| 128 | args.buildstats = sorted(buildstats_dir.iterdir())[-1] | ||
| 129 | except KeyError: | ||
| 130 | print("Build environment has not been configured, cannot find buildstats") | ||
| 131 | return 1 | ||
| 132 | |||
| 119 | bs = read_buildstats(args.buildstats) | 133 | bs = read_buildstats(args.buildstats) |
| 120 | dump_buildstats(args, bs) | 134 | dump_buildstats(args, bs) |
| 121 | 135 | ||
