fix: deterministic component ordering

Keep manifest order for package installation
This commit is contained in:
2 * r + 2 * t
2026-06-15 02:36:22 +10:00
parent 73bc3aadab
commit d1ed5d9db1
+13 -2
View File
@@ -173,8 +173,19 @@ class Manifest:
return [p[len(_LOCAL_PREFIX) :] for p in self._all_packages() if p.startswith(_LOCAL_PREFIX)] return [p[len(_LOCAL_PREFIX) :] for p in self._all_packages() if p.startswith(_LOCAL_PREFIX)]
def _all_packages(self) -> list[str]: def _all_packages(self) -> list[str]:
"""The manifest's top-level packages plus enabled components'.""" """The manifest's top-level packages plus enabled components', in manifest order.
return list(set(self.packages) | set(p for c in self._data.enabled_comps for p in self.components[c].packages))
Top-level packages come first, then each enabled component's packages in
component order. Only the first occurrence of each package is kept.
"""
seen: set[str] = set()
ordered: list[str] = []
for pkg in (*self.packages, *(p for c in self._data.enabled_comps for p in self.components[c].packages)):
if pkg not in seen:
seen.add(pkg)
ordered.append(pkg)
return ordered
def _require_key(d: dict[str, Any], key: str, ctx: str) -> Any: def _require_key(d: dict[str, Any], key: str, ctx: str) -> Any: