From 3be8fc4ae6ad2300d65a332d919c93bcfefd22cd Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Thu, 27 Jun 2013 10:08:01 +0300 Subject: [PATCH] - make cpu limit for building configurable through _smp_ncpus_max macro - forward "port" from rhel-6 (#669638) --- redhat-rpm-config-9.1.0-ncpus-max.patch | 19 +++++++++++++++++++ redhat-rpm-config.spec | 8 +++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 redhat-rpm-config-9.1.0-ncpus-max.patch diff --git a/redhat-rpm-config-9.1.0-ncpus-max.patch b/redhat-rpm-config-9.1.0-ncpus-max.patch new file mode 100644 index 0000000..b2d4f71 --- /dev/null +++ b/redhat-rpm-config-9.1.0-ncpus-max.patch @@ -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. diff --git a/redhat-rpm-config.spec b/redhat-rpm-config.spec index 3e8650c..2129b1b 100644 --- a/redhat-rpm-config.spec +++ b/redhat-rpm-config.spec @@ -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 - - 9.1.0-46 +- make cpu limit for building configurable through _smp_ncpus_max macro + * Tue May 21 2013 T.C. Hollingsworth - 9.1.0-45 - add nodejs_arches macro for ExclusiveArch for Node.js packages