forked from Mirror/pmbootstrap
pmb.chroot: install() make chroot a required argument (MR 2252)
Defaulting to the native chroot isn't necessarily intuitive. Let's require this be specified in full. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
3322eab30c
commit
2e68f40dd4
8 changed files with 19 additions and 18 deletions
|
@ -198,7 +198,7 @@ def is_necessary_warn_depends(args: PmbArgs, apkbuild, arch, force, depends_buil
|
||||||
|
|
||||||
|
|
||||||
def init_buildenv(args: PmbArgs, apkbuild, arch, strict=False, force=False, cross=None,
|
def init_buildenv(args: PmbArgs, apkbuild, arch, strict=False, force=False, cross=None,
|
||||||
suffix: Chroot = Chroot.native(), skip_init_buildenv=False, src=None):
|
chroot: Chroot = Chroot.native(), skip_init_buildenv=False, src=None):
|
||||||
"""Build all dependencies.
|
"""Build all dependencies.
|
||||||
|
|
||||||
Check if we need to build at all (otherwise we've
|
Check if we need to build at all (otherwise we've
|
||||||
|
@ -227,22 +227,22 @@ def init_buildenv(args: PmbArgs, apkbuild, arch, strict=False, force=False, cros
|
||||||
|
|
||||||
# Install and configure abuild, ccache, gcc, dependencies
|
# Install and configure abuild, ccache, gcc, dependencies
|
||||||
if not skip_init_buildenv:
|
if not skip_init_buildenv:
|
||||||
pmb.build.init(args, suffix)
|
pmb.build.init(args, chroot)
|
||||||
pmb.build.other.configure_abuild(args, suffix)
|
pmb.build.other.configure_abuild(args, chroot)
|
||||||
if args.ccache:
|
if args.ccache:
|
||||||
pmb.build.other.configure_ccache(args, suffix)
|
pmb.build.other.configure_ccache(args, chroot)
|
||||||
if "rust" in depends or "cargo" in depends:
|
if "rust" in depends or "cargo" in depends:
|
||||||
pmb.chroot.apk.install(args, ["sccache"], suffix)
|
pmb.chroot.apk.install(args, ["sccache"], chroot)
|
||||||
if not strict and "pmb:strict" not in apkbuild["options"] and len(depends):
|
if not strict and "pmb:strict" not in apkbuild["options"] and len(depends):
|
||||||
pmb.chroot.apk.install(args, depends, suffix)
|
pmb.chroot.apk.install(args, depends, chroot)
|
||||||
if src:
|
if src:
|
||||||
pmb.chroot.apk.install(args, ["rsync"], suffix)
|
pmb.chroot.apk.install(args, ["rsync"], chroot)
|
||||||
|
|
||||||
# Cross-compiler init
|
# Cross-compiler init
|
||||||
if cross:
|
if cross:
|
||||||
pmb.build.init_compiler(args, depends, cross, arch)
|
pmb.build.init_compiler(args, depends, cross, arch)
|
||||||
if cross == "crossdirect":
|
if cross == "crossdirect":
|
||||||
pmb.chroot.mount_native_into_foreign(args, suffix)
|
pmb.chroot.mount_native_into_foreign(args, chroot)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
|
@ -129,4 +129,4 @@ def init_compiler(args: PmbArgs, depends, cross, arch):
|
||||||
# native macros / build scripts
|
# native macros / build scripts
|
||||||
cross_pkgs += depends
|
cross_pkgs += depends
|
||||||
|
|
||||||
pmb.chroot.apk.install(args, cross_pkgs)
|
pmb.chroot.apk.install(args, cross_pkgs, Chroot.native())
|
||||||
|
|
|
@ -219,7 +219,7 @@ def install_run_apk(args: PmbArgs, to_add, to_add_local, to_del, chroot: Chroot)
|
||||||
chroot=chroot)
|
chroot=chroot)
|
||||||
|
|
||||||
|
|
||||||
def install(args: PmbArgs, packages, chroot: Chroot=Chroot.native(), build=True):
|
def install(args: PmbArgs, packages, chroot: Chroot, build=True):
|
||||||
"""
|
"""
|
||||||
Install packages from pmbootstrap's local package index or the pmOS/Alpine
|
Install packages from pmbootstrap's local package index or the pmOS/Alpine
|
||||||
binary package mirrors. Iterate over all dependencies recursively, and
|
binary package mirrors. Iterate over all dependencies recursively, and
|
||||||
|
|
|
@ -23,7 +23,7 @@ def register(args: PmbArgs, arch):
|
||||||
# always make sure the qemu-<arch> binary is installed, since registering
|
# always make sure the qemu-<arch> binary is installed, since registering
|
||||||
# may happen outside of this method (e.g. by OS)
|
# may happen outside of this method (e.g. by OS)
|
||||||
if f"qemu-{arch_qemu}" not in pmb.chroot.apk.installed(args):
|
if f"qemu-{arch_qemu}" not in pmb.chroot.apk.installed(args):
|
||||||
pmb.chroot.apk.install(args, ["qemu-" + arch_qemu])
|
pmb.chroot.apk.install(args, ["qemu-" + arch_qemu], Chroot.native())
|
||||||
|
|
||||||
if is_registered(arch_qemu):
|
if is_registered(arch_qemu):
|
||||||
return
|
return
|
||||||
|
|
|
@ -40,7 +40,7 @@ def install_depends(args: PmbArgs):
|
||||||
depends = pmaports_cfg.get("supported_mtkclient_depends",
|
depends = pmaports_cfg.get("supported_mtkclient_depends",
|
||||||
"mtkclient,android-tools").split(",")
|
"mtkclient,android-tools").split(",")
|
||||||
|
|
||||||
pmb.chroot.apk.install(args, depends)
|
pmb.chroot.apk.install(args, depends, Chroot.native())
|
||||||
|
|
||||||
|
|
||||||
def init(args: PmbArgs):
|
def init(args: PmbArgs):
|
||||||
|
|
|
@ -134,7 +134,7 @@ def copy_files_from_chroot(args: PmbArgs, chroot: Chroot):
|
||||||
|
|
||||||
# Update or copy all files
|
# Update or copy all files
|
||||||
if args.rsync:
|
if args.rsync:
|
||||||
pmb.chroot.apk.install(args, ["rsync"])
|
pmb.chroot.apk.install(args, ["rsync"], Chroot.native())
|
||||||
rsync_flags = "-a"
|
rsync_flags = "-a"
|
||||||
if args.verbose:
|
if args.verbose:
|
||||||
rsync_flags += "vP"
|
rsync_flags += "vP"
|
||||||
|
@ -883,7 +883,7 @@ def install_system_image(args: PmbArgs, size_reserve, chroot: Chroot, step, step
|
||||||
if sparse and not split and not disk:
|
if sparse and not split and not disk:
|
||||||
workdir = Path("/home/pmos/rootfs")
|
workdir = Path("/home/pmos/rootfs")
|
||||||
logging.info("(native) make sparse rootfs")
|
logging.info("(native) make sparse rootfs")
|
||||||
pmb.chroot.apk.install(args, ["android-tools"])
|
pmb.chroot.apk.install(args, ["android-tools"], Chroot.native())
|
||||||
sys_image = args.device + ".img"
|
sys_image = args.device + ".img"
|
||||||
sys_image_sparse = args.device + "-sparse.img"
|
sys_image_sparse = args.device + "-sparse.img"
|
||||||
pmb.chroot.user(args, ["img2simg", sys_image, sys_image_sparse],
|
pmb.chroot.user(args, ["img2simg", sys_image, sys_image_sparse],
|
||||||
|
@ -895,7 +895,7 @@ def install_system_image(args: PmbArgs, size_reserve, chroot: Chroot, step, step
|
||||||
samsungify_strategy = args.deviceinfo["flash_sparse_samsung_format"]
|
samsungify_strategy = args.deviceinfo["flash_sparse_samsung_format"]
|
||||||
if samsungify_strategy:
|
if samsungify_strategy:
|
||||||
logging.info("(native) convert sparse image into Samsung's sparse image format")
|
logging.info("(native) convert sparse image into Samsung's sparse image format")
|
||||||
pmb.chroot.apk.install(args, ["sm-sparse-image-tool"])
|
pmb.chroot.apk.install(args, ["sm-sparse-image-tool"], Chroot.native())
|
||||||
sys_image = f"{args.device}.img"
|
sys_image = f"{args.device}.img"
|
||||||
sys_image_patched = f"{args.device}-patched.img"
|
sys_image_patched = f"{args.device}-patched.img"
|
||||||
pmb.chroot.user(args, ["sm_sparse_image_tool", "samsungify", "--strategy",
|
pmb.chroot.user(args, ["sm_sparse_image_tool", "samsungify", "--strategy",
|
||||||
|
@ -1302,7 +1302,7 @@ def install(args: PmbArgs):
|
||||||
# Install required programs in native chroot
|
# Install required programs in native chroot
|
||||||
step = 1
|
step = 1
|
||||||
logging.info(f"*** ({step}/{steps}) PREPARE NATIVE CHROOT ***")
|
logging.info(f"*** ({step}/{steps}) PREPARE NATIVE CHROOT ***")
|
||||||
pmb.chroot.apk.install(args, pmb.config.install_native_packages,
|
pmb.chroot.apk.install(args, pmb.config.install_native_packages, Chroot.native(),
|
||||||
build=False)
|
build=False)
|
||||||
step += 1
|
step += 1
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import pmb.helpers.run
|
||||||
import pmb.chroot.root
|
import pmb.chroot.root
|
||||||
import pmb.chroot.user
|
import pmb.chroot.user
|
||||||
import pmb.chroot.other
|
import pmb.chroot.other
|
||||||
|
import pmb.chroot.apk
|
||||||
from pmb.core import Chroot
|
from pmb.core import Chroot
|
||||||
|
|
||||||
|
|
||||||
|
@ -79,7 +80,7 @@ def bootimg(args: PmbArgs, path: Path):
|
||||||
logging.info("NOTE: You will be prompted for your sudo/doas password, so"
|
logging.info("NOTE: You will be prompted for your sudo/doas password, so"
|
||||||
" we can set up a chroot to extract and analyze your"
|
" we can set up a chroot to extract and analyze your"
|
||||||
" boot.img file")
|
" boot.img file")
|
||||||
pmb.chroot.apk.install(args, ["file", "unpackbootimg"])
|
pmb.chroot.apk.install(args, ["file", "unpackbootimg"], Chroot.native())
|
||||||
|
|
||||||
temp_path = pmb.chroot.other.tempfolder(args, Path("/tmp/bootimg_parser"))
|
temp_path = pmb.chroot.other.tempfolder(args, Path("/tmp/bootimg_parser"))
|
||||||
bootimg_path = Chroot.native() / temp_path / "boot.img"
|
bootimg_path = Chroot.native() / temp_path / "boot.img"
|
||||||
|
|
|
@ -325,7 +325,7 @@ def install_depends(args: PmbArgs, arch):
|
||||||
if args.efi:
|
if args.efi:
|
||||||
depends.append("ovmf")
|
depends.append("ovmf")
|
||||||
|
|
||||||
pmb.chroot.apk.install(args, depends)
|
pmb.chroot.apk.install(args, depends, Chroot.native())
|
||||||
|
|
||||||
|
|
||||||
def run(args: PmbArgs):
|
def run(args: PmbArgs):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue