Abort transactions that would replace the pinned local builds and stage the refresh hook for new users

This commit is contained in:
ZacharyZhang-NY committed 2026-10-06 09:01:09 -04:00
1 parent 947a69ba91
commit 45b31ae98c
3 files changed
+49 -14

No files matched your search

+10 -1
View File
@@ -42,6 +42,12 @@ class PinLocalPackagesTest(unittest.TestCase):
hook = root / "home/test/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages"
self.assertIn(f'line="{LINE}"', hook.read_text())
self.assertTrue(hook.stat().st_mode & 0o111)
guard = (root / "etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook").read_text()
for package in ("omarchy-dev", "omarchy-settings-dev", "rime-ice-installer"):
self.assertIn(f"Target = {package}\n", guard)
self.assertIn("AbortOnFail", guard)
skel = root / "etc/skel/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages"
self.assertEqual(skel.read_text(), hook.read_text())
run.assert_called_with(
["arch-chroot", str(root), "chown", "-R", "test:test", "/home/test/.config/omarchy/hooks"],
check=True,
@@ -59,11 +65,13 @@ class PinLocalPackagesTest(unittest.TestCase):
subprocess.run(["bash", "-c", script], check=True)
self.assertEqual(conf.read_text(), CONF.replace("[options]\n", f"[options]\n{LINE}\n"))
def test_deferred_install_pins_without_a_user_hook(self):
def test_deferred_install_stages_the_hook_for_the_first_owner(self):
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
run = self.run_pin(root, pinned=True, defer=True)
self.assertIn(LINE, (root / "etc/pacman.conf").read_text())
self.assertTrue((root / "etc/pacman.d/hooks/00-omarchy-pin-local-builds.hook").exists())
self.assertTrue((root / "etc/skel/.config/omarchy/hooks/pre-refresh-pacman.d/pin-local-packages").exists())
self.assertFalse((root / "home").exists())
run.assert_not_called()
@@ -72,6 +80,7 @@ class PinLocalPackagesTest(unittest.TestCase):
root = Path(tmp)
self.run_pin(root, pinned=False)
self.assertEqual((root / "etc/pacman.conf").read_text(), CONF)
self.assertFalse((root / "etc/pacman.d").exists())
if __name__ == "__main__":