Refactor state structure and capture versions of packages
This commit is contained in:
parent
984b0fa81b
commit
043802e800
6 changed files with 294 additions and 42 deletions
|
|
@ -81,6 +81,17 @@ class PackageBackend:
|
|||
def list_manual_packages(self) -> List[str]: # pragma: no cover
|
||||
raise NotImplementedError
|
||||
|
||||
def installed_packages(self) -> Dict[str, List[Dict[str, str]]]: # pragma: no cover
|
||||
"""Return mapping of package name -> installed instances.
|
||||
|
||||
Each instance is a dict with at least:
|
||||
- version: package version string
|
||||
- arch: architecture string
|
||||
|
||||
Backends should be best-effort and return an empty mapping on failure.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def build_etc_index(
|
||||
self,
|
||||
) -> Tuple[
|
||||
|
|
@ -121,6 +132,11 @@ class DpkgBackend(PackageBackend):
|
|||
|
||||
return list_manual_packages()
|
||||
|
||||
def installed_packages(self) -> Dict[str, List[Dict[str, str]]]:
|
||||
from .debian import list_installed_packages
|
||||
|
||||
return list_installed_packages()
|
||||
|
||||
def build_etc_index(self):
|
||||
from .debian import build_dpkg_etc_index
|
||||
|
||||
|
|
@ -194,6 +210,11 @@ class RpmBackend(PackageBackend):
|
|||
|
||||
return list_manual_packages()
|
||||
|
||||
def installed_packages(self) -> Dict[str, List[Dict[str, str]]]:
|
||||
from .rpm import list_installed_packages
|
||||
|
||||
return list_installed_packages()
|
||||
|
||||
def build_etc_index(self):
|
||||
from .rpm import build_rpm_etc_index
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue