From 8661faa4ce8f62dce05bd5aaf29948194a8c01d3 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sun, 14 Jun 2026 22:32:23 -0500 Subject: test(scripts): lock package-inventory behavior with characterization tests package-inventory compares archsetup's declared packages against the live system but had no tests, so a future archsetup edit (a new for-loop shape, a renamed install helper) could silently break the extraction. I added two env seams so the script is testable without the real system. PKGINV_ARCHSETUP points the extractor at a fixture installer, PKGINV_PACMAN swaps in a fake pacman serving controlled query output. Both default to the real targets, so normal use is unchanged, and the seams match the env-override pattern audit-packages.sh already uses. The 7 tests pin the extraction (direct calls, for-loop lists, variable-arg skip) and both diff directions against the fixture, with no network or real pacman db. I also added a make package-diff target so the tool is reachable alongside the test targets. --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 30a52d4..629c750 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ # (https://git.cjennings.net/dotfiles.git). Run them from there: # cd ~/.dotfiles && make stow|restow|reset|unstow|import -.PHONY: help deps test-unit test test-keep test-vm-base +.PHONY: help deps test-unit test test-keep test-vm-base package-diff # Default target - show help help: @@ -17,6 +17,7 @@ help: @echo " test Run full VM test suite (creates base VM if needed)" @echo " test-keep Run test and keep VM running for manual testing" @echo " test-vm-base Create base VM only (runs archangel)" + @echo " package-diff Compare archsetup's declared packages vs this system" @echo "" @echo "Dotfile stow operations now live in the dotfiles repo:" @echo " cd ~/.dotfiles && make stow|restow|reset|unstow|import " @@ -64,3 +65,8 @@ test-keep: bash scripts/testing/create-base-vm.sh; \ fi @bash scripts/testing/run-test.sh --keep + +# Compare the packages archsetup declares against what's installed here. +# Shows declared-but-missing and installed-but-undeclared (AUR vs official). +package-diff: + @bash scripts/package-inventory -- cgit v1.2.3