@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",
]:
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)))
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:
return
config.parent.mkdir(exist_ok=True, parents=True)
-
config.write_text("\n".join(repo.url for repo in repositories) + "\n")
@classmethod
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: