]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Simplify apt invocation
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 16 Apr 2023 09:41:41 +0000 (11:41 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Mon, 17 Apr 2023 09:27:33 +0000 (11:27 +0200)
mkosi/distributions/debian.py

index f03a6c1048d6deab162bda41cbf1c8c7566b0ea4..021b61218a090934c2ce97192bc11a31c0e98d1d 100644 (file)
@@ -98,8 +98,8 @@ class DebianInstaller(DistributionInstaller):
         policyrcd.chmod(0o755)
 
         setup_apt(state, cls.repositories(state))
-        invoke_apt(state, "get", "update")
-        invoke_apt(state, "get", "install", packages)
+        invoke_apt(state, "update")
+        invoke_apt(state, "install", packages)
 
         policyrcd.unlink()
 
@@ -111,7 +111,7 @@ class DebianInstaller(DistributionInstaller):
 
     @classmethod
     def remove_packages(cls, state: MkosiState, packages: Sequence[str]) -> None:
-        invoke_apt(state, "get", "purge", packages)
+        invoke_apt(state, "purge", packages)
 
 
 # Debian calls their architectures differently, so when calling debootstrap we
@@ -184,15 +184,9 @@ def setup_apt(state: MkosiState, repos: Sequence[str]) -> None:
 
 def invoke_apt(
     state: MkosiState,
-    subcommand: str,
     operation: str,
     extra: Sequence[str] = tuple(),
 ) -> CompletedProcess:
-    cmdline = [
-        f"/usr/bin/apt-{subcommand}",
-        operation,
-        *extra,
-    ]
     env: dict[str, PathString] = dict(
         APT_CONFIG=state.workspace / "apt/apt.conf",
         DEBIAN_FRONTEND="noninteractive",
@@ -201,4 +195,4 @@ def invoke_apt(
         INITRD="No",
     )
 
-    return run_with_apivfs(state, cmdline, env=env)
+    return run_with_apivfs(state, ["apt-get", operation, *extra], env=env)