mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-14 11:59:47 +03:00
pmb.core.chroot: make type a property (MR 2252)
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
1d5eda75b5
commit
2d232200f8
4 changed files with 4 additions and 4 deletions
|
@ -94,7 +94,7 @@ def crosscompile(args: PmbArgs, apkbuild, arch, suffix: Chroot):
|
||||||
return None
|
return None
|
||||||
if not pmb.parse.arch.cpu_emulation_required(arch):
|
if not pmb.parse.arch.cpu_emulation_required(arch):
|
||||||
return None
|
return None
|
||||||
if suffix.type() == ChrootType.NATIVE:
|
if suffix.type == ChrootType.NATIVE:
|
||||||
return "native"
|
return "native"
|
||||||
if "!pmb:crossdirect" in apkbuild["options"]:
|
if "!pmb:crossdirect" in apkbuild["options"]:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -167,7 +167,7 @@ def init(args: PmbArgs, chroot: Chroot=Chroot.native(), usr_merge=UsrMerge.AUTO,
|
||||||
"add", "alpine-base"])
|
"add", "alpine-base"])
|
||||||
|
|
||||||
# Building chroots: create "pmos" user, add symlinks to /home/pmos
|
# Building chroots: create "pmos" user, add symlinks to /home/pmos
|
||||||
if not chroot.type() == ChrootType.ROOTFS:
|
if not chroot.type == ChrootType.ROOTFS:
|
||||||
pmb.chroot.root(args, ["adduser", "-D", "pmos", "-u",
|
pmb.chroot.root(args, ["adduser", "-D", "pmos", "-u",
|
||||||
pmb.config.chroot_uid_user],
|
pmb.config.chroot_uid_user],
|
||||||
chroot, auto_init=False)
|
chroot, auto_init=False)
|
||||||
|
|
|
@ -161,7 +161,7 @@ def chroot(args: PmbArgs):
|
||||||
# Suffix
|
# Suffix
|
||||||
suffix = _parse_suffix(args)
|
suffix = _parse_suffix(args)
|
||||||
if (args.user and suffix != Chroot.native() and
|
if (args.user and suffix != Chroot.native() and
|
||||||
not suffix.type() == ChrootType.BUILDROOT):
|
not suffix.type == ChrootType.BUILDROOT):
|
||||||
raise RuntimeError("--user is only supported for native or"
|
raise RuntimeError("--user is only supported for native or"
|
||||||
" buildroot_* chroots.")
|
" buildroot_* chroots.")
|
||||||
if args.xauth and suffix != Chroot.native():
|
if args.xauth and suffix != Chroot.native():
|
||||||
|
|
|
@ -19,7 +19,7 @@ def from_chroot_suffix(args: PmbArgs, chroot: Chroot) -> str:
|
||||||
return pmb.config.arch_native
|
return pmb.config.arch_native
|
||||||
if chroot.name() == args.device:
|
if chroot.name() == args.device:
|
||||||
return args.deviceinfo["arch"]
|
return args.deviceinfo["arch"]
|
||||||
if chroot.type() == ChrootType.BUILDROOT:
|
if chroot.type == ChrootType.BUILDROOT:
|
||||||
return chroot.name()
|
return chroot.name()
|
||||||
|
|
||||||
raise ValueError(f"Invalid chroot suffix: {chroot}"
|
raise ValueError(f"Invalid chroot suffix: {chroot}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue