1
0
Fork 1
mirror of https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git synced 2025-07-19 18:45:09 +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

@ -103,7 +103,7 @@ def rewrite(
lines_new += line.rstrip() + "\n"
# Copy/modify lines, skip Maintainer/Contributor
path = get_context().config.work / "aportgen/APKBUILD"
path = get_context().config.cache / "aportgen/APKBUILD"
with open(path, "r+", encoding="utf-8") as handle:
skip_in_func = False
for line in handle.readlines():
@ -173,7 +173,7 @@ def get_upstream_aport(pkgname: str, arch: Arch | None = None, retain_branch: bo
"""
# APKBUILD
pmb.helpers.git.clone("aports_upstream")
aports_upstream_path = get_context().config.work / "cache_git/aports_upstream"
aports_upstream_path = get_context().config.cache / "git/aports_upstream"
if retain_branch:
logging.info("Not changing aports branch as --fork-alpine-retain-branch was used.")
@ -252,7 +252,7 @@ def prepare_tempdir() -> Path:
chroot = Chroot.native()
pmb.chroot.init(chroot)
tempdir = Path("/tmp/aportgen")
aportgen = get_context().config.work / "aportgen"
aportgen = get_context().config.cache / "aportgen"
pmb.chroot.root(["rm", "-rf", tempdir], chroot)
pmb.helpers.run.user(["mkdir", "-p", aportgen, chroot / tempdir])
@ -265,7 +265,7 @@ def generate_checksums(tempdir: Path, apkbuild_path: Path) -> None:
:param tempdir: Temporary directory as provided by prepare_tempdir().
:param apkbuild_path: APKBUILD to generate new checksums for.
"""
aportgen = get_context().config.work / "aportgen"
aportgen = get_context().config.cache / "aportgen"
pmb.build.init_abuild_minimal()
pmb.chroot.root(["chown", "-R", "pmos:pmos", tempdir])