|
1 | 1 | #!/usr/bin/env python3 |
2 | 2 |
|
3 | 3 | import argparse |
| 4 | +from collections import defaultdict |
4 | 5 | import json |
5 | 6 | import os |
6 | 7 | import subprocess |
@@ -133,8 +134,7 @@ def run_nix_eval_jobs( |
133 | 134 |
|
134 | 135 | for line in process.stdout: |
135 | 136 | package = parse_nix_eval_line(line, drv_paths, target) |
136 | | - if package and not package["already_cached"]: |
137 | | - print(f"Found package: {package['attr']}", file=sys.stderr) |
| 137 | + if package: |
138 | 138 | yield package |
139 | 139 |
|
140 | 140 | if process.returncode and process.returncode != 0: |
@@ -168,23 +168,22 @@ def main() -> None: |
168 | 168 |
|
169 | 169 | cmd = build_nix_eval_command(max_workers, flake_output) |
170 | 170 |
|
171 | | - gh_action_packages = list(run_nix_eval_jobs(cmd, flake_output)) |
| 171 | + gh_action_packages = sorted( |
| 172 | + list(run_nix_eval_jobs(cmd, flake_output)), key=lambda pkg: pkg["name"] |
| 173 | + ) |
172 | 174 |
|
173 | 175 | if args.target == "extensions": |
174 | 176 | # filter to only include extension packages and add postgresql_version field |
175 | 177 | gh_action_packages = [ |
176 | 178 | {**pkg, "postgresql_version": pkg["attr"].split(".")[-3]} |
177 | 179 | for pkg in gh_action_packages |
178 | | - if is_extension_pkg(pkg) |
| 180 | + if is_extension_pkg(pkg) and not pkg["already_cached"] |
179 | 181 | ] |
180 | 182 |
|
181 | 183 | # Group packages by system |
182 | | - grouped_by_system = {} |
| 184 | + grouped_by_system = defaultdict(list) |
183 | 185 | for pkg in gh_action_packages: |
184 | | - system = pkg["system"] |
185 | | - if system not in grouped_by_system: |
186 | | - grouped_by_system[system] = [] |
187 | | - grouped_by_system[system].append(pkg) |
| 186 | + grouped_by_system[pkg["system"]].append(pkg) |
188 | 187 |
|
189 | 188 | # Create output with system-specific matrices |
190 | 189 | gh_output = {} |
|
0 commit comments