packages/build: build_package(): respect Pkgbuild.nodeps

This commit is contained in:
InsanePrawn 2022-09-20 18:44:02 +02:00
parent 6ddab50e21
commit 103c18a171

View file

@ -462,7 +462,7 @@ def build_package(
makepkg_conf_path = 'etc/makepkg.conf' makepkg_conf_path = 'etc/makepkg.conf'
repo_dir = repo_dir if repo_dir else config.get_path('pkgbuilds') repo_dir = repo_dir if repo_dir else config.get_path('pkgbuilds')
foreign_arch = config.runtime.arch != arch foreign_arch = config.runtime.arch != arch
deps = (list(set(package.depends) - set(package.names()))) deps = (list(set(package.depends) - set(package.names()))) if not package.nodeps else []
needs_rust = 'rust' in deps needs_rust = 'rust' in deps
logging.info(f"{package.path}: Preparing to build: getting native arch build chroot") logging.info(f"{package.path}: Preparing to build: getting native arch build chroot")
build_root: BuildChroot build_root: BuildChroot
@ -491,8 +491,9 @@ def build_package(
env['PATH'] = f"/usr/lib/ccache:{env['PATH']}" env['PATH'] = f"/usr/lib/ccache:{env['PATH']}"
native_chroot.mount_ccache(user=build_user) native_chroot.mount_ccache(user=build_user)
logging.info('Setting up dependencies for cross-compilation') logging.info('Setting up dependencies for cross-compilation')
if not package.nodeps:
# include crossdirect for ccache symlinks and qemu-user # include crossdirect for ccache symlinks and qemu-user
results = native_chroot.try_install_packages(package.depends + CROSSDIRECT_PKGS + [f"{GCC_HOSTSPECS[native_chroot.arch][arch]}-gcc"]) results = native_chroot.try_install_packages(deps + CROSSDIRECT_PKGS + [f"{GCC_HOSTSPECS[native_chroot.arch][arch]}-gcc"])
res_crossdirect = results['crossdirect'] res_crossdirect = results['crossdirect']
assert isinstance(res_crossdirect, subprocess.CompletedProcess) assert isinstance(res_crossdirect, subprocess.CompletedProcess)
if res_crossdirect.returncode != 0: if res_crossdirect.returncode != 0:
@ -516,6 +517,7 @@ def build_package(
env['PATH'] = f"/usr/lib/ccache:{env['PATH']}" env['PATH'] = f"/usr/lib/ccache:{env['PATH']}"
deps += ['ccache'] deps += ['ccache']
logging.debug(('Building for native arch. ' if not foreign_arch else '') + 'Skipping crossdirect.') logging.debug(('Building for native arch. ' if not foreign_arch else '') + 'Skipping crossdirect.')
if not package.nodeps:
dep_install = target_chroot.try_install_packages(deps, allow_fail=False) dep_install = target_chroot.try_install_packages(deps, allow_fail=False)
failed_deps = [name for name, res in dep_install.items() if res.returncode != 0] # type: ignore[union-attr] failed_deps = [name for name, res in dep_install.items() if res.returncode != 0] # type: ignore[union-attr]
if failed_deps: if failed_deps: