From d20c5da0daff278ef9dc3bcb32991a9d141133f9 Mon Sep 17 00:00:00 2001 From: Brian Gianforcaro Date: Mon, 17 Jan 2022 00:52:42 -0800 Subject: 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. --- Meta/lint-ports.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Meta/lint-ports.py') 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): -- cgit v1.2.3