/etc/portage/bashrc

The  file is Article description::a global file. It is similar to the  files under, except always sourced for every package. It can either be used to setup a global environment common to all ebuilds, or as an alternative to the files allowing Portage administrators to handle all the necessary conditional code manually.

Gotchas

 * It is important to note that this file will be sourced multiple times during the build, at least once per phase plus several other times. You must therefore control when your code is executed using e.g. EBUILD_PHASE, EBUILD_PHASE_FUNC (EAPI 5), or otherwise avoid using the global scope by only putting code into hook functions (e.g. ). See bug 250240. It is especially important to restrict this in order to avoid unintentionally clobbering changes made throughout the ebuild. For example, if flag-o-matic code for a specific ebuild would normally overwrite default CFLAGS you've set, you wouldn't want to blindly squash those by repeatedly resetting them with each phase function (except on a per-package basis, when you know what you're doing).


 * The global isn't sourced for the first time until after dependency resolution. If run with ,  is sourced for the first time shortly after interactive confirmation. Therefore, it isn't a complete replacement for the global . Anything that must be in the environment immediately can't be set by  such as USE flags, FEATURES , etc. The portage documentation doesn't provide a complete list of contradictions, so be careful.


 * Portage doesn't save the initial environment prior to being mangled by Portage's global and . You therefore have no direct way of determining whether an environment variable was supplied by the user (e.g. CFLAGS), or set by portage, so you can't guarantee using the environment by your  to control behavior.