aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-29 22:26:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-03-29 22:26:57 +0000
commita6fb91a791e90455f6c5d7fd6598f0fa93f2a7bd (patch)
tree3ca201294f0c25f6294a66adffc1f9d1626499f6
parent79bc9a55a40ae0eb2e40399b519ba63636a05a29 (diff)
downloadpaludis-a6fb91a791e90455f6c5d7fd6598f0fa93f2a7bd.tar.gz
paludis-a6fb91a791e90455f6c5d7fd6598f0fa93f2a7bd.tar.xz
More PortageEnvironment work
-rw-r--r--paludis/environments/portage/portage_environment.cc26
-rw-r--r--paludis/environments/portage/portage_environment.hh1
2 files changed, 25 insertions, 2 deletions
diff --git a/paludis/environments/portage/portage_environment.cc b/paludis/environments/portage/portage_environment.cc
index 84acda7..34b1187 100644
--- a/paludis/environments/portage/portage_environment.cc
+++ b/paludis/environments/portage/portage_environment.cc
@@ -141,6 +141,8 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
Environment(std::tr1::shared_ptr<PackageDatabase>(new PackageDatabase(this))),
PrivateImplementationPattern<PortageEnvironment>(new Implementation<PortageEnvironment>(s))
{
+ using namespace std::tr1::placeholders;
+
Context context("When creating PortageEnvironment using config root '" + s + "':");
Log::get_instance()->message(ll_warning, lc_no_context,
@@ -149,7 +151,7 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
"guaranteed; issues should be reported via trac. You are strongly encouraged "
"to migrate to a Paludis configuration.");
- _imp->vars.reset(new KeyValueConfigFile(FSEntry("/dev/null"), &getenv_with_default, &is_incremental));
+ _imp->vars.reset(new KeyValueConfigFile(FSEntry("/dev/null")));
_load_profile((_imp->conf_dir / "make.profile").realpath());
if ((_imp->conf_dir / "make.globals").exists())
_imp->vars.reset(new KeyValueConfigFile(_imp->conf_dir / "make.globals", _imp->vars, &is_incremental));
@@ -167,7 +169,11 @@ PortageEnvironment::PortageEnvironment(const std::string & s) :
throw PortageEnvironmentConfigurationError("PORTDIR empty or unset");
_add_portdir_repository(FSEntry(_imp->vars->get("PORTDIR")));
_add_vdb_repository();
- /* TODO: OVERLAY */
+ std::list<FSEntry> portdir_overlay;
+ WhitespaceTokeniser::get_instance()->tokenise(_imp->vars->get("PORTDIR_OVERLAY"),
+ create_inserter<FSEntry>(std::back_inserter(portdir_overlay)));
+ std::for_each(portdir_overlay.begin(), portdir_overlay.end(),
+ std::tr1::bind(std::tr1::mem_fn(&PortageEnvironment::_add_portdir_overlay_repository), this, _1));
/* use etc */
@@ -326,6 +332,22 @@ PortageEnvironment::_add_portdir_repository(const FSEntry & portdir)
}
void
+PortageEnvironment::_add_portdir_overlay_repository(const FSEntry & portdir)
+{
+ Context context("When creating PORTDIR_OVERLAY repository '" + stringify(portdir) + "':");
+
+ std::tr1::shared_ptr<AssociativeCollection<std::string, std::string> > keys(
+ new AssociativeCollection<std::string, std::string>::Concrete);
+ keys->insert("root", stringify(root()));
+ keys->insert("location", stringify(portdir));
+ keys->insert("format", "ebuild");
+ keys->insert("names_cache", "/var/empty");
+ keys->insert("master_repository", "gentoo");
+ package_database()->add_repository(2,
+ RepositoryMaker::get_instance()->find_maker("ebuild")(this, keys));
+}
+
+void
PortageEnvironment::_add_vdb_repository()
{
Context context("When creating vdb repository:");
diff --git a/paludis/environments/portage/portage_environment.hh b/paludis/environments/portage/portage_environment.hh
index 0f9a899..56a38c0 100644
--- a/paludis/environments/portage/portage_environment.hh
+++ b/paludis/environments/portage/portage_environment.hh
@@ -40,6 +40,7 @@ namespace paludis
void _add_virtuals_repository();
void _add_installed_virtuals_repository();
void _add_portdir_repository(const FSEntry &);
+ void _add_portdir_overlay_repository(const FSEntry &);
void _add_vdb_repository();
template<typename I_>