[redhat-rpm-config: 202/215] - make cpu limit for building configurable through _smp_ncpus_max macro - forward "port" from rhel-6

Panu Matilainen pmatilai at fedoraproject.org
Wed Apr 2 10:35:25 UTC 2014


commit 5f7da218734b7bc522c24fbdb3929db2eb16da02
Author: Panu Matilainen <pmatilai at redhat.com>
Date:   Thu Jun 27 10:08:01 2013 +0300

    - make cpu limit for building configurable through _smp_ncpus_max macro - forward "port" from rhel-6 (#669638)

 macros |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/macros b/macros
index a9700cc..8b51e49 100644
--- a/macros
+++ b/macros
@@ -71,10 +71,13 @@
 	infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
   install
 
+# Maximum number of CPU's to use when building, 0 for unlimited.
+%_smp_ncpus_max 16
 %_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
 	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
-        if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then echo "-j16"; \\\
-        elif [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
+        ncpus_max=%{?_smp_ncpus_max}; \\\
+        if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
+        if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
 
 #==============================================================================
 # ---- Build policy macros.


More information about the scm-commits mailing list