commit: 8eb2502bf264d54dfbf180222f162f7a593b947d Author: Florian Schmaus <flow <AT> gentoo <DOT> org> AuthorDate: Wed Mar 6 20:52:08 2024 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Sat Mar 9 18:46:00 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8eb2502b
phase-functions: prematurely delete WORKDIR if FEATURES=merge-wait Using the merge-wait feature together with many parallel emerge jobs potentially leads to a high disk space usage due to the created portage build directories waiting for their packages to be merged into the live filesystem prior portage will clean them. This can easily lead to out-of-space errors. Prematurely deleting WORKDIR at the end of src_install() helps reducing the temporarily used disk space. All that portage need to merge a package into the live filesystem are the files in the image/ directory (D). (At least in theory) Signed-off-by: Florian Schmaus <flow <AT> gentoo.org> Closes: https://github.com/gentoo/portage/pull/1302 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/phase-functions.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/phase-functions.sh b/bin/phase-functions.sh index ebcf5f242a..ab130a3be5 100644 --- a/bin/phase-functions.sh +++ b/bin/phase-functions.sh @@ -723,6 +723,13 @@ __dyn_install() { >> DEBUGBUILD fi trap - SIGINT SIGQUIT + + # Prematurely delete WORKDIR in case merge-wait is enabled to + # decrease the space used by portage build directories until the + # packages are merged and cleaned. + if has merge-wait ${FEATURES} && ! has keepwork ${FEATURES}; then + rm -rf "${WORKDIR}" + fi } __dyn_help() {
