On 1/7/20 2:51 AM, Matti Niemenmaa wrote: > From: Matti Niemenmaa <[email protected]> > > buildenv is set once for build() and a second time for package(). When > using both distcc and ccache, this lead to CCACHE_PREFIX="distcc distcc" > in package(), which breaks PKGBUILDs that execute the compiler in > package() because distcc complains: > > distcc[383041] (main) CRITICAL! distcc seems to have invoked itself > recursively! > > Avoid causing this error by only adding "distcc" to CCACHE_PREFIX if > it's not yet there. > > Signed-off-by: Matti Niemenmaa <[email protected]> > --- > scripts/libmakepkg/buildenv/compiler.sh.in | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > > ncurses is an example of a package that runs into this problem. > > Setting buildenv twice was done on purpose in commit > 02a0bf550a22e199f48537b7eee87361b112e8a0, but at a glance I'm not sure > whether it provides any benefit. All the meaningful changes are to > environment variables that are exported from the parent process anyway, > so all the changes are either repeated or even duplicated (like in PATH, > or this CCACHE_PREFIX issue). Maybe it would be better to simply remove > the prepare_buildenv call from the INFAKEROOT case in makepkg.sh.in?
Apparently there was some confusion if this patch has a problem. To
clarify, my previous comment was rejecting this possible alternative,
which the patch does not in fact implement.
> diff --git a/scripts/libmakepkg/buildenv/compiler.sh.in
> b/scripts/libmakepkg/buildenv/compiler.sh.in
> index 69f58a29..c93c77b4 100644
> --- a/scripts/libmakepkg/buildenv/compiler.sh.in
> +++ b/scripts/libmakepkg/buildenv/compiler.sh.in
> @@ -44,7 +44,9 @@ buildenv_ccache() {
> buildenv_distcc() {
> if check_buildoption "distcc" "y"; then
> if (( using_ccache )); then
> - export CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX
> }distcc"
> + if ! [[ "$CCACHE_PREFIX" =~ (^| )distcc($| ) ]]; then
Regex here feels a bit overkill, I'm wondering if maybe it would be a
better idea to do:
[[ " $CCACHE_PREFIX " = *' distcc '* ]]
(Spaces assume that we think there is a valid use case for idk,
CCACHE_PREFIX=/usr/bin/notdistcc-foo and therefore want to match a word,
specifically.)
> + export
> CCACHE_PREFIX="${CCACHE_PREFIX:+$CCACHE_PREFIX }distcc"
> + fi
> export CCACHE_BASEDIR="$srcdir"
> elif [[ -d /usr/lib/distcc/bin ]]; then
> export PATH="/usr/lib/distcc/bin:$PATH"
>
--
Eli Schwartz
Bug Wrangler and Trusted User
OpenPGP_signature
Description: OpenPGP digital signature
