chroot: require explicit initialisation (MR 2252)

We currently lazily initialize the chroot's on first use, plus a few
bonus calls to init. However, there are some instances where we actually
don't want the chroot to be initialised (mostly to break recursion
loops).

Simplify the codebase by removing all of this, and just calling
pmb.chroot.init() where it's needed.

In addition, print a warning if init() is called multiple times for one
chroot. This should help us catch these instances if they crop up again.

Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
Caleb Connolly 2024-05-24 04:03:57 +02:00 committed by Oliver Smith
parent 22f805a325
commit 1d9bbd613e
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
11 changed files with 21 additions and 21 deletions

View file

@ -11,6 +11,7 @@ import pmb.aportgen
import pmb.build
import pmb.build.autodetect
import pmb.chroot
import pmb.chroot.apk
import pmb.chroot.initfs
import pmb.chroot.other
import pmb.ci
@ -172,6 +173,8 @@ def chroot(args: PmbArgs):
if args.add:
pmb.chroot.apk.install(args, args.add.split(","), suffix)
pmb.chroot.init(args, suffix)
# Xauthority
env = {}
if args.xauth: