feat(dnf): add dnf5 compatibility

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
This commit is contained in:
2026-02-26 02:11:27 +00:00
parent 61e9c99ac0
commit beb4c51219
9 changed files with 527 additions and 45 deletions

View File

@@ -52,10 +52,25 @@ jobs:
- name: Integration tests (snap)
run: sudo -E go test -v -tags integration -count=1 ./snap/
fedora:
name: Fedora (dnf)
fedora-dnf4:
name: Fedora 39 (dnf4)
runs-on: ubuntu-latest
container: fedora:39 # last release with dnf4; dnf5 (fedora 40+) needs separate parser
container: fedora:39
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Setup
run: |
dnf install -y tree sudo
- name: Integration tests
run: go test -v -tags integration -count=1 ./dnf/ ./rpm/ ./detect/
fedora-dnf5:
name: Fedora latest (dnf5)
runs-on: ubuntu-latest
container: fedora:latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5