aboutsummaryrefslogtreecommitdiff
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
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
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash2
-rwxr-xr-xpaludis/repositories/e/ebuild/source_functions.bash8
2 files changed, 7 insertions, 3 deletions
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index e4bdbfb..49f6ba1 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -257,7 +257,7 @@ ebuild_scrub_environment()
done )
(
- ebuild_safe_source "${1}" PATH PALUDIS_SOURCE_MERGED_VARIABLES \
+ ebuild_safe_source --rewrite-for-declare "${1}" PATH PALUDIS_SOURCE_MERGED_VARIABLES \
PALUDIS_BRACKET_MERGED_VARIABLES LD_LIBRARY_PATH paludis_declared_functions || exit 1
unset -v $(
diff --git a/paludis/repositories/e/ebuild/source_functions.bash b/paludis/repositories/e/ebuild/source_functions.bash
index f3f91b7..31db62c 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