- make cpu limit for building configurable through _smp_ncpus_max macro

- forward "port" from rhel-6 (#669638)
This commit is contained in:
Panu Matilainen 2013-06-27 10:08:01 +03:00
parent 9781bbafca
commit 3be8fc4ae6
2 changed files with 26 additions and 1 deletions

View File

@ -0,0 +1,19 @@
diff -up redhat-rpm-config-9.1.0/macros.ncpus redhat-rpm-config-9.1.0/macros
--- redhat-rpm-config-9.1.0/macros.ncpus 2013-06-27 09:54:38.663039820 +0300
+++ redhat-rpm-config-9.1.0/macros 2013-06-27 09:54:50.746135882 +0300
@@ -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.

View File

@ -1,7 +1,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 9.1.0
Release: 45%{?dist}
Release: 46%{?dist}
# No version specified.
License: GPL+
Group: Development/System
@ -54,6 +54,8 @@ Patch19: redhat-rpm-config-9.1.0-configfoo.patch
Patch20: redhat-rpm-config-9.1.0-aarch64.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=914831
Patch21: redhat-rpm-config-9.1.0-fcflags.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=669638
Patch22: redhat-rpm-config-9.1.0-ncpus-max.patch
BuildArch: noarch
Requires: coreutils
Requires: perl-srpm-macros
@ -89,6 +91,7 @@ Red Hat specific rpm configuration files.
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%build
@ -110,6 +113,9 @@ rm -rf ${RPM_BUILD_ROOT}
%{_sysconfdir}/rpm/*
%changelog
* Thu Jun 27 2013 Panu Matilainen <pmatilai@redhat.com> - - 9.1.0-46
- make cpu limit for building configurable through _smp_ncpus_max macro
* Tue May 21 2013 T.C. Hollingsworth <tchollingsworth@gmail.com> - 9.1.0-45
- add nodejs_arches macro for ExclusiveArch for Node.js packages