From 78254a18ebde088f5d14898b84cdd55088a7dd94 Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 14 Jan 2022 15:34:52 +0000 Subject: [PATCH] build_torcx_store: build torcx components in parallel Instead of looping over the package list, pass all the packages to a single emerge call and specify num jobs. This lets emerge build/install all of them in parallel, shaving some time off the torcx build. Signed-off-by: Jeremi Piotrowski --- build_torcx_store | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/build_torcx_store b/build_torcx_store index 61f59eabbc..f29cbe7969 100755 --- a/build_torcx_store +++ b/build_torcx_store @@ -69,8 +69,9 @@ function torcx_dependencies() ( # Build and install a package configured as part of a torcx image. function torcx_build() ( - pkg=${2:?} tmproot=${1:?} + shift + pkgs=( "${@}" ) export LDFLAGS=-Wl,-rpath,/ORIGIN/../lib export PKGDIR="${tmproot}/var/lib/portage/pkgs" @@ -81,16 +82,18 @@ function torcx_build() ( # Build binary packages using dev files in the board root. emerge-${BOARD} \ + --jobs="${NUM_JOBS}" \ --buildpkg \ --buildpkgonly \ --nodeps \ --oneshot \ --quiet \ --root-deps=rdeps \ - "${pkg}" + "${pkgs[@]}" # Install the binary packages in the temporary torcx image root. emerge-${BOARD} \ + --jobs="${NUM_JOBS}" \ --nodeps \ --oneshot \ --quiet \ @@ -98,7 +101,7 @@ function torcx_build() ( --root-deps=rdeps \ --sysroot="${tmproot}" \ --usepkgonly \ - "${pkg}" + "${pkgs[@]}" ) # Create a torcx image from the given meta-package. @@ -134,10 +137,7 @@ function torcx_package() { sudo ln -fns bin "${tmproot}/sbin" # Install the meta-package and its direct dependencies. - for deppkg in "=${pkg}" $(torcx_dependencies "${pkg}") - do - torcx_build "${tmproot}" "${deppkg}" - done + torcx_build "${tmproot}" "=${pkg}" $(torcx_dependencies "${pkg}") # by convention, the first dependency in a torcx package is the primary # source package