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