fix(packages): leave removed packages with leftover config out of apt

dpkg-query -W also lists packages that were removed but whose
configuration dpkg keeps (state rc), and the driver marked every line
installed: old kernels and a removed agent showed up as installed
software. The query now asks for db:Status-Abbrev and drops packages
that are not installed or only left their configuration; held, unpacked
and half-configured packages keep counting, their files are on disk.

The dpkg query and its parse move to napalm_linux/_dpkg.py, a pure
function under strict mypy, which keeps linux.py inside its line count.

Closes #17
This commit is contained in:
Christian Manivong committed 2026-11-01 21:48:05 +01:00
1 parent 54f6844d84
commit 024f68c543
5 files changed
+108 -51

No files matched your search

+4
View File
@@ -61,6 +61,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(`Tue Oct 6 08:47:15 2026`) and only the command line in `command` (#21). `started`
held the weekday alone and `command` began with the rest of the date. The start time
is read in the C locale, so its words are English on every host.
- `get_packages()` on apt hosts no longer lists removed packages whose configuration
dpkg still keeps (state `rc`) (#17). They were reported as installed: old kernels, or
an agent that had been removed. A package that is held, unpacked or half-configured
still counts, since its files are on disk.
## [0.15.1] - 2026-10-23