packages and image: wrap more upfront on missing binaries

This commit is contained in:
InsanePrawn 2022-08-28 17:21:16 +02:00
parent cdc803031e
commit 5cb747aa26
2 changed files with 6 additions and 5 deletions

View file

@ -18,7 +18,7 @@ from exec.file import root_write_file, root_makedir, makedir
from packages import build_enable_qemu_binfmt, build_packages_by_paths from packages import build_enable_qemu_binfmt, build_packages_by_paths
from packages.device import get_profile_device from packages.device import get_profile_device
from ssh import copy_ssh_keys from ssh import copy_ssh_keys
from wrapper import wrap_if_foreign_arch from wrapper import check_programs_wrap, wrap_if_foreign_arch
# image files need to be slightly smaller than partitions to fit # image files need to be slightly smaller than partitions to fit
IMG_FILE_ROOT_DEFAULT_SIZE = "1800M" IMG_FILE_ROOT_DEFAULT_SIZE = "1800M"
@ -389,7 +389,7 @@ def cmd_build(profile_name: str = None,
Unless overriden, required packages will be built or preferably downloaded from HTTPS repos. Unless overriden, required packages will be built or preferably downloaded from HTTPS repos.
""" """
arch = get_profile_device(profile_name).arch arch = get_profile_device(profile_name).arch
wrap_if_foreign_arch(arch) check_programs_wrap(['makepkg', 'pacman', 'pacstrap'])
profile: Profile = config.get_profile(profile_name) profile: Profile = config.get_profile(profile_name)
device, flavour = get_device_and_flavour(profile_name) device, flavour = get_device_and_flavour(profile_name)
size_extra_mb: int = int(profile["size_extra_mb"]) size_extra_mb: int = int(profile["size_extra_mb"])

View file

@ -11,7 +11,7 @@ from urllib.request import urlopen
from shutil import copyfileobj from shutil import copyfileobj
from typing import Iterable, Iterator, Optional from typing import Iterable, Iterator, Optional
from binfmt import register as binfmt_register from binfmt import register as binfmt_register, QEMU_ARCHES
from constants import REPOSITORIES, CROSSDIRECT_PKGS, QEMU_BINFMT_PKGS, GCC_HOSTSPECS, ARCHES, Arch, CHROOT_PATHS, MAKEPKG_CMD from constants import REPOSITORIES, CROSSDIRECT_PKGS, QEMU_BINFMT_PKGS, GCC_HOSTSPECS, ARCHES, Arch, CHROOT_PATHS, MAKEPKG_CMD
from config import config from config import config
from exec.cmd import run_cmd, run_root_cmd from exec.cmd import run_cmd, run_root_cmd
@ -591,6 +591,7 @@ def build_packages(
enable_ccache: bool = True, enable_ccache: bool = True,
clean_chroot: bool = False, clean_chroot: bool = False,
): ):
check_programs_wrap(['makepkg', 'pacman', 'pacstrap'])
init_prebuilts(arch) init_prebuilts(arch)
build_levels = get_unbuilt_package_levels( build_levels = get_unbuilt_package_levels(
packages, packages,
@ -636,6 +637,7 @@ def build_packages_by_paths(
if isinstance(paths, str): if isinstance(paths, str):
paths = [paths] paths = [paths]
check_programs_wrap(['makepkg', 'pacman', 'pacstrap'])
assert config.runtime.arch assert config.runtime.arch
for _arch in set([arch, config.runtime.arch]): for _arch in set([arch, config.runtime.arch]):
init_prebuilts(_arch) init_prebuilts(_arch)
@ -667,7 +669,7 @@ def build_enable_qemu_binfmt(arch: Arch, repo: Optional[dict[str, Pkgbuild]] = N
assert native assert native
if arch == native: if arch == native:
return return
wrap_if_foreign_arch(arch) check_programs_wrap([f'qemu-{QEMU_ARCHES[arch]}-static', 'pacman', 'makepkg'])
# build qemu-user, binfmt, crossdirect # build qemu-user, binfmt, crossdirect
build_packages_by_paths( build_packages_by_paths(
CROSSDIRECT_PKGS, CROSSDIRECT_PKGS,
@ -725,7 +727,6 @@ def build(
rebuild_dependants: bool = False, rebuild_dependants: bool = False,
try_download: bool = False, try_download: bool = False,
): ):
# TODO: arch = config.get_profile()...
arch = arch or get_profile_device(hint_or_set_arch=True).arch arch = arch or get_profile_device(hint_or_set_arch=True).arch
if arch not in ARCHES: if arch not in ARCHES: