]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Add remove_packages method to DistributionInstaller
authorJoerg Behrmann <behrmann@physik.fu-berlin.de>
Tue, 4 Oct 2022 15:51:30 +0000 (17:51 +0200)
committerJoerg Behrmann <behrmann@physik.fu-berlin.de>
Thu, 24 Nov 2022 14:51:33 +0000 (15:51 +0100)
This should probably live in PackageType, but there is a strong dependence
between package type and distribution and I haven't figured out a good way to do
this without cyclical imports.

mkosi/__init__.py
mkosi/distributions/__init__.py

index c5305375122beb4181c71476f4a79c31361245a3..58cac8f82f19459dd057add05faba7f74e3684a3 100644 (file)
@@ -2623,7 +2623,9 @@ def remove_packages(state: MkosiState) -> None:
 
     remove: Callable[[List[str]], Any]
 
-    if (state.config.distribution.package_type == PackageType.rpm):
+    if state.installer is not None:
+        remove = lambda p: state.installer.remove_packages(state, p) # type: ignore
+    elif (state.config.distribution.package_type == PackageType.rpm):
         remove = lambda p: invoke_dnf(state, 'remove', p)
     elif state.config.distribution.package_type == PackageType.deb:
         remove = lambda p: invoke_apt(state, "get", "purge", ["--assume-yes", "--auto-remove", *p])
index 751773d9dc7d5d766a78aeaa7a9797a968d8b083..b951f9a1c7ede4c25bddb2b00dcca9ee37c4ba97 100644 (file)
@@ -19,3 +19,7 @@ class DistributionInstaller:
     @classmethod
     def cache_path(cls) -> List[str]:
         raise NotImplementedError
+
+    @classmethod
+    def remove_packages(cls, state: "MkosiState", remove: List[str]) -> None:
+        pass