- Also set _smp_build_ncpus to fix usage with meson macro and
maybe others OBS-URL: https://build.opensuse.org/package/show/network:chromium/memory-constraints?expand=0&rev=22
This commit is contained in:
commit
328dfa12d0
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
## Default LFS
|
||||||
|
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bsp filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gem filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.obscpio filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.oxt filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.rpm filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.zst filter=lfs diff=lfs merge=lfs -text
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
.osc
|
44
memory-constraints.changes
Normal file
44
memory-constraints.changes
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jan 9 11:29:51 UTC 2025 - Guillaume GARDET <guillaume.gardet@opensuse.org>
|
||||||
|
|
||||||
|
- Also set _smp_build_ncpus to fix usage with meson macro and
|
||||||
|
maybe others
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jun 29 14:50:50 UTC 2021 - Andreas Schneider <asn@cryptomilk.org>
|
||||||
|
|
||||||
|
- Fix Requires for awk to work also on Fedora
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon May 4 14:47:13 UTC 2020 - Dominique Leuenberger <dimstar@opensuse.org>
|
||||||
|
|
||||||
|
- Use the correct macro %_rpmmacrodir in the %files section.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jun 15 14:34:00 UTC 2019 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
|
||||||
|
|
||||||
|
- Take SwapTotal into account, MemTotal only reflects physical memory. Some
|
||||||
|
workers have a considerable amount of swap.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Apr 7 14:57:25 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Fix the macros to define default value if _threads are not defined
|
||||||
|
to fallback to amount of CPUs
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Apr 6 13:41:22 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Use install instead of mkdir and cp
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Apr 6 13:00:10 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Update description to contain less typos
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Apr 6 10:56:54 UTC 2018 - tchvatal@suse.com
|
||||||
|
|
||||||
|
- Initial package to ensure restrictions on jobs when building
|
||||||
|
huge packages
|
||||||
|
|
28
memory-constraints.macros
Normal file
28
memory-constraints.macros
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
#
|
||||||
|
# Macros for memory constraints on buildjobs.
|
||||||
|
# If you happen to have HUGE packages sometimes you need to do
|
||||||
|
# crazy magic in order to make sure it is most of the time building
|
||||||
|
# rather than just giving you OOM
|
||||||
|
#
|
||||||
|
|
||||||
|
# m: memory limit in MBs per core; default is 1000
|
||||||
|
%limit_build(m:) \
|
||||||
|
_threads="`/usr/bin/getconf _NPROCESSORS_ONLN`" \
|
||||||
|
_core_memory="%{-m:%{-m*}}%{!-m:1000}" \
|
||||||
|
echo "Available memory:" \
|
||||||
|
cat /proc/meminfo \
|
||||||
|
echo "System limits:" \
|
||||||
|
ulimit -a \
|
||||||
|
echo "System jobs: $_threads" \
|
||||||
|
if test "$_threads" -gt 1 ; then \
|
||||||
|
mem_per_process="$_core_memory" \
|
||||||
|
max_physmem=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) \
|
||||||
|
max_swapmem=$(awk '/SwapTotal/ { print $2 }' /proc/meminfo) \
|
||||||
|
max_jobs="$((($max_physmem + $max_swapmem) / ($mem_per_process * 1000)))" \
|
||||||
|
test "$_threads" -gt "$max_jobs" && _threads="$max_jobs" && echo "Warning: Reducing number of jobs to $max_jobs because of memory limits" \
|
||||||
|
test "$_threads" -le 0 && _threads=1 && echo "Warning: Do not use the parallel build at all because of memory limits" \
|
||||||
|
fi \
|
||||||
|
%global jobs $([[ -n $_threads ]] && echo $_threads || echo "`/usr/bin/getconf _NPROCESSORS_ONLN`") \
|
||||||
|
%global _smp_mflags $([[ -n $_threads ]] && echo "-j$_threads" || echo "-j`/usr/bin/getconf _NPROCESSORS_ONLN`") \
|
||||||
|
%global _smp_build_ncpus $([[ -n $_threads ]] && echo "$_threads" || echo "`/usr/bin/getconf _NPROCESSORS_ONLN`") \
|
||||||
|
%{nil}
|
49
memory-constraints.spec
Normal file
49
memory-constraints.spec
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#
|
||||||
|
# spec file for package memory-constraints
|
||||||
|
#
|
||||||
|
# Copyright (c) 2021 SUSE LLC
|
||||||
|
#
|
||||||
|
# All modifications and additions to the file contributed by third parties
|
||||||
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
|
# upon. The license for this file, and modifications and additions to the
|
||||||
|
# file, is the same license as for the pristine package itself (unless the
|
||||||
|
# license for the pristine package is not an Open Source License, in which
|
||||||
|
# case the license is the MIT License). An "Open Source License" is a
|
||||||
|
# license that conforms to the Open Source Definition (Version 1.9)
|
||||||
|
# published by the Open Source Initiative.
|
||||||
|
|
||||||
|
# Please submit bugfixes or comments via https://bugs.opensuse.org/
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
Name: memory-constraints
|
||||||
|
Version: 20180406
|
||||||
|
Release: 0
|
||||||
|
Summary: Macros to limit resources allocation when building
|
||||||
|
License: MIT
|
||||||
|
Group: Development/Tools/Building
|
||||||
|
URL: https://www.opensuse.org/
|
||||||
|
Source0: %{name}.macros
|
||||||
|
BuildRequires: coreutils
|
||||||
|
BuildRequires: rpm
|
||||||
|
Requires: /usr/bin/awk
|
||||||
|
Requires: coreutils
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
%description
|
||||||
|
Macros to limit various resources when building huge packages to
|
||||||
|
ensure we can produce results rather than OOM reports.
|
||||||
|
|
||||||
|
%prep
|
||||||
|
:
|
||||||
|
|
||||||
|
%build
|
||||||
|
:
|
||||||
|
|
||||||
|
%install
|
||||||
|
install -D -m 644 %{SOURCE0} %{buildroot}/%{_rpmmacrodir}/macros.%{name}
|
||||||
|
|
||||||
|
%files
|
||||||
|
%{_rpmmacrodir}/macros.%{name}
|
||||||
|
|
||||||
|
%changelog
|
Loading…
Reference in New Issue
Block a user