]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rpm: limit build jobs by system memory on SUSE
authorNathan Cutler <ncutler@suse.com>
Tue, 2 Mar 2021 16:00:53 +0000 (17:00 +0100)
committerNathan Cutler <ncutler@suse.com>
Wed, 3 Mar 2021 14:52:04 +0000 (15:52 +0100)
43b441f9a3bc907c17d52385251001ffcd5d3ff9 removed a bunch of code which the SUSE
builds were relying on to avoid OOM. This commit brings back that code in
a much-streamlined form: the SUSE-specific %limit_build macro.

This also has the advantage of not breaking the build on older RPMs which only
know about %_smp_mflags, and not the newer %_smp_build_ncpus etc. macros.

Fixes: 43b441f9a3bc907c17d52385251001ffcd5d3ff9
Fixes: https://tracker.ceph.com/issues/49556
Signed-off-by: Nathan Cutler <ncutler@suse.com>
ceph.spec.in

index c12975f45492fe93668b1ce048cc4747a2c73278..e72fbe654a920484e8282761b71cb87a3f8876ef 100644 (file)
@@ -293,6 +293,7 @@ BuildRequires:      systemd-rpm-macros
 %{?systemd_requires}
 PreReq:                %fillup_prereq
 BuildRequires: fdupes
+BuildRequires:  memory-constraints
 BuildRequires: net-tools
 BuildRequires: libbz2-devel
 BuildRequires: mozilla-nss-devel
@@ -1202,6 +1203,7 @@ done
 %if 0%{?suse_version}
 # the following setting fixed an OOM condition we once encountered in the OBS
 RPM_OPT_FLAGS="$RPM_OPT_FLAGS --param ggc-min-expand=20 --param ggc-min-heapsize=32768"
+%limit_build -m 2600
 %endif
 
 export CPPFLAGS="$java_inc"
@@ -1284,7 +1286,11 @@ cmake .. \
 %if 0%{with rbd_ssd_cache}
     -DWITH_RBD_SSD_CACHE:BOOL=ON \
 %endif
+%if 0%{?suse_version}
+    -DBOOST_J:STRING=%{jobs} \
+%else
     -DBOOST_J:STRING=%{_smp_build_ncpus} \
+%endif
     -DWITH_GRAFANA:BOOL=ON
 
 %if %{with cmake_verbose_logging}