Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: lib/portage/package/ebuild/
Date: Wed, 06 May 2020 06:37:41
Message-Id: 1588747032.61f76236aa10c297f79c2fee123a79d26bfa9327.mgorny@gentoo
1 commit: 61f76236aa10c297f79c2fee123a79d26bfa9327
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed May 6 04:54:03 2020 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed May 6 06:37:12 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=61f76236
7
8 doebuild: Use ccache/distcc/icecream only in src_* phases
9
10 Enable ccache/distcc/icecream only when src_* phases are executed.
11 There is generally little value from them in pkg_*, as these phases
12 use CC only to do a few tests at most. These compilations generally
13 are not run in parallel and the programs are tiny, so usually
14 the overhead exceeds the gain.
15
16 On the other hand, running them in pkg_* phases results in files being
17 created with root ownership that breaks them afterwards when using
18 userpriv. As a result, user not only loses the benefit of, say, distcc
19 but also frequently hits error messages that confuse some configure
20 scripts and result in miscompiled packages.
21
22 Bug: https://bugs.gentoo.org/581880
23 Reviewed-by: Zac Medico <zmedico <AT> gentoo.org>
24 Closes: https://github.com/gentoo/portage/pull/547
25 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
26
27 lib/portage/package/ebuild/doebuild.py | 9 ++++++++-
28 1 file changed, 8 insertions(+), 1 deletion(-)
29
30 diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py
31 index 2bff94cb1..1343eca6d 100644
32 --- a/lib/portage/package/ebuild/doebuild.py
33 +++ b/lib/portage/package/ebuild/doebuild.py
34 @@ -486,7 +486,14 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
35 distcc = "distcc" in mysettings.features
36 icecream = "icecream" in mysettings.features
37
38 - if ccache or distcc or icecream:
39 + # run cc thingies only in src_* phases as otherwise they might
40 + # create files with incorrect ownership and trip over
41 + # (NB: install has a similar issue but 1) some badly written
42 + # packages rebuild stuff there, so ccache is very helpful
43 + # and 2) almost always some compilation will happen earlier,
44 + # so permissions will be already set correctly)
45 + if (ccache or distcc or icecream) and mydo in ('unpack',
46 + 'prepare', 'configure', 'test', 'install'):
47 libdir = None
48 default_abi = mysettings.get("DEFAULT_ABI")
49 if default_abi: