aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Stephen P. Bennett <spb@exherbo.org> 2006-04-01 22:12:38 +0000
committerAvatar Stephen P. Bennett <spb@exherbo.org> 2006-04-01 22:12:38 +0000
commit865e64d1d3d676c6a2321c026fef64e166e6315f (patch)
tree8f2ebdeaa01c9ab61b3262ca43235f0efc2f965e
parent3edbc7781ce59eecf1d0624b0bcd9493bf096a2a (diff)
downloadpaludis-865e64d1d3d676c6a2321c026fef64e166e6315f.tar.gz
paludis-865e64d1d3d676c6a2321c026fef64e166e6315f.tar.xz
Improve USE et al handling in ebuild.bash, and pass more info from paludis to ebuild.
-rwxr-xr-xebuild/ebuild.bash39
-rw-r--r--paludis/portage_repository.cc17
2 files changed, 52 insertions, 4 deletions
diff --git a/ebuild/ebuild.bash b/ebuild/ebuild.bash
index 25507df..c0394e2 100755
--- a/ebuild/ebuild.bash
+++ b/ebuild/ebuild.bash
@@ -50,6 +50,20 @@ 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
@@ -65,10 +79,29 @@ ebuild_source_profile()
fi
}
+_saved_vars="USE USE_EXPAND ${USE_EXPAND}"
+
+save_vars ${_saved_vars}
source /sbin/functions.sh || die "Couldn't source functions.sh"
-source /etc/make.globals || die "Couldn't source make.globals"
-ebuild_source_profile $(readlink -f /etc/make.profile/ )
-source /etc/make.conf || die "Couldn't source make.conf"
+
+ebuild_source_profile $(readlink -f "${PALUDIS_PROFILE_DIR}")
+
+unset ${_saved_vars}
+
+if [[ -r ${PALUDIS_CONFIG_DIR}/bashrc ]]; then
+ source ${PALUDIS_CONFIG_DIR}/bashrc
+fi
+if [[ -r ${HOME}/.paludis/bashrc ]]; then
+ source ${HOME}/.paludis/bashrc
+fi
+
+for var in ${_saved_vars}; do
+ if [[ -n ${!var} ]]; then
+ die "${var} should not be set in bashrc. Aborting."
+ fi
+done
+restore_vars ${_saved_vars}
+
ebuild_load_module()
{
diff --git a/paludis/portage_repository.cc b/paludis/portage_repository.cc
index ee8fa84..a2c5e7a 100644
--- a/paludis/portage_repository.cc
+++ b/paludis/portage_repository.cc
@@ -916,9 +916,10 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
else
metadata = version_metadata(q, v);
+ PackageDatabaseEntry e(q, v, name());
+
std::string archives, flat_src_uri;
{
- PackageDatabaseEntry e(q, v, name());
DepAtomFlattener f(_imp->env, &e,
DepParser::parse(metadata->get(vmk_src_uri),
DepParserPolicy<PlainTextDepAtom, false>::get_instance()));
@@ -959,6 +960,16 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
else
actions = "merge";
+ std::string use;
+ VersionMetadata::IuseIterator iuse_it=metadata->begin_iuse(), iuse_end=metadata->end_iuse();
+ for( ; iuse_it != iuse_end; ++iuse_it)
+ {
+ if(_imp->env->query_use(*iuse_it, &e))
+ use += (*iuse_it).data() + " ";
+ }
+ /// \todo add ARCH and USE_EXPAND
+
+
std::string cmd(make_env_command(
getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis") +
"/ebuild.bash '" +
@@ -973,6 +984,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
("PVR", stringify(v.remove_revision()) + "-" + v.revision_only())
("PF", stringify(q.get<qpn_package>()) + "-" + stringify(v))
("A", archives)
+ ("USE", use)
+ ("USE_EXPAND", join(_imp->expand_list.begin(), _imp->expand_list.end(), " "))
("FLAT_SRC_URI", flat_src_uri)
("CATEGORY", stringify(q.get<qpn_category>()))
("FILESDIR", stringify(_imp->location) + "/" + stringify(q.get<qpn_category>()) + "/" +
@@ -981,6 +994,8 @@ PortageRepository::do_install(const QualifiedPackageName & q, const VersionSpec
("PORTDIR", stringify(_imp->location) + "/")
("DISTDIR", stringify(_imp->location) + "/distfiles/")
("PALUDIS_TMPDIR", BIGTEMPDIR "/paludis/")
+ ("PALUDIS_CONFIG_DIR", SYSCONFDIR "/paludis/")
+ ("PALUDIS_PROFILE_DIR", _imp->profile)
("KV", kernel_version())
("PALUDIS_EBUILD_LOG_LEVEL", log_level_string())
("PALUDIS_EBUILD_DIR", getenv_with_default("PALUDIS_EBUILD_DIR", LIBEXECDIR "/paludis")));