aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/ebuild/source_functions.bash
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2010-03-14 14:10:37 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2010-03-14 14:17:53 +0000
commita3f240c8b166805023d3b1fef383697a081baa04 (patch)
tree21d7d04bffbf49782f143fc37b30496ce5f400f5 /paludis/repositories/e/ebuild/source_functions.bash
parent239567632f786ef1855c2bc3056e2b4f28aab762 (diff)
downloadpaludis-a3f240c8b166805023d3b1fef383697a081baa04.tar.gz
paludis-a3f240c8b166805023d3b1fef383697a081baa04.tar.xz
Add hack to code with declare statements in environment.bz2
In bash, "declare" executed inside a function magically changes to "local". Recentish versions of Portage use "declare" in environment.bz2, and since we load it back inside a function we need to work around it. Thanks to Brian Harring <ferringb@gmail.com> for reporting and suggesting the fix. See Gentoo#309369
Diffstat (limited to 'paludis/repositories/e/ebuild/source_functions.bash')
-rwxr-xr-xpaludis/repositories/e/ebuild/source_functions.bash8
1 files changed, 6 insertions, 2 deletions
diff --git a/paludis/repositories/e/ebuild/source_functions.bash b/paludis/repositories/e/ebuild/source_functions.bash
index f3f91b7cf..31db62c36 100755
--- a/paludis/repositories/e/ebuild/source_functions.bash
+++ b/paludis/repositories/e/ebuild/source_functions.bash
@@ -46,10 +46,14 @@ ebuild_safe_source()
trap DEBUG
set -T
shopt -s extdebug
- trap "[[ \${BASH_COMMAND%%=*} == ?(*[[:space:]])!($(IFS='|'; shift; echo "${*}")) ||
+ trap "[[ \${BASH_COMMAND%%=*} == ?(*[[:space:]])!($(IFS='|'; [[ ${1} == --rewrite-for-declare ]] && shift; shift; echo "${*}")) ||
\${BASH_COMMAND%%[[:space:]]*} != @(*=*|export|declare) ]]" DEBUG
- source "${1}"
+ if [[ ${1} == --rewrite-for-declare ]]; then
+ ( source "${2}" && set >"${2}" && print_exports >>"${2}" ) && source "${2}"
+ else
+ source "${1}"
+ fi
eval "trap DEBUG; shopt -u extdebug; set +T; return ${?}"
}
ebuild_need_extglob ebuild_safe_source