Lines 1-4
Link Here
|
1 |
# Copyright 1999-2018 Gentoo Foundation |
1 |
# Copyright 2004-2019 Gentoo Authors |
2 |
# Distributed under the terms of the GNU General Public License v2 |
2 |
# Distributed under the terms of the GNU General Public License v2 |
3 |
|
3 |
|
4 |
# @ECLASS: check-reqs.eclass |
4 |
# @ECLASS: check-reqs.eclass |
Lines 245-250
check-reqs_memory() {
Link Here
|
245 |
|
245 |
|
246 |
local size=${1} |
246 |
local size=${1} |
247 |
local actual_memory |
247 |
local actual_memory |
|
|
248 |
local actual_swap |
248 |
|
249 |
|
249 |
check-reqs_start_phase \ |
250 |
check-reqs_start_phase \ |
250 |
${size} \ |
251 |
${size} \ |
Lines 252-270
check-reqs_memory() {
Link Here
|
252 |
|
253 |
|
253 |
if [[ -r /proc/meminfo ]] ; then |
254 |
if [[ -r /proc/meminfo ]] ; then |
254 |
actual_memory=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) |
255 |
actual_memory=$(awk '/MemTotal/ { print $2 }' /proc/meminfo) |
|
|
256 |
actual_swap=$(awk '/SwapTotal/ { print $2 }' /proc/meminfo) |
255 |
else |
257 |
else |
256 |
actual_memory=$(sysctl hw.physmem 2>/dev/null ) |
258 |
actual_memory=$(sysctl hw.physmem 2>/dev/null) |
257 |
[[ "$?" == "0" ]] && |
259 |
[[ "$?" == "0" ]] && |
258 |
actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' ) |
260 |
actual_memory=$(echo "${actual_memory}" | sed -e 's/^[^:=]*[:=][[:space:]]*//') |
|
|
261 |
actual_swap=$(sysctl vm.swap_total 2>/dev/null) |
262 |
[[ "$?" == "0" ]] && |
263 |
actual_swap=$(echo "${actual_swap}" | sed -e 's/^[^:=]*[:=][[:space:]]*//') |
259 |
fi |
264 |
fi |
260 |
if [[ -n ${actual_memory} ]] ; then |
265 |
if [[ -n ${actual_memory} ]] ; then |
261 |
if [[ ${actual_memory} -lt $(check-reqs_get_kibibytes ${size}) ]] ; then |
266 |
if [[ ${actual_memory} -ge $(check-reqs_get_kibibytes ${size}) ]] ; then |
|
|
267 |
eend 0 |
268 |
elif [[ -n ${actual_swap} && $((${actual_memory} + ${actual_swap})) -ge $(check-reqs_get_kibibytes ${size}) ]] ; then |
269 |
ewarn "Amount of actual memory is insufficient, but amount of actual memory combined with swap is sufficient." |
270 |
ewarn "Build process may make computer very slow!" |
271 |
eend 0 |
272 |
else |
262 |
eend 1 |
273 |
eend 1 |
263 |
check-reqs_unsatisfied \ |
274 |
check-reqs_unsatisfied \ |
264 |
${size} \ |
275 |
${size} \ |
265 |
"RAM" |
276 |
"RAM" |
266 |
else |
|
|
267 |
eend 0 |
268 |
fi |
277 |
fi |
269 |
else |
278 |
else |
270 |
eend 1 |
279 |
eend 1 |
271 |
- |
|
|