diff --git a/config/multithread b/config/multithread index edea6f4888..18d40f98a8 100644 --- a/config/multithread +++ b/config/multithread @@ -3,46 +3,8 @@ THREADCOUNT=${THREADCOUNT:-$(nproc)} -# This function is passed a list of package.mk paths to be processed. -# Each package.mk is sourced with relevant variables output in JSON format. -json_worker() { - local packages="$@" - local pkgpath hierarchy exited - - exit() { exited=1; } - - . config/options "" - - for pkgpath in ${packages}; do - pkgpath="${pkgpath%%@*}" - - exited=0 - if ! source_package "${pkgpath}/package.mk" &>/dev/null; then - unset -f exit - die "$(print_color CLR_ERROR "FAILURE: sourcing package ${pkgpath}/package.mk")" - fi - - [ ${exited} -eq 1 ] && continue - - [[ ${pkgpath} =~ ^${ROOT}/${PACKAGES}/ ]] && hierarchy="global" || hierarchy="local" - - cat <&1 &>${bootstrap}; then - [ "${LOGCOMBINE}" = "always" -a -f "${bootstrap}" ] && cat "${bootstrap}" - else - [ "${LOGCOMBINE}" != "never" -a -f "${bootstrap}" ] && cat "${bootstrap}" - die "Unable to bootstrap parallel package" - fi - # pipefail: return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status set -o pipefail - cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} | \ - ${TOOLCHAIN}/bin/parallel --plain --no-notice --max-args 30 --halt now,fail=1 json_worker | \ - ${SCRIPTS}/genbuildplan.py --show-wants --with-json "${THREAD_CONTROL}"/plan.json \ + ${SCRIPTS}/pkgjson | ${SCRIPTS}/genbuildplan.py --show-wants --with-json "${THREAD_CONTROL}"/plan.json \ --build ${@} > "${THREAD_CONTROL}"/plan || result=1 if [ ${result} -eq 0 ]; then diff --git a/scripts/pkgjson b/scripts/pkgjson new file mode 100755 index 0000000000..789fd51715 --- /dev/null +++ b/scripts/pkgjson @@ -0,0 +1,55 @@ +#!/bin/bash + +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2019-present Team LibreELEC (https://libreelec.tv) + +. config/options "" + +# This function is passed a list of package.mk paths to be processed. +# Each package.mk is sourced with relevant variables output in JSON format. +json_worker() { + local packages="$@" + local pkgpath hierarchy exited + + exit() { exited=1; } + + for pkgpath in ${packages}; do + pkgpath="${pkgpath%%@*}" + + exited=0 + if ! source_package "${pkgpath}/package.mk" &>/dev/null; then + unset -f exit + die "$(print_color CLR_ERROR "FAILURE: sourcing package ${pkgpath}/package.mk")" + fi + + [ ${exited} -eq 1 ] && continue + + [[ ${pkgpath} =~ ^${ROOT}/${PACKAGES}/ ]] && hierarchy="global" || hierarchy="local" + + cat </dev/null || PARALLEL_BIN=fake_parallel - -# pipefail: return value of a pipeline is the value of the last (rightmost) command to exit with a non-zero status -set -o pipefail - -cat ${_CACHE_PACKAGE_GLOBAL} ${_CACHE_PACKAGE_LOCAL} | \ - ${PARALLEL_BIN} --plain --no-notice --max-args 30 --halt now,fail=1 json_worker | \ - ${SCRIPTS}/genbuildplan.py --show-wants --build ${@:-image} --warn-invalid ${GENFLAGS} || \ +${SCRIPTS}/pkgjson | ${SCRIPTS}/genbuildplan.py --show-wants --build ${@:-image} --warn-invalid ${GENFLAGS} || \ die "FAILURE: Unable to generate plan"