commit:     c2e5a02f2ecd0af162b6598e718058a2420c9a05
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Tue Jan  4 21:07:49 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan  6 19:57:14 2022 +0000
URL:        https://gitweb.gentoo.org/proj/qt.git/commit/?id=c2e5a02f

dev-qt/qtwebengine: add check-reqs for disk space and memory usage

For now, assumes:
- RAM/memory: 2GB per job for GCC, 1.5GB per job for Clang
- Disk (build): 7GB
- Disk (installed): 150MB

(Also moves pkg_preinst to the end of the ebuild to reflect
phase execution order, as per devmanual.)

Closes: https://bugs.gentoo.org/570534
Thanks-to: Ionen Wolkens <ionen <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 dev-qt/qtwebengine/qtwebengine-5.15.2.9999.ebuild | 61 +++++++++++++++++------
 1 file changed, 45 insertions(+), 16 deletions(-)

diff --git a/dev-qt/qtwebengine/qtwebengine-5.15.2.9999.ebuild 
b/dev-qt/qtwebengine/qtwebengine-5.15.2.9999.ebuild
index 381ae491..2c200df5 100644
--- a/dev-qt/qtwebengine/qtwebengine-5.15.2.9999.ebuild
+++ b/dev-qt/qtwebengine/qtwebengine-5.15.2.9999.ebuild
@@ -5,7 +5,7 @@ EAPI=8
 
 PYTHON_COMPAT=( python2_7 )
 PYTHON_REQ_USE="xml(+)"
-inherit estack flag-o-matic multiprocessing python-any-r1 qt5-build
+inherit check-reqs estack flag-o-matic multiprocessing python-any-r1 qt5-build 
toolchain-funcs
 
 DESCRIPTION="Library for rendering dynamic web content in Qt5 C++ and QML 
applications"
 HOMEPAGE="https://www.qt.io/";
@@ -110,29 +110,47 @@ PATCHES=(
        "${WORKDIR}/${PN}-5.15.2_p20211019-jumbo-build.patch" # bug 813957
 )
 
-pkg_preinst() {
-       elog "This version of Qt WebEngine is based on Chromium version 
87.0.4280, with"
-       elog "additional security fixes from newer versions. Extensive as it 
is, the"
-       elog "list of backports is impossible to evaluate, but always bound to 
be behind"
-       elog "Chromium's release schedule."
-       elog "In addition, various online services may deny service based on an 
outdated"
-       elog "user agent version (and/or other checks). Google is already known 
to do so."
-       elog
-       elog "tldr: Your web browsing experience will be compromised."
-}
-
-src_unpack() {
-       # bug 307861
+qtwebengine_check-reqs() {
+       # bug #307861
        eshopts_push -s extglob
        if is-flagq '-g?(gdb)?([1-9])'; then
-               ewarn
                ewarn "You have enabled debug info (probably have -g or -ggdb 
in your CFLAGS/CXXFLAGS)."
                ewarn "You may experience really long compilation times and/or 
increased memory usage."
                ewarn "If compilation fails, please try removing -g/-ggdb 
before reporting a bug."
-               ewarn
        fi
        eshopts_pop
 
+       [[ ${MERGE_TYPE} == binary ]] && return
+
+       # (check-reqs added for bug #570534)
+       #
+       # Estimate the amount of RAM required
+       # Multiplier is *10 because Bash doesn't do floating point maths.
+       # Let's crudely assume ~2GB per compiler job for GCC.
+       local multiplier=20
+
+       # And call it ~1.5GB for Clang.
+       if tc-is-clang ; then
+               multiplier=15
+       fi
+
+       local CHECKREQS_DISK_BUILD="7G"
+       local CHECKREQS_DISK_USR="150M"
+       local CHECKREQS_MEMORY=$(($(makeopts_jobs)*multiplier/10))G
+
+       check-reqs_${EBUILD_PHASE_FUNC}
+}
+
+pkg_pretend() {
+       qtwebengine_check-reqs
+}
+
+pkg_setup() {
+       qtwebengine_check-reqs
+       python-any-r1_pkg_setup
+}
+
+src_unpack() {
        case ${QT5_BUILD_TYPE} in
                live)    git-r3_src_unpack ;&
                release) default ;;
@@ -231,3 +249,14 @@ src_install() {
                die "${CATEGORY}/${PF} failed to build anything. Please report 
to https://bugs.gentoo.org/";
        fi
 }
+
+pkg_preinst() {
+       elog "This version of Qt WebEngine is based on Chromium version 
87.0.4280, with"
+       elog "additional security fixes from newer versions. Extensive as it 
is, the"
+       elog "list of backports is impossible to evaluate, but always bound to 
be behind"
+       elog "Chromium's release schedule."
+       elog "In addition, various online services may deny service based on an 
outdated"
+       elog "user agent version (and/or other checks). Google is already known 
to do so."
+       elog
+       elog "tldr: Your web browsing experience will be compromised."
+}

Reply via email to