diff options
author | Brian Gianforcaro <bgianf@serenityos.org> | 2022-01-17 00:52:42 -0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-17 11:17:15 +0100 |
commit | d20c5da0daff278ef9dc3bcb32991a9d141133f9 (patch) | |
tree | 8327bc63284b716309fe4dd6f9aeb3832bb8df79 /Meta/lint-ports.py | |
parent | 4b2bbe6a7eb873eb8a3a80a8ed20a7d127e4be51 (diff) | |
download | serenity-d20c5da0daff278ef9dc3bcb32991a9d141133f9.zip |
Meta: Optimized lint-ports.py by avoiding duplicate execs of package.sh
The way that lint-ports.py obtains the ports properties is unfortunately
very process intensive. You have to execute `./package.sh showproperty`
once for each property, for each port. Resulting in hundreds of
executions.
We were doing this work twice in both `check_package_files()` and in
`read_port_dirs()`. This resulted in a runtime of around ~10 seconds on
my machine. Removing the duplicate work and allowing the other code path
to utilize the to use the cached properties brought the runtime down to
~5 seconds on my machine.
Diffstat (limited to 'Meta/lint-ports.py')
-rwxr-xr-x | Meta/lint-ports.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Meta/lint-ports.py b/Meta/lint-ports.py index e1aea73551..8a5448e220 100755 --- a/Meta/lint-ports.py +++ b/Meta/lint-ports.py @@ -221,13 +221,11 @@ def check_package_files(ports): """ all_good = True - for port in ports: + for port in ports.keys(): package_file = f"{port}/package.sh" if not os.path.exists(package_file): continue - - props = get_port_properties(port) - + props = ports[port] if not props['auth_type'] in ('sha256', 'sig', ''): print(f"Ports/{port} uses invalid signature algorithm '{props['auth_type']}' for 'auth_type'") all_good = False @@ -469,7 +467,7 @@ def run(): for port in sorted(ports_set - from_table_set): print(f" {port}") - if not check_package_files(ports.keys()): + if not check_package_files(ports): all_good = False if not check_available_ports(from_table, ports): |