1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-23 12:35:12 +03:00

treewide: split chroots from workdir

Introduce a new "cache" subdirectory in the pmbootstrap workdir, all the
cache and config bits go in here, anything that needs to be accessible
from inside a chroot. The whole dir is then bind-mounted into the chroot
as /cache with appropriate symlinks.

This dir is in the config as config.cache.

In addition, all the cache_* and other config dirs are renamed to
be closer to the names of the equivalent dirs in the chroot (e.g.
abuild-config) and to avoid redundant naming since they are now under a
"cache" dir.

Signed-off-by: Casey Connolly <kcxt@postmarketos.org>
This commit is contained in:
Casey Connolly 2025-05-26 18:23:49 +02:00
parent 1560a3f221
commit 9f8edf539d
34 changed files with 130 additions and 127 deletions

View file

@ -132,13 +132,13 @@ def configure_apk(args: PmbArgs, rootfs: Path) -> None:
"""
Copy over all official keys, and the keys used to compile local packages
(unless --no-local-pkgs is set). Then copy the corresponding APKINDEX files
and remove the /mnt/pmbootstrap/packages repository.
and remove the /cache/packages repository.
"""
# Official keys
keys_dir = pmb.config.apk_keys_path
# Official keys + local keys
keys_dir = get_context().config.work / "config_apk_keys"
keys_dir = get_context().config.cache / "keys"
# Copy over keys
for key in keys_dir.glob("*.pub"):
@ -417,16 +417,19 @@ def setup_appstream(offline: bool, chroot: Chroot) -> None:
if "alpine-appstream-downloader" not in installed_pkgs or offline:
return
if not pmb.chroot.root(
["alpine-appstream-downloader", "/mnt/appstream-data"], chroot, check=False
):
target_dir = Path("/cache/appstream") / chroot.arch / chroot.channel
logging.info(f"appstream target dir: {target_dir}")
# FIXME: it would be great to run this on the host and not potentially
# through QEMU!
if not pmb.chroot.root(["alpine-appstream-downloader", target_dir], chroot, check=False):
pmb.chroot.root(["mkdir", "-p", "/var/lib/swcatalog"], chroot)
pmb.chroot.root(
[
"cp",
"-r",
"/mnt/appstream-data/icons",
"/mnt/appstream-data/xml",
target_dir / "icons",
target_dir / "xml",
"-t",
"/var/lib/swcatalog",
],