On Fri, Jan 25, 2008, Jeff Johnson wrote:
> Nothing wrong with the patch at all, but ...
>
> It does impose certain difficult (for packagers) issues
> wrto when the macro probe is expanded. This is
> the obvious failure case
> %build
> export CC=someothercc
> CC="%{getenv:CC}"
> which will probe rpmbuild's, not the %build, environment surprisingly.
>
> *shrug*
Hmmm... well, yes, but for getting the $CC from %build I still would
just write $CC in the script, of course.
The %{getenv:CC} is not intended (at least not from my perspective) for
use in .spec's sections. I intend it to use in "rpmmacros" files to
really fetch information from the outer environment. To illustrate it:
In OpenPKG since many years I used...
%_buildshell env -i [...]
%___build_pre [...] \
TERM="%(echo $TERM)"\
USER="%(echo $USER)"\
LOGNAME="%(echo $LOGNAME)"\
[...]
...to provide a "sane build environment". This now can become...
%_buildshell env -i [...]
%___build_pre [...] \
TERM="%{getenv:$TERM}"\
USER="%{getenv:$USER}"\
LOGNAME="%{getenv:$LOGNAME}"\
[...]
...which now completely avoids spawning the shell just to expand the
environment variables.
Ralf S. Engelschall
rse@engelschall.com
www.engelschall.com
Received on Mon Jan 28 21:37:32 2008