mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-24 11:16:51 +00:00
buildsystem: parallel pid cleanup
This commit is contained in:
parent
64bc8c2ab5
commit
ad938672b2
@ -61,7 +61,7 @@ package_worker() {
|
||||
|
||||
. config/options "${pkgname}"
|
||||
|
||||
[ ! -f "${THREAD_CONTROL}/pid" ] && echo "${PARALLEL_PID}" >"${THREAD_CONTROL}/pid"
|
||||
[ ! -f "${THREAD_CONTROL}/parallel.pid" ] && echo "${PARALLEL_PID}" >"${THREAD_CONTROL}/parallel.pid"
|
||||
|
||||
${SCRIPTS}/${task} ${pkgname} 2>&1 && result=0 || result=1
|
||||
|
||||
@ -141,7 +141,7 @@ EOF
|
||||
export -f package_worker
|
||||
|
||||
start_multithread_build() {
|
||||
local singlethread buildopts
|
||||
local singlethread buildopts result=0
|
||||
|
||||
# init thread control folder
|
||||
rm -rf "${THREAD_CONTROL}"
|
||||
@ -174,12 +174,18 @@ start_multithread_build() {
|
||||
|
||||
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 --no-reorder --show-wants --build ${@} > "${THREAD_CONTROL}"/plan || return
|
||||
${SCRIPTS}/genbuildplan.py --no-reorder --show-wants --build ${@} > "${THREAD_CONTROL}"/plan || result=1
|
||||
|
||||
cat "${THREAD_CONTROL}"/plan | awk '{print $1 " " $2}' | \
|
||||
MTBUILDSTART=$(date +%s) MTWITHLOCKS=yes ${TOOLCHAIN}/bin/parallel \
|
||||
--plain --no-notice --max-procs ${THREADCOUNT} --joblog="${THREAD_CONTROL}/joblog" --plus ${buildopts} \
|
||||
package_worker {%} {#} {##} {} || return
|
||||
if [ ${result} -eq 0 ]; then
|
||||
cat "${THREAD_CONTROL}"/plan | awk '{print $1 " " $2}' | \
|
||||
MTBUILDSTART=$(date +%s) MTWITHLOCKS=yes ${TOOLCHAIN}/bin/parallel \
|
||||
--plain --no-notice --max-procs ${THREADCOUNT} --joblog="${THREAD_CONTROL}/joblog" --plus ${buildopts} \
|
||||
package_worker {%} {#} {##} {} || result=1
|
||||
|
||||
rm -f "${THREAD_CONTROL}/parallel.pid"
|
||||
fi
|
||||
|
||||
set +o pipefail
|
||||
|
||||
return ${result}
|
||||
}
|
||||
|
@ -10,11 +10,16 @@ if [ -n "${PROJECT}" -a "$1" != "auto" ]; then
|
||||
fi
|
||||
|
||||
_find_latest_tcdir() {
|
||||
local IFS=$'\n'
|
||||
|
||||
if [ -n "${THREAD_CONTROL}" ]; then
|
||||
echo "${THREAD_CONTROL}"
|
||||
else
|
||||
ls -1tdr "${PWD}"/build.*/.threads 2>/dev/null | tail -1
|
||||
for dir in $(ls -1td "${PWD}"/build.*/.threads 2>/dev/null); do
|
||||
[ -f "${dir}/parallel.pid" ] && echo "${dir}" && break
|
||||
done
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
while [ : ]; do
|
||||
@ -24,7 +29,7 @@ while [ : ]; do
|
||||
tcdir="$(_find_latest_tcdir)"
|
||||
|
||||
if [ -n "${tcdir}" ]; then
|
||||
pid="$(cat "${tcdir}/pid" 2>/dev/null || true)"
|
||||
pid="$(cat "${tcdir}/parallel.pid" 2>/dev/null || true)"
|
||||
[ -n "${pid}" ] && ps -p ${pid} &>/dev/null && break
|
||||
fi
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user