public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/folly-rpm-macros] f45: Take the job count from %limit_build's output instead of running it
@ 2026-09-18 20:59 Michel Lind
  0 siblings, 0 replies; only message in thread
From: Michel Lind @ 2026-09-18 20:59 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : rpms/folly-rpm-macros
            Branch : f45
            Commit : 5e292e9c2dc1300c54757bc46b4ec64c6cacbbb2
            Author : Michel Lind <salimma@fedoraproject.org>
            Date   : 2026-09-18T21:58:14+01:00
            Stats  : +10/-2 in 1 file(s)
            URL    : https://src.fedoraproject.org/rpms/folly-rpm-macros/c/5e292e9c2dc1300c54757bc46b4ec64c6cacbbb2?branch=f45

            Log:
            Take the job count from %limit_build's output instead of running it

%limit_build prints "-jN" when memory allows fewer jobs than
%_smp_build_ncpus and nothing otherwise; it is meant to follow a make
command and never changes %_smp_build_ncpus. %getdeps_build used it as
a statement, so wherever memory was the tighter limit the -jN landed in
%build as a command:

  + -j20
  /var/tmp/rpm-tmp.lwmmwp: line 32: -j20: command not found

cachelib failed this way on F45 (task 150375236: 48-CPU builder, memory
for 20 jobs of 3072 MiB) and F44 (task 150374560). It passed on Rawhide
and in local mock only because those machines had fewer CPUs than
memory-limited jobs, so the macro printed nothing.

%__getdeps_num_jobs evaluates %limit_build and takes N from its output,
falling back to %_smp_build_ncpus, and %__getdeps_common_opts passes it
to --num-jobs. Checked with rpm --load: 4 CPUs and 23 GiB give 4, 2 and
1 jobs for weights of 3072, 8192 and 20000 MiB; 48 CPUs on the same
memory give 7; without %limit_build defined, %_smp_build_ncpus.

Assisted-by: Claude Code:claude-fable-5-1
Signed-off-by: Michel Lind <salimma@fedoraproject.org>

---
diff --git a/macros.folly-rpm b/macros.folly-rpm
index cf8e231..00c3510 100644
--- a/macros.folly-rpm
+++ b/macros.folly-rpm
@@ -48,6 +48,15 @@
 # fbthrift manifests (measured p99 2.6 GiB, max 4 GiB).
 %getdeps_job_weight_mib 3072
 
+# Number of getdeps jobs: %%limit_build prints "-jN" when memory allows fewer
+# jobs than %%_smp_build_ncpus and nothing otherwise (it is meant to follow a
+# make command), so take N from it when present.
+%__getdeps_num_jobs %{lua:
+  local j = rpm.expand("%{?limit_build:%{limit_build -m %{getdeps_job_weight_mib}}}")
+  j = (j:gsub("^%s*%-j", "")):gsub("%s+$", "")
+  if j == "" then j = rpm.expand("%{_smp_build_ncpus}") end
+  print(j)}
+
 # A getdeps package ships executables. The vendored stack is linked
 # statically into them, and %%getdeps_install removes the libraries, headers
 # and CMake/pkg-config files the project installs. There is no shared-library
@@ -67,7 +76,7 @@
   --allow-system-packages
   --vendor-dir %{getdeps_vendor_dir}
   --scratch-path %{getdeps_scratch_dir}
-  --num-jobs %{_smp_build_ncpus}
+  --num-jobs %{__getdeps_num_jobs}
   %{?getdeps_extra_cmake_defines:--extra-cmake-defines '{%{getdeps_extra_cmake_defines}}'}
 }
 
@@ -83,7 +92,6 @@
 #   -t : also build the project's tests (for %%getdeps_test in %%check)
 %getdeps_build(t) \
 %set_build_flags \
-%{limit_build -m %{getdeps_job_weight_mib}} \
 %{__getdeps} %{__getdeps_common_opts} build --free-up-disk %{!-t:--no-tests} --src-dir=. --project-install-prefix %{getdeps_project}:%{_prefix} %{getdeps_project}
 
 # getdeps_install: install the project into %%{buildroot}. getdeps configured

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-18 20:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-18 20:59 [rpms/folly-rpm-macros] f45: Take the job count from %limit_build's output instead of running it Michel Lind

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox