aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-05 08:58:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-04-05 08:58:39 +0000
commit5724eb4dd0f68d101f3f44fc072369dc8c14d458 (patch)
tree17e38d3c5b306207e70fd96639dfc9a35baac75f
parent67b08436d6ab0bdec10f259a691d8de5e1a75d44 (diff)
downloadpaludis-5724eb4dd0f68d101f3f44fc072369dc8c14d458.tar.gz
paludis-5724eb4dd0f68d101f3f44fc072369dc8c14d458.tar.xz
Use config suffix for bashrc files
-rwxr-xr-xebuild/ebuild.bash49
-rw-r--r--paludis/default_config.cc15
-rw-r--r--paludis/default_config.hh5
-rw-r--r--paludis/default_environment.cc5
-rw-r--r--paludis/default_environment.hh2
-rw-r--r--paludis/environment.hh5
-rw-r--r--paludis/portage_repository.cc2
-rw-r--r--paludis/qa/environment.hh5
-rw-r--r--paludis/test_environment.hh5
9 files changed, 67 insertions, 26 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 4d60a53..810a722 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -50,6 +50,22 @@ 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}"
+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 multilib_functions
+ebuild_load_module install_functions
+ebuild_load_module build_functions
+ebuild_load_module unpack_functions
+ebuild_load_module eclass_functions
+
ebuild_source_profile()
{
if [[ -f ${1}/make.defaults ]] ; then
@@ -75,17 +91,14 @@ ebuild_source_profile $(readlink -f "${PALUDIS_PROFILE_DIR}")
unset ${save_vars}
-if [[ -r ${PALUDIS_CONFIG_DIR}/bashrc ]]; then
- source ${PALUDIS_CONFIG_DIR}/bashrc
-fi
-if [[ -n "${ROOT}" ]] && [[ "${ROOT}" != "/" ]] ; then
- if [[ -r ${ROOT}/${PALUDIS_CONFIG_DIR}/bashrc ]]; then
- source ${ROOT}/${PALUDIS_CONFIG_DIR}/bashrc
+for f in ${PALUDIS_BASHRC_FILES} ; do
+ if [[ -f ${f} ]] ; then
+ ebuild_notice "debug" "Loading bashrc file ${f}"
+ source ${f}
+ else
+ ebuild_notice "debug" "Skipping bashrc file ${f}"
fi
-fi
-if [[ -r ${HOME}/.paludis/bashrc ]]; then
- source ${HOME}/.paludis/bashrc
-fi
+done
for var in ${save_vars}; do
if [[ -n ${!var} ]]; then
@@ -97,22 +110,6 @@ 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 multilib_functions
-ebuild_load_module install_functions
-ebuild_load_module build_functions
-ebuild_load_module unpack_functions
-ebuild_load_module eclass_functions
-
ebuild_load_ebuild()
{
export EBUILD="${1}"
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index f2cf9c8..e8f562e 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -307,3 +307,18 @@ DefaultConfig::set_config_suffix(const std::string & s)
_config_suffix = s;
}
+std::string
+DefaultConfig::bashrc_files() const
+{
+ if (! getenv_with_default("PALUDIS_CONFIG_DIR", "").empty())
+ return stringify(FSEntry(getenv_or_error("PALUDIS_CONFIG_DIR")) / "bashrc");
+ else
+ return
+ stringify(FSEntry(getenv_with_default("ROOT", "/") + "" SYSCONFDIR)
+ / ("paludis" + (_config_suffix.empty() ? std::string("") : "-" + _config_suffix))
+ / "bashrc") + " " +
+ stringify(FSEntry(getenv_or_error("HOME"))
+ / (".paludis" + (_config_suffix.empty() ? std::string("") : "-" + _config_suffix))
+ / "bashrc");
+}
+
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index 2772745..71b9ed7 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -337,6 +337,11 @@ namespace paludis
{
return _default_use.end();
}
+
+ /**
+ * Our bashrc files.
+ */
+ std::string bashrc_files() const;
};
}
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 496ab04..9c8e3ad 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -211,3 +211,8 @@ DefaultEnvironment::query_user_unmasks(const PackageDatabaseEntry & d) const
return false;
}
+std::string
+DefaultEnvironment::bashrc_files() const
+{
+ return DefaultConfig::get_instance()->bashrc_files();
+}
diff --git a/paludis/default_environment.hh b/paludis/default_environment.hh
index cf94004..2c55cb2 100644
--- a/paludis/default_environment.hh
+++ b/paludis/default_environment.hh
@@ -56,6 +56,8 @@ namespace paludis
virtual bool query_user_masks(const PackageDatabaseEntry &) const;
virtual bool query_user_unmasks(const PackageDatabaseEntry &) const;
+
+ virtual std::string bashrc_files() const;
};
}
#endif
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 84beeb2..e9fbd74 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -89,6 +89,11 @@ namespace paludis
}
/**
+ * Our bashrc files.
+ */
+ virtual std::string bashrc_files() const = 0;
+
+ /**
* Destructor.
*/
virtual ~Environment();
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index c4cc5e0..ca40187 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -747,6 +747,7 @@ PortageRepository::do_version_metadata(
("PORTDIR", stringify(_imp->location) + "/")
("DISTDIR", stringify(_imp->distdir))
("PALUDIS_TMPDIR", BIGTEMPDIR "/paludis/")
+ ("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files())
("KV", kernel_version())
("PALUDIS_EBUILD_LOG_LEVEL", log_level_string())
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));
@@ -1158,6 +1159,7 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
("PALUDIS_TMPDIR", BIGTEMPDIR "/paludis/")
("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
("PALUDIS_PROFILE_DIR", _imp->profile)
+ ("PALUDIS_BASHRC_FILES", _imp->env->bashrc_files())
("KV", kernel_version())
("PALUDIS_EBUILD_LOG_LEVEL", log_level_string())
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));
diff --git a/paludis/qa/environment.hh b/paludis/qa/environment.hh
index bc373c4..08506b3 100644
--- a/paludis/qa/environment.hh
+++ b/paludis/qa/environment.hh
@@ -57,6 +57,11 @@ namespace paludis
virtual bool query_user_masks(const PackageDatabaseEntry &) const;
virtual bool query_user_unmasks(const PackageDatabaseEntry &) const;
+
+ virtual std::string bashrc_files() const
+ {
+ return "";
+ }
};
}
}
diff --git a/paludis/test_environment.hh b/paludis/test_environment.hh
index 2c9f51c..f41ebb7 100644
--- a/paludis/test_environment.hh
+++ b/paludis/test_environment.hh
@@ -45,6 +45,11 @@ namespace paludis
virtual bool query_user_masks(const PackageDatabaseEntry &) const;
virtual bool query_user_unmasks(const PackageDatabaseEntry &) const;
+
+ virtual std::string bashrc_files() const
+ {
+ return "";
+ }
};
}