lib.Distro.pkg_files(): Take list[str] | None

Distro.pkg_files() takes a package name and returns a list of files in that
package. This commit generalizes that - pass None to it and get the list of
all packaged files in the system, and pass a list of strings to retrieve
all files belonging to the named packages.

The same arguments are propagated to _pkg_files(), which in turn propagates
them to list_files().

This allows faster generation of file lists than before. Having to retrieve
a list of matching packages and query each package for its contained files
can be collapsed into one or two backend calls.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-10-15 14:29:17 +02:00
commit 2fad5d189c
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61

View file

@ -56,7 +56,7 @@ class DummyDistro(Distro):
pass
@override
async def _pkg_files(self, name: str) -> Iterable[str]:
async def _pkg_files(self, names: list[str] | None) -> Iterable[str]:
return []
def distro(os_release_str: str) -> Distro: