diff --git a/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py b/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py index 6276812..63900d2 100644 --- a/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py +++ b/configs/airootfs/usr/share/omarchy-iso/orchestrator/phases_impl.py @@ -746,6 +746,9 @@ def _runtime_package_list(ctx: InstallContext) -> list[str]: continue if s not in already_installed and s not in pkgs: pkgs.append(s) + # Local builds live only in this ISO's mirror; a later region switch could not fetch them. + if PINNED_PACKAGES.exists(): + pkgs += [p for p in PINNED_PACKAGES.read_text().split() if p not in already_installed and p not in pkgs] return pkgs diff --git a/test/unit/test_pin_local_packages.py b/test/unit/test_pin_local_packages.py index 4bb6d1f..62b10eb 100644 --- a/test/unit/test_pin_local_packages.py +++ b/test/unit/test_pin_local_packages.py @@ -83,5 +83,36 @@ class PinLocalPackagesTest(unittest.TestCase): self.assertFalse((root / "etc/pacman.d").exists()) +class RuntimePackagesTest(unittest.TestCase): + def runtime_packages(self, pinned: str | None) -> list[str]: + with tempfile.TemporaryDirectory() as tmp: + root = Path(tmp) + pinned_file = root / "pinned-packages" + if pinned is not None: + pinned_file.write_text(pinned) + base = root / "omarchy-base.packages" + base.write_text("# base\nfcitx5\ngit\n") + real_path = phases_impl.Path + + def path(arg, *rest): + if arg == "/usr/share/omarchy-iso/omarchy-base.packages": + return base + return real_path(arg, *rest) + + with mock.patch.object(phases_impl, "PINNED_PACKAGES", pinned_file), \ + mock.patch.object(phases_impl, "Path", side_effect=path), \ + mock.patch.object(phases_impl, "_early_packages", return_value=["git"]), \ + mock.patch.object(phases_impl, "_package_targets", return_value={ + "runtime": "omarchy-dev", "settings": "omarchy-settings-dev", "nvim": "omarchy-nvim"}): + return phases_impl._runtime_package_list(types.SimpleNamespace()) + + def test_local_builds_install_on_every_region(self): + packages = self.runtime_packages("omarchy-dev\nomarchy-settings-dev\nrime-ice-installer\n") + self.assertEqual(packages, ["omarchy-dev", "fcitx5", "rime-ice-installer"]) + + def test_published_builds_add_nothing(self): + self.assertEqual(self.runtime_packages(None), ["omarchy-dev", "fcitx5"]) + + if __name__ == "__main__": unittest.main()