summaryrefslogtreecommitdiff
path: root/eclass/check-reqs.eclass
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2019-09-06 10:28:05 +0100
committerV3n3RiX <venerix@redcorelinux.org>2019-09-06 10:28:05 +0100
commitf1af93971b7490792d8541bc790e0d8c6d787059 (patch)
treea38046712bbc3a3844d77452d16c84e716caa3d4 /eclass/check-reqs.eclass
parentfc637fb28da700da71ec2064d65ca5a7a31b9c6c (diff)
gentoo resync : 06.08.2019
Diffstat (limited to 'eclass/check-reqs.eclass')
-rw-r--r--eclass/check-reqs.eclass44
1 files changed, 26 insertions, 18 deletions
diff --git a/eclass/check-reqs.eclass b/eclass/check-reqs.eclass
index 689944c87700..192d6fa740dc 100644
--- a/eclass/check-reqs.eclass
+++ b/eclass/check-reqs.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 2004-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: check-reqs.eclass
@@ -7,7 +7,7 @@
# @AUTHOR:
# Bo Ørsted Andresen <zlin@gentoo.org>
# Original Author: Ciaran McCreesh <ciaranm@gentoo.org>
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: Provides a uniform way of handling ebuild which have very high build requirements
# @DESCRIPTION:
# This eclass provides a uniform way of handling ebuilds which have very high
@@ -60,13 +60,13 @@ if [[ ! ${_CHECK_REQS_ECLASS_} ]]; then
# @DESCRIPTION:
# How much space is needed in /var? Eg.: CHECKREQS_DISK_VAR=3000M
-EXPORT_FUNCTIONS pkg_setup
-case "${EAPI:-0}" in
- 0|1|2|3) ;;
- 4|5|6|7) EXPORT_FUNCTIONS pkg_pretend ;;
- *) die "EAPI=${EAPI} is not supported" ;;
+case ${EAPI:-0} in
+ 4|5|6|7) ;;
+ *) die "${ECLASS}: EAPI=${EAPI:-0} is not supported" ;;
esac
+EXPORT_FUNCTIONS pkg_pretend pkg_setup
+
# Obsolete function executing all the checks and printing out results
check_reqs() {
eerror "Package calling old ${FUNCNAME} function."
@@ -123,9 +123,6 @@ check-reqs_run() {
# some people are *censored*
unset CHECKREQS_FAILED
- [[ ${EAPI:-0} == [0123] ]] && local MERGE_TYPE=""
-
- # use != in test, because MERGE_TYPE only exists in EAPI 4 and later
if [[ ${MERGE_TYPE} != binary ]]; then
[[ -n ${CHECKREQS_MEMORY} ]] && \
check-reqs_memory \
@@ -140,12 +137,12 @@ check-reqs_run() {
if [[ ${MERGE_TYPE} != buildonly ]]; then
[[ -n ${CHECKREQS_DISK_USR} ]] && \
check-reqs_disk \
- "${EROOT}/usr" \
+ "${EROOT%/}/usr" \
"${CHECKREQS_DISK_USR}"
[[ -n ${CHECKREQS_DISK_VAR} ]] && \
check-reqs_disk \
- "${EROOT}/var" \
+ "${EROOT%/}/var" \
"${CHECKREQS_DISK_VAR}"
fi
}
@@ -245,6 +242,7 @@ check-reqs_memory() {
local size=${1}
local actual_memory
+ local actual_swap
check-reqs_start_phase \
${size} \
@@ -252,19 +250,29 @@ check-reqs_memory() {
if [[ -r /proc/meminfo ]] ; then
actual_memory=$(awk '/MemTotal/ { print $2 }' /proc/meminfo)
+ actual_swap=$(awk '/SwapTotal/ { print $2 }' /proc/meminfo)
else
- actual_memory=$(sysctl hw.physmem 2>/dev/null )
- [[ "$?" == "0" ]] &&
- actual_memory=$(echo $actual_memory | sed -e 's/^[^:=]*[:=]//' )
+ actual_memory=$(sysctl hw.physmem 2>/dev/null)
+ [[ $? -eq 0 ]] && actual_memory=$(echo "${actual_memory}" \
+ | sed -e 's/^[^:=]*[:=][[:space:]]*//')
+ actual_swap=$(sysctl vm.swap_total 2>/dev/null)
+ [[ $? -eq 0 ]] && actual_swap=$(echo "${actual_swap}" \
+ | sed -e 's/^[^:=]*[:=][[:space:]]*//')
fi
if [[ -n ${actual_memory} ]] ; then
- if [[ ${actual_memory} -lt $(check-reqs_get_kibibytes ${size}) ]] ; then
+ if [[ ${actual_memory} -ge $(check-reqs_get_kibibytes ${size}) ]] ; then
+ eend 0
+ elif [[ -n ${actual_swap} && $((${actual_memory} + ${actual_swap})) \
+ -ge $(check-reqs_get_kibibytes ${size}) ]] ; then
+ ewarn "Amount of main memory is insufficient, but amount"
+ ewarn "of main memory combined with swap is sufficient."
+ ewarn "Build process may make computer very slow!"
+ eend 0
+ else
eend 1
check-reqs_unsatisfied \
${size} \
"RAM"
- else
- eend 0
fi
else
eend 1