]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Remove command argument from invoke_apt()
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 30 Jan 2024 18:53:45 +0000 (19:53 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 31 Jan 2024 13:24:43 +0000 (14:24 +0100)
This is always "apt-get" so let's remove the argument.

Also rename "command" and "verb" arguments for other other invoke()
functions to "operation" to be consistent in our naming.

mkosi/distributions/debian.py
mkosi/installer/apt.py
mkosi/installer/dnf.py
mkosi/installer/zypper.py

index dfdc3b9a364f47efd479a38c568e3cf63b4eb32f..8c4f76b9513a1610ad631107d2d5d939b6f99e31 100644 (file)
@@ -137,7 +137,7 @@ class Installer(DistributionInstaller):
                 (context.root / d).symlink_to(f"usr/{d}")
                 (context.root / f"usr/{d}").mkdir(parents=True, exist_ok=True)
 
-        invoke_apt(context, "apt-get", "update", apivfs=False)
+        invoke_apt(context, "update", apivfs=False)
 
         # Next, we invoke apt-get install to download all the essential packages. With DPkg::Pre-Install-Pkgs,
         # we specify a shell command that will receive the list of packages that will be installed on stdin.
@@ -147,7 +147,6 @@ class Installer(DistributionInstaller):
         with tempfile.NamedTemporaryFile(mode="r") as f:
             invoke_apt(
                 context,
-                "apt-get",
                 "install",
                 [
                     "-oDebug::pkgDPkgPm=1",
@@ -197,8 +196,8 @@ class Installer(DistributionInstaller):
         with umask(~0o644):
             policyrcd.write_text("#!/bin/sh\nexit 101\n")
 
-        invoke_apt(context, "apt-get", "update", apivfs=False)
-        invoke_apt(context, "apt-get", "install", packages, apivfs=apivfs)
+        invoke_apt(context, "update", apivfs=False)
+        invoke_apt(context, "install", packages, apivfs=apivfs)
         install_apt_sources(context, cls.repositories(context, local=False))
 
         policyrcd.unlink()
@@ -212,7 +211,7 @@ class Installer(DistributionInstaller):
 
     @classmethod
     def remove_packages(cls, context: Context, packages: Sequence[str]) -> None:
-        invoke_apt(context, "apt-get", "purge", packages)
+        invoke_apt(context, "purge", packages)
 
     @classmethod
     def architecture(cls, arch: Architecture) -> str:
index 81d38961dda4625a1c0a66db1975f2cb815f94bf..abf62b43c74e0b315e03340a78202c50deccd7ae 100644 (file)
@@ -123,7 +123,6 @@ def apt_cmd(context: Context, command: str) -> list[PathString]:
 
 def invoke_apt(
     context: Context,
-    command: str,
     operation: str,
     packages: Sequence[str] = (),
     *,
@@ -132,7 +131,7 @@ def invoke_apt(
 ) -> None:
     with finalize_ephemeral_source_mounts(context.config) as sources:
         run(
-            apt_cmd(context, command) + [operation, *sort_packages(packages)],
+            apt_cmd(context, "apt-get") + [operation, *sort_packages(packages)],
             sandbox=(
                 context.sandbox(
                     network=True,
index 65c302aa421fdec60889071ddf4491f43019c714..b22778bba5c7df969e347a7af5ec34ad41d8f6fe 100644 (file)
@@ -135,10 +135,10 @@ def dnf_cmd(context: Context) -> list[PathString]:
     return cmdline
 
 
-def invoke_dnf(context: Context, command: str, packages: Iterable[str], apivfs: bool = True) -> None:
+def invoke_dnf(context: Context, operation: str, packages: Iterable[str], apivfs: bool = True) -> None:
     with finalize_ephemeral_source_mounts(context.config) as sources:
         run(
-            dnf_cmd(context) + [command, *sort_packages(packages)],
+            dnf_cmd(context) + [operation, *sort_packages(packages)],
             sandbox=(
                 context.sandbox(
                     network=True,
index 81be7c2798ceeba776a79f9e772a14f137845c7a..7ac1781e845bce4fe8cbcea0da11ff92f60fbfaf 100644 (file)
@@ -85,7 +85,7 @@ def zypper_cmd(context: Context) -> list[PathString]:
 
 def invoke_zypper(
     context: Context,
-    verb: str,
+    operation: str,
     packages: Sequence[str] = (),
     *,
     options: Sequence[str] = (),
@@ -93,7 +93,7 @@ def invoke_zypper(
 ) -> None:
     with finalize_ephemeral_source_mounts(context.config) as sources:
         run(
-            zypper_cmd(context) + [verb, *options, *sort_packages(packages)],
+            zypper_cmd(context) + [operation, *options, *sort_packages(packages)],
             sandbox=(
                 context.sandbox(
                     network=True,