From 3c2e6fe2d042a14f3652421a7c865d76ba70fcec Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Sun, 28 Aug 2022 17:21:16 +0200 Subject: [PATCH] packages and image: wrap more upfront on missing binaries --- image.py | 4 ++-- packages/__init__.py | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/image.py b/image.py index 47430d2..adb44dc 100644 --- a/image.py +++ b/image.py @@ -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.device import get_profile_device 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 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. """ 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) device, flavour = get_device_and_flavour(profile_name) size_extra_mb: int = int(profile["size_extra_mb"]) diff --git a/packages/__init__.py b/packages/__init__.py index 79954a3..667d2b6 100644 --- a/packages/__init__.py +++ b/packages/__init__.py @@ -11,7 +11,7 @@ from urllib.request import urlopen from shutil import copyfileobj 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 config import config from exec.cmd import run_cmd, run_root_cmd @@ -591,6 +591,7 @@ def build_packages( enable_ccache: bool = True, clean_chroot: bool = False, ): + check_programs_wrap(['makepkg', 'pacman', 'pacstrap']) init_prebuilts(arch) build_levels = get_unbuilt_package_levels( packages, @@ -636,6 +637,7 @@ def build_packages_by_paths( if isinstance(paths, str): paths = [paths] + check_programs_wrap(['makepkg', 'pacman', 'pacstrap']) assert config.runtime.arch for _arch in set([arch, config.runtime.arch]): init_prebuilts(_arch) @@ -667,7 +669,7 @@ def build_enable_qemu_binfmt(arch: Arch, repo: Optional[dict[str, Pkgbuild]] = N assert native if arch == native: return - wrap_if_foreign_arch(arch) + check_programs_wrap([f'qemu-{QEMU_ARCHES[arch]}-static', 'pacman', 'makepkg']) # build qemu-user, binfmt, crossdirect build_packages_by_paths( CROSSDIRECT_PKGS, @@ -725,7 +727,6 @@ def build( rebuild_dependants: bool = False, try_download: bool = False, ): - # TODO: arch = config.get_profile()... arch = arch or get_profile_device(hint_or_set_arch=True).arch if arch not in ARCHES: