From: Daan De Meyer Date: Tue, 30 Jan 2024 18:53:45 +0000 (+0100) Subject: Remove command argument from invoke_apt() X-Git-Tag: v21~77^2~10 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=719d2337f840f5f487fd036bb44132127a1899f7;p=thirdparty%2Fmkosi.git Remove command argument from invoke_apt() 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. --- diff --git a/mkosi/distributions/debian.py b/mkosi/distributions/debian.py index dfdc3b9a3..8c4f76b95 100644 --- a/mkosi/distributions/debian.py +++ b/mkosi/distributions/debian.py @@ -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: diff --git a/mkosi/installer/apt.py b/mkosi/installer/apt.py index 81d38961d..abf62b43c 100644 --- a/mkosi/installer/apt.py +++ b/mkosi/installer/apt.py @@ -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, diff --git a/mkosi/installer/dnf.py b/mkosi/installer/dnf.py index 65c302aa4..b22778bba 100644 --- a/mkosi/installer/dnf.py +++ b/mkosi/installer/dnf.py @@ -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, diff --git a/mkosi/installer/zypper.py b/mkosi/installer/zypper.py index 81be7c279..7ac1781e8 100644 --- a/mkosi/installer/zypper.py +++ b/mkosi/installer/zypper.py @@ -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,