aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-05 00:21:43 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-05 00:21:43 +0000
commite0647463e055a200181dabd99024a748ab277a69 (patch)
tree11ad4253f7d9ab8e2ebdc53eb1e113f6b0c3a5f4
parent34b66431bfd93cd8d215af6cc0f43dfb71efe7e8 (diff)
downloadpaludis-e0647463e055a200181dabd99024a748ab277a69.tar.gz
paludis-e0647463e055a200181dabd99024a748ab277a69.tar.xz
Make non-* use.conf entries work
-rw-r--r--paludis/default_config.cc11
-rw-r--r--paludis/default_config.hh2
-rw-r--r--paludis/default_environment.cc50
3 files changed, 60 insertions, 3 deletions
diff --git a/paludis/default_config.cc b/paludis/default_config.cc
index a17e6d2..c789581 100644
--- a/paludis/default_config.cc
+++ b/paludis/default_config.cc
@@ -241,6 +241,17 @@ DefaultConfig::DefaultConfig()
}
else
{
+ PackageDepAtom::ConstPointer a(new PackageDepAtom(tokens.at(0)));
+ for (std::vector<std::string>::const_iterator t(next(tokens.begin())), t_end(tokens.end()) ;
+ t != t_end ; ++t)
+ {
+ if ('-' == t->at(0))
+ _use[a->package()].push_back(UseConfigEntry(
+ a, UseFlagName(t->substr(1)), use_disabled));
+ else
+ _use[a->package()].push_back(UseConfigEntry(
+ a, UseFlagName(*t), use_enabled));
+ }
}
}
}
diff --git a/paludis/default_config.hh b/paludis/default_config.hh
index 5adb841..516a1d1 100644
--- a/paludis/default_config.hh
+++ b/paludis/default_config.hh
@@ -97,7 +97,7 @@ namespace paludis
struct UseConfigEntryTag :
SmartRecordTag<comparison_mode::NoComparisonTag, void>,
SmartRecordKeys<UseConfigEntryKeys, 3>,
- SmartRecordKey<uce_dep_atom, DepAtom::ConstPointer>,
+ SmartRecordKey<uce_dep_atom, PackageDepAtom::ConstPointer>,
SmartRecordKey<uce_flag_name, UseFlagName>,
SmartRecordKey<uce_flag_state, UseFlagState>
{
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 59df01e..1fbf831 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -50,9 +50,55 @@ DefaultEnvironment::~DefaultEnvironment()
bool
DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry * e) const
{
- /// \todo package use
+ if (e)
+ {
+ UseFlagState s(use_unspecified);
+
+ for (DefaultConfig::UseConfigIterator
+ u(DefaultConfig::get_instance()->begin_use_config(e->get<pde_name>())),
+ u_end(DefaultConfig::get_instance()->end_use_config(e->get<pde_name>())) ;
+ u != u_end ; ++u)
+ {
+ if (f != u->get<uce_flag_name>())
+ continue;
+
+ if (! match_package(package_database(), *u->get<uce_dep_atom>(), *e))
+ continue;
+
+ switch (u->get<uce_flag_state>())
+ {
+ case use_enabled:
+ s = use_enabled;
+ continue;
+
+ case use_disabled:
+ s = use_disabled;
+ continue;
+
+ case use_unspecified:
+ continue;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad state");
+ }
+
+ do
+ {
+ switch (s)
+ {
+ case use_enabled:
+ return true;
+
+ case use_disabled:
+ return false;
+
+ case use_unspecified:
+ continue;
+ }
+ throw InternalError(PALUDIS_HERE, "Bad state");
+ } while (false);
+ }
- /* prefer user masks, then profile, then disabled */
do
{
UseFlagState state(use_unspecified);