Summary: | /etc/portage/bashrc is sourced multiple times | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Lars Strojny <lars> |
Component: | Current packages | Assignee: | Portage team <dev-portage> |
Status: | RESOLVED WORKSFORME | ||
Severity: | enhancement | CC: | gengor, ormaaj, zmedico |
Priority: | High | ||
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | |||
Package list: | Runtime testing required: | --- |
Description
Lars Strojny
2008-12-08 01:05:16 UTC
I believe this multiple sourcing is a side-effect of the current implementation of pre- and post-hooks for each ebuild phase. Assigning to portage devs in case someone wants to consider this feature request, or wants to explain why it is the way it is. It's pretty common for bashrc users to rely on it being sources for every ebuild phase. Rather than put code directly in global scope, you should put it inside a pre_ or post_ phase hook function, or else make it conditional on the $EBUILD_PHASE variable. For example: pre_pkg_setup() { # your code here } or if [ "$EBUILD_PHASE" = setup ] ; then # your code here fi (In reply to Zac Medico from comment #2) > It's pretty common for bashrc users to rely on it being sources for every > ebuild phase. Rather than put code directly in global scope, you should put > it inside a pre_ or post_ phase hook function, or else make it conditional > on the $EBUILD_PHASE variable. > > For example: > > pre_pkg_setup() { > # your code here > } > > or > > if [ "$EBUILD_PHASE" = setup ] ; then > # your code here > fi Out of curiosity, shouldn't this be like this? : if [[ "${EBUILD_PHASE}" == "setup" ]] ; then # your code here fi I am not trying to outsmart anyone here, it's an honest question. I think [[ should be preferred? (In reply to Petross404(Petros S) from comment #3) Either syntax should work. [[ ]] is generally preferred in ebuilds. |