diff options
Diffstat (limited to 'scripts/buildstats-summary')
| -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 | ||
