From: Daan De Meyer Date: Wed, 24 Sep 2025 08:44:08 +0000 (+0200) Subject: postmarketos: Coding style fixes X-Git-Tag: v26~109^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2fc1032c747f4aecacc348d8ff9e46ccbc2d67b;p=thirdparty%2Fmkosi.git postmarketos: Coding style fixes Use similar variable names as we use elsewhere instead of the verbose variable names that stick out like a sore thumb. --- diff --git a/mkosi/distributions/postmarketos.py b/mkosi/distributions/postmarketos.py index 2404be30e..a5fa17ddd 100644 --- a/mkosi/distributions/postmarketos.py +++ b/mkosi/distributions/postmarketos.py @@ -39,11 +39,9 @@ class Installer(DistributionInstaller): @classmethod def setup(cls, context: Context) -> None: with complete_step("Setting up postmarketOS keyring"): - # Create keys directory in sandbox - keys_dir = context.sandbox_tree / "etc/apk/keys" - keys_dir.mkdir(parents=True, exist_ok=True) + keys = context.sandbox_tree / "etc/apk/keys" + keys.mkdir(parents=True, exist_ok=True) - # Copy keys from various sources (if they exist) for d in [ context.config.tools() / "usr/lib/apk/keys", context.config.tools() / "usr/share/distribution-gpg-keys/alpine-linux", @@ -51,13 +49,17 @@ class Installer(DistributionInstaller): ]: if not d.exists(): continue - # Preserve/do not overwrite keys in keys_dir that already exist + + # Do not overwrite keys in /etc/apk/keys to make sure that user provided keys take priority. for key in d.iterdir(): - if key.is_file(): - dest = keys_dir / key.name - if dest.exists(): - continue - shutil.copy2(key, dest) + if key.is_dir(): + continue + + dest = keys / key.name + if dest.exists(): + continue + + shutil.copy2(key, dest) Apk.setup(context, list(cls.repositories(context))) @@ -92,13 +94,8 @@ class Installer(DistributionInstaller): mirror = context.config.mirror or "https://mirror.postmarketos.org/postmarketos" subdir = "master" if context.config.release == "edge" else f"v{context.config.release}" - # systemd repo - url = f"{mirror}/extra-repos/systemd/{subdir}" - yield ApkRepository(url=url) - - # main repo - url = f"{mirror}/{subdir}" - yield ApkRepository(url=url) + yield ApkRepository(url=f"{mirror}/extra-repos/systemd/{subdir}") + yield ApkRepository(url=f"{mirror}/{subdir}") @classmethod def architecture(cls, arch: Architecture) -> str: diff --git a/mkosi/installer/apk.py b/mkosi/installer/apk.py index 5f31ec140..541380715 100644 --- a/mkosi/installer/apk.py +++ b/mkosi/installer/apk.py @@ -44,7 +44,6 @@ class Apk(PackageManager): return config.parent.mkdir(exist_ok=True, parents=True) - config.write_text("\n".join(repo.url for repo in repositories) + "\n") @classmethod @@ -98,14 +97,18 @@ class Apk(PackageManager): apivfs: bool = True, allow_downgrade: bool = False, ) -> None: - arguments = [ - "--initdb", - "--upgrade", - # effectively disable refreshing the cache in this situation - "--cache-max-age", "999999999", - *packages, - ] # fmt: skip - cls.invoke(context, "add", arguments, apivfs=apivfs) + cls.invoke( + context, + "add", + [ + "--initdb", + "--upgrade", + # effectively disable refreshing the cache in this situation + "--cache-max-age", "999999999", + *packages, + ], + apivfs=apivfs, + ) # fmt: skip @classmethod def remove(cls, context: Context, packages: Sequence[str]) -> None: