Add macros.build-constraints

Keep the misc macros in alphabetical order

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
This commit is contained in:
Michel Alexandre Salim 2021-07-24 14:58:08 -07:00
parent e0cfcc0fc7
commit dbb1278523
2 changed files with 23 additions and 7 deletions

10
macros.build-constraints Normal file
View File

@ -0,0 +1,10 @@
# Macros to constrain resource use during the build process
# m: memory limit in MBs per core; default is 1024
%limit_build(m:) \
_mem_per_process="%{-m:%{-m*}}%{!-m:1024}" \
_max_mem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) \
_max_jobs="$(($_max_mem / ($_mem_per_process * 1024)))" \
_cur_max_jobs="%{_smp_build_ncpus}" \
test "${_cur_max_jobs}" -gt "${_max_jobs}" && _cur_max_jobs="${_max_jobs}" && echo "Warning: Reducing build parallelism to -j${_max_jobs} because of memory limits" \
%global _smp_build_ncpus "${_cur_max_jobs}"

View File

@ -6,7 +6,7 @@
Summary: Red Hat specific rpm configuration files
Name: redhat-rpm-config
Version: 192
Version: 193
Release: 1%{?dist}
# No version specified.
License: GPL+
@ -36,12 +36,13 @@ Source104: macros.ldc-srpm
Source105: macros.valgrind-srpm
# Other misc macros
Source150: macros.dwz
Source151: macros.kmp
Source152: macros.vpath
Source150: macros.build-constraints
Source151: macros.dwz
Source152: macros.fedora-misc
Source153: macros.forge
Source154: macros.ldconfig
Source155: macros.fedora-misc
Source154: macros.kmp
Source155: macros.ldconfig
Source156: macros.vpath
# Build policy scripts
# this comes from https://github.com/rpm-software-management/rpm/pull/344
@ -188,11 +189,12 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{rrcdir}/brp-ldconfig
%{_fileattrsdir}/*.attr
%{_rpmconfigdir}/macros.d/macros.*-srpm
%{_rpmconfigdir}/macros.d/macros.build-constraints
%{_rpmconfigdir}/macros.d/macros.dwz
%{_rpmconfigdir}/macros.d/macros.fedora-misc
%{_rpmconfigdir}/macros.d/macros.forge
%{_rpmconfigdir}/macros.d/macros.ldconfig
%{_rpmconfigdir}/macros.d/macros.vpath
%{_rpmconfigdir}/macros.d/macros.fedora-misc
%dir %{_rpmluadir}/fedora
%dir %{_rpmluadir}/fedora/srpm
%dir %{_rpmluadir}/fedora/rpm
@ -213,6 +215,10 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
%{_rpmconfigdir}/macros.d/macros.kmp
%changelog
* Sat Jul 24 2021 Michel Alexandre Salim <salimma@fedoraproject.org> - 193-1
- Add macros.build-constraints
- Keep the misc macros in alphabetical order
* Sat Jul 10 2021 Neal Gompa <ngompa13@gmail.com> - 192-1
- Make vpath builddir not include arch-specific info