# shellcheck shell=bash disable=SC2034 # sourced by run-maint-scenarios.sh # Scenario: paccache -rk3 trims an installed package's cache to 3 versions. # # paccache decides from filenames, so five fake versions of a package that # IS installed (bash) stand in for a fat cache. The bootstrap may leave a # real bash package in the cache too, so the assert uses the ordering # invariant rather than a count: the two newest fakes survive any keep-3 # window that contains them, and the two oldest fall outside it whether or # not a real (newer) version is cached alongside. SCENARIO_DESC="pacman cache trimmed to three versions per package" SCENARIO_GROUP="packages" SCENARIO_PROFILES="any" scenario_break() { mexec "for v in 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5; do touch /var/cache/pacman/pkg/bash-\$v-1-x86_64.pkg.tar.zst; done; ls /var/cache/pacman/pkg/ | grep -c '^bash-'" } scenario_fix() { mfix cache_clean } scenario_assert() { mexec "test -e /var/cache/pacman/pkg/bash-1.0.5-1-x86_64.pkg.tar.zst && test -e /var/cache/pacman/pkg/bash-1.0.4-1-x86_64.pkg.tar.zst && test ! -e /var/cache/pacman/pkg/bash-1.0.2-1-x86_64.pkg.tar.zst && test ! -e /var/cache/pacman/pkg/bash-1.0.1-1-x86_64.pkg.tar.zst" }