Files
Arch-R/scripts/pkgbuild
T
Douglas Teles 2d0a76b94a ArchR v2.0-rc3 — first official release-candidate
Kernel 6.12 LTS · Mesa 26.0.5 Panfrost · CMA 96 MB · zlib-ng 2.2.4
CPU turbo 1.5 GHz (vdd_arm 1.45 V) · GPU 650 MHz @ 1.150 V · mali_kbase PM patch
43 motherboard revisions covered · two image variants with hardware auto-detect
PortMaster pre-installed · MESA_GLTHREAD whitelist · RetroAchievements
Tailscale / WireGuard / ZeroTier · Syncthing + rclone · Samba

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 14:36:32 -03:00

80 lines
2.5 KiB
Bash
Executable File

#!/bin/bash
# This function is passed the build instruction for a single job.
# The function will run either "build <package>" or "install <package>".
# ${slot} is the job slot number, ie. 1-8 when THREADCOUNT=8.
# ${job} is the sequence within the total number of ${jobs}.
package_worker() {
local slot=$1 job=$2 jobs=$3 maxslot=$4 task="$5" pkgname="$6" oseqinfo="$7"
local result status
local addon istarget isaddon
export MTJOBID=${slot} PARALLEL_SEQ=${job} MTMAXJOBS=${jobs} MTMAXSLOT=${maxslot}
. config/options "${pkgname}"
if [ -z "${oseqinfo}" ]; then
${SCRIPTS}/${task} ${pkgname} 2>&1 && result=0 || result=1
else
print_color CLR_ERROR "FAILURE [${task} ${pkgname}]: a previous dependency process has already failed!"
echo
echo
num=0
for failed_items in ${oseqinfo//;/ }; do
num=$((num + 1))
read -r ftask fpkgname fseq <<<"${failed_items//,/ }"
if [ -n "${fseq}" ]; then
[ ${num} -eq 1 ] && echo "The following log(s) for already failed dependencies are available:"
printf " %-7s %s => %s\n" "${ftask}" "${fpkgname}" "${THREAD_CONTROL}/logs/${fseq}.log"
else
print_color CLR_ERROR "ALREADY FAILED [${ftask} ${fpkg}]"
echo
fi
done
echo
result=1
fi
[[ ${pkgname} =~ :target$ || "${pkgname//:/}" = "${pkgname}" ]] && istarget="yes" || istarget="no"
[[ "${MTADDONBUILD}" = "yes" && ("${PKG_IS_ADDON}" = "yes" || "${PKG_IS_ADDON}" = "embedded") ]] && isaddon="yes" || isaddon="no"
if [ "${isaddon}" = "yes" -a "${istarget}" = "yes" ]; then
if [ ${result} -eq 0 ]; then
${SCRIPTS}/install_addon ${pkgname} 2>&1 && result=0 || result=1
fi
if [ ${result} -ne 0 ]; then
if [ -d "${THREAD_CONTROL}/logs" ]; then
echo "${PKG_NAME} ${THREAD_CONTROL}/logs/${job}.log" >>"${THREAD_CONTROL}/addons.failed"
else
echo "${PKG_NAME}" >>"${THREAD_CONTROL}/addons.failed"
fi
fi
fi
(
flock --exclusive 95
[ ${result} -eq 0 ] && status="DONE" || status="FAIL"
num=$(<"${THREAD_CONTROL}/progress")
mv "${THREAD_CONTROL}/progress" "${THREAD_CONTROL}/progress.prev"
num=$((num + 1))
echo ${num} >"${THREAD_CONTROL}/progress"
) 95>"${THREAD_CONTROL}/locks/.progress"
if [ ${result} -eq 0 ]; then
pkg_lock_status "IDLE"
else
pkg_lock_status "FAILED" "${pkgname}" "${task}"
print_color CLR_ERROR "FAILURE: $SCRIPTS/${task} ${pkgname} has failed!"
echo
fi
return ${result}
}
package_worker "$1" "$2" "$3" "$4" "$5" "$6" "$7"