aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-04 08:12:36 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-04 08:12:36 +0000
commitdea348e1d60abb19c1b9dea6f98c891cb02002f1 (patch)
treeefb07df692d4366196cc9814448eba758ee6591b
parentf382d25b3c704b2a9cec271d484af28ab722b01d (diff)
downloadpaludis-dea348e1d60abb19c1b9dea6f98c891cb02002f1.tar.gz
paludis-dea348e1d60abb19c1b9dea6f98c891cb02002f1.tar.xz
Replace spb's evil save / restore var code with something that works :P
-rwxr-xr-xebuild/ebuild.bash32
-rw-r--r--ebuild/echo_functions.bash4
2 files changed, 13 insertions, 23 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index fecb3c5..4d60a53 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -50,20 +50,6 @@ EBUILD_MODULES_DIR=$(readlink -f $(dirname $0 ) )
[[ -d ${EBUILD_MODULES_DIR} ]] || die "${EBUILD_MODULES_DIR} is not a directory"
export PALUDIS_EBUILD_MODULES_DIR="${EBUILD_MODULES_DIR}"
-save_vars()
-{
- for var in "$@"; do
- eval "saved_${var}='${!var}'"
- done
-}
-
-restore_vars()
-{
- for var in "$@"; do
- eval "${var}='\${saved_${var}}'"
- done
-}
-
ebuild_source_profile()
{
if [[ -f ${1}/make.defaults ]] ; then
@@ -79,14 +65,15 @@ ebuild_source_profile()
fi
}
-_saved_vars="USE USE_EXPAND"
+save_vars="USE USE_EXPAND"
-save_vars ${_saved_vars}
-source /sbin/functions.sh || die "Couldn't source functions.sh"
+for var in ${save_vars} ; do
+ eval "export save_var_${var}='${!var}'"
+done
ebuild_source_profile $(readlink -f "${PALUDIS_PROFILE_DIR}")
-unset ${_saved_vars}
+unset ${save_vars}
if [[ -r ${PALUDIS_CONFIG_DIR}/bashrc ]]; then
source ${PALUDIS_CONFIG_DIR}/bashrc
@@ -100,23 +87,26 @@ if [[ -r ${HOME}/.paludis/bashrc ]]; then
source ${HOME}/.paludis/bashrc
fi
-for var in ${_saved_vars}; do
+for var in ${save_vars}; do
if [[ -n ${!var} ]]; then
die "${var} should not be set in bashrc. Aborting."
fi
done
-restore_vars ${_saved_vars}
+for var in ${save_vars} ; do
+ eval "export ${var}=\${save_var_${var}}"
+done
ebuild_load_module()
{
source "${EBUILD_MODULES_DIR}/${1}.bash" || die "Error loading module ${1}"
}
+source /sbin/functions.sh || die "Couldn't source functions.sh"
+ebuild_load_module echo_functions
ebuild_load_module sandbox_stubs
ebuild_load_module portage_stubs
ebuild_load_module list_functions
-ebuild_load_module echo_functions
ebuild_load_module multilib_functions
ebuild_load_module install_functions
ebuild_load_module build_functions
diff --git a/ebuild/echo_functions.bash b/ebuild/echo_functions.bash
index 6b2859f..578d5aa 100644
--- a/ebuild/echo_functions.bash
+++ b/ebuild/echo_functions.bash
@@ -74,8 +74,8 @@ ebuild_notice()
local min_level_num=$(ebuild_notice_level "${PALUDIS_EBUILD_LOG_LEVEL}" )
if [[ "${level_num}" -ge "${min_level_num}" ]] ; then
- local upper_level=$(echo ${level} | ${ebuild_real_tr} '[:lower:]' '[:upper:]' )
- echo "[${upper_level}.EBUILD] $* (from ${EBUILD})" 1>&2
+ local upper_level=$(echo ${level} | ${ebuild_real_tr:-tr} '[:lower:]' '[:upper:]' )
+ echo "[${upper_level}.EBUILD] $* (from ${EBUILD:-?})" 1>&2
fi
true
}