Created attachment 407054 [details] emerge --info Hi, The following snippet in the EAPI=5 ebuild: myconf+=$(usex postgres "--with-pgsql-incdir=$(pg_config --includedir)" "") causes pg_config to be always executed, even with USE="-postgres", this leads to the following emerge warning: * QA Notice: command not found: * * /var/tmp/portage/sci-physics/root-5.34.32/temp/environment: line 4007: pg_config: command not found if dev-db/postgresql is not installed (quite normal for USE="-postgres"). To workaround this issue I use the following solution: use postgres && myconf+=( --with-pgsql-incdir=$(pg_config --includedir) ) But a proper way will be to fix usex.
This bug makes no sense: It is the shell which evaluates the arguments even before calling usex. The snippet of code you posted is simply broken.
(In reply to Andrew Savchenko from comment #0) > To workaround this issue I use the following solution: > use postgres && myconf+=( --with-pgsql-incdir=$(pg_config --includedir) ) That's a reasonable approach. > But a proper way will be to fix usex. As noted in comment #1, it's the shell that evaluates $(pg_config --includedir) before usex is called.
Ok, thanks for clarification. Maybe this should be noted in the ebuild 5 manual in order to avoid further confusion?
(In reply to Andrew Savchenko from comment #3) > Maybe this should be noted in the ebuild 5 manual in order to avoid further > confusion? Well, there's an unlimited number of ways to use shell language incorrectly, and it's beyond the scope of the ebuild 5 manual to document all such possible mistakes. This kind of thing is more relevant in a bash scripting manual/guide/howto.