11
0

Never use more than the configured jobs #1

Open
Andreas_Schwab wants to merge 1 commits from Andreas_Schwab/memory-constraints:main into main
2 changed files with 11 additions and 4 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Nov 3 07:47:52 UTC 2025 - Andreas Schwab <schwab@suse.de>
- Never use more than the configured jobs
-------------------------------------------------------------------
Thu Jan 9 11:29:51 UTC 2025 - Guillaume GARDET <guillaume.gardet@opensuse.org>

View File

@@ -7,7 +7,9 @@
# m: memory limit in MBs per core; default is 1000
%limit_build(m:) \
_threads="`/usr/bin/getconf _NPROCESSORS_ONLN`" \
_threads="$(/usr/bin/getconf _NPROCESSORS_ONLN)" \
_jobs="%{?jobs}%{!?jobs:${RPM_BUILD_NCPUS:-$_threads}}" \
test "$_threads" -gt "$_jobs" && _threads=$_jobs \
_core_memory="%{-m:%{-m*}}%{!-m:1000}" \
echo "Available memory:" \
cat /proc/meminfo \
@@ -22,7 +24,7 @@
test "$_threads" -gt "$max_jobs" && _threads="$max_jobs" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits" \
test "$_threads" -le 0 && _threads=1 && echo "Warning: Do not use the parallel build at all because of memory limits" \
fi \
%global jobs $([[ -n $_threads ]] && echo $_threads || echo "`/usr/bin/getconf _NPROCESSORS_ONLN`") \
%global _smp_mflags $([[ -n $_threads ]] && echo "-j$_threads" || echo "-j`/usr/bin/getconf _NPROCESSORS_ONLN`") \
%global _smp_build_ncpus $([[ -n $_threads ]] && echo "$_threads" || echo "`/usr/bin/getconf _NPROCESSORS_ONLN`") \
%global jobs $([[ -n $_threads ]] && echo "$_threads" || echo "$_jobs") \
%global _smp_mflags $([[ -n $_threads ]] && echo "-j$_threads" || echo "-j$_jobs") \
%global _smp_build_ncpus $([[ -n $_threads ]] && echo "$_threads" || echo "$_jobs") \
%{nil}