aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-04-26 14:07:51 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-04-26 14:07:51 +0000
commitbea7d120c452d1db71c018c0957778e598c0aadf (patch)
treebf152fa7cebaf2c466c2666d54c4ee4868fc0f8b
parent118de550d2dc5508ff4446bdf7f2ddf7b497b9ba (diff)
downloadpaludis-bea7d120c452d1db71c018c0957778e598c0aadf.tar.gz
paludis-bea7d120c452d1db71c018c0957778e598c0aadf.tar.xz
Use proper defaults when environment.conf doesn't exist.
-rw-r--r--paludis/environments/paludis/paludis_config.cc53
1 files changed, 27 insertions, 26 deletions
diff --git a/paludis/environments/paludis/paludis_config.cc b/paludis/environments/paludis/paludis_config.cc
index 1435c78..408c434 100644
--- a/paludis/environments/paludis/paludis_config.cc
+++ b/paludis/environments/paludis/paludis_config.cc
@@ -175,38 +175,39 @@ namespace paludis
}
}
else
+ {
Log::get_instance()->message("paludis_environment.no_environment_conf", ll_debug, lc_context)
<< "No environment.conf or environment.bash in '" << config_dir << "'";
+ std::stringstream str;
+ kv.reset(new KeyValueConfigFile(str, KeyValueConfigFileOptions(), KeyValueConfigFile::Defaults(conf_vars)));
+ }
- if (kv)
- {
- if (! kv->get("reduced_username").empty())
- reduced_username = kv->get("reduced_username");
+ if (! kv->get("reduced_username").empty())
+ reduced_username = kv->get("reduced_username");
- if (! kv->get("portage_compatible").empty())
- Log::get_instance()->message("paludis_environment.portage_compatible.deprecated", ll_warning, lc_context)
- << "The 'portage_compatible' variable in environment.conf is deprecated,"
- << " set 'accept_breaks_portage' to empty instead.";
- else
- {
- std::list<std::string> breakages;
- tokenise_whitespace(kv->get("accept_breaks_portage"), std::back_inserter(breakages));
- for (std::list<std::string>::const_iterator it(breakages.begin()),
- it_end(breakages.end()); it_end != it; ++it)
- if ("*" == *it)
- {
- accept_all_breaks_portage = true;
- break;
- }
- else
- accept_breaks_portage.insert(*it);
- }
+ if (! kv->get("portage_compatible").empty())
+ Log::get_instance()->message("paludis_environment.portage_compatible.deprecated", ll_warning, lc_context)
+ << "The 'portage_compatible' variable in environment.conf is deprecated,"
+ << " set 'accept_breaks_portage' to empty instead.";
+ else
+ {
+ std::list<std::string> breakages;
+ tokenise_whitespace(kv->get("accept_breaks_portage"), std::back_inserter(breakages));
+ for (std::list<std::string>::const_iterator it(breakages.begin()),
+ it_end(breakages.end()); it_end != it; ++it)
+ if ("*" == *it)
+ {
+ accept_all_breaks_portage = true;
+ break;
+ }
+ else
+ accept_breaks_portage.insert(*it);
+ }
- distribution = kv->get("distribution");
+ distribution = kv->get("distribution");
- if (! kv->get("world").empty())
- world_file.reset(new FSEntry(kv->get("world")));
- }
+ if (! kv->get("world").empty())
+ world_file.reset(new FSEntry(kv->get("world")));
if (! world_file)
Log::get_instance()->message("paludis_environment.world.no_world", ll_warning, lc_context)