- Fix addRepo to use 'config-manager addrepo --from-repofile=' for dnf5
(dnf4 uses 'config-manager --add-repo')
- Add fedora:latest (dnf5) to containertest matrix
- Add IsDNF5 detection integration test
- Add RepoManager and NameNormalizer integration test coverage
- Rename containertest fedora entry to fedora-dnf4 for clarity
Detect dnf5 at startup via 'dnf --version' output and route to
version-specific parsers and command arguments.
Key changes:
- DNF struct caches v5 detection result
- New parse_dnf5.go with parsers for all dnf5 output formats
- stripPreamble() removes dnf5 repository loading noise
- Command arguments adjusted: --installed, --upgrades, --available
- CI matrix expanded with fedora:latest (dnf5) alongside fedora:39 (dnf4)
- Full backward compatibility with dnf4 preserved
Run with: go test -tags containertest -v -count=1 -timeout 10m .
Spins up Debian, Alpine, Arch, and Fedora containers locally via Docker,
copies the module source in, and runs the full integration test suite
in each. All four distros pass.
Requires Docker. Use build tag 'containertest' (separate from 'integration'
which runs directly on the host).
- Fedora 40+ ships dnf5 (not 41 as assumed) — pin to 39
- Debian container: /usr/bin/bash doesn't exist, use /usr/bin/dpkg
- Alpine: use busybox for LatestVersion test (always available)
- apk: Info test uses busybox (pre-installed) instead of curl (not installed)
- apk: LatestVersion test uses tree (installed during test)
- dpkg: Owner test uses /usr/bin/bash (not /bin/bash symlink)
- flatpak: List test checks both Name and Application ID fields
- dnf: pin Fedora to 41 (dnf4); dnf5 has incompatible output format
Type assertions require an interface type, not a concrete struct pointer.
Changed all integration tests from 'mgr := pkg.New()' to
'var mgr snack.Manager = pkg.New()' so capability checks like
mgr.(snack.VersionQuerier) compile correctly.
Pass 2 (Correctness & Safety):
- Separate stdout/stderr in apk list and search to prevent error messages
from contaminating parsed output
- All providers verified: mutex on mutating ops, CommandContext everywhere,
proper error wrapping, nil-safe parseInfo functions
pkg implements Manager, VersionQuerier, Cleaner, and FileOwner interfaces
wrapping FreeBSD's pkg(8) CLI. ports implements Manager wrapping OpenBSD's
pkg_add/pkg_delete/pkg_info tools.
Both use build tags (freebsd/openbsd) for real implementations with stub
files for other platforms. Includes parser tests for all output formats.
Implements the dnf sub-package with Manager, VersionQuerier, Holder,
Cleaner, FileOwner, RepoManager, KeyManager, Grouper, and NameNormalizer
interfaces.
Implements the rpm sub-package with Manager, FileOwner, and
NameNormalizer interfaces.
Both follow the existing pattern: exported methods on struct delegate to
unexported functions, _linux.go for real implementations, _other.go with
build-tag stubs, embedded snack.Locker for mutating operations, and
compile-time interface checks.
Includes parser tests for all output formats.
flatpak: implements Manager, Cleaner, and RepoManager interfaces
- Install/Remove/Purge/Upgrade with flatpak CLI
- Repository management (add/remove/list remotes)
- Autoremove unused runtimes
snap: implements Manager and VersionQuerier interfaces
- Install with --classic/--channel support via Target.FromRepo
- Remove/Purge/Upgrade via snap CLI
- Version queries with semver comparison
- Upgrade availability via snap refresh --list
Both packages follow the existing pattern:
- Exported methods on struct delegate to unexported functions
- _linux.go for real implementation, _other.go stubs
- Compile-time interface checks
- Parser tests for all output formats
apt: VersionQuerier, Holder, Cleaner, FileOwner, RepoManager, KeyManager, NameNormalizer
dpkg: FileOwner, NameNormalizer
All new interfaces follow the existing pattern of exported methods on
struct delegating to unexported platform-specific functions. Mutating
operations use Lock/Unlock; read-only operations do not.
Platform stubs in _other.go files return ErrUnsupportedPlatform.
Compile-time interface checks added for all implemented interfaces.
pacman:
- VersionQuerier: latestVersion via pacman -Si, listUpgrades via pacman -Qu,
upgradeAvailable via pacman -Qu <pkg>, versionCmp via vercmp
- Cleaner: autoremove via pacman -Qdtq | pacman -Rns, clean via pacman -Sc
- FileOwner: fileList via pacman -Ql, owner via pacman -Qo
- Grouper: groupList/groupInfo via pacman -Sg, groupInstall via pacman -S
- Note: Holder skipped (no clean CLI support)
apk:
- VersionQuerier: latestVersion via apk policy, listUpgrades via apk upgrade --simulate,
upgradeAvailable by checking upgrade list, versionCmp via apk version -t
- Cleaner: clean via apk cache clean, autoremove is no-op (not supported)
- FileOwner: fileList via apk info -L, owner via apk info --who-owns
- Add snack.Locker embed for per-provider mutex serialization
- Update all providers (pacman, apk, apt, dpkg) to use []Target
with version pinning support (pkg=version syntax)
- Add lock/unlock to all mutating operations (Install, Remove, Purge,
Upgrade, Update)
- Add snack.TargetNames helper and formatTargets per provider
- apt: add FromRepo (-t) and Reinstall support
- dpkg: use Target.Source for .deb file paths in Install
Breaking change to Manager interface: Install/Remove/Purge now accept
[]Target instead of []string. Target supports Version pinning, FromRepo
constraints, and Source paths — matching SaltStack's pkgs list semantics.
Also adds WithRefresh, WithFromRepo, WithReinstall options.
Breaking change to Manager interface: Install/Remove/Purge now accept
[]Target instead of []string. Target supports Version pinning, FromRepo
constraints, and Source paths — matching SaltStack's pkgs list semantics.
Also adds WithRefresh, WithFromRepo, WithReinstall options.
Implement the snack.Manager interface for both apt (Debian/Ubuntu) and
dpkg (low-level Debian package tool).
apt wraps apt-get, apt-cache, and dpkg-query for full package management.
dpkg wraps dpkg and dpkg-query for low-level .deb operations.
Upgrade and Update return ErrUnsupportedPlatform for dpkg.
Both packages include:
- Linux implementations with proper error wrapping
- Non-linux build stubs returning ErrUnsupportedPlatform
- Output parsing helpers with tests
- Functional options support (sudo, assume-yes, dry-run)
Implements the snack.Manager interface for Alpine Linux's apk-tools:
- Install, Remove, Purge, Upgrade, Update operations
- List installed, Search, Info, IsInstalled, Version queries
- Output parsing for apk list, search, and info formats
- Linux-only implementation with build-tag stubs for other platforms
- Options support: WithSudo, WithDryRun, WithRoot
- Tests for all output parsing functions