aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-10 01:24:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-09-10 01:24:47 +0000
commite2a50eca9a7bd2e311338aebdbd9e855c31c8099 (patch)
tree6de29602ad31378ca391672adb81ff0456b6ec08
parent3eb37246ed00f9359eea27c48425c99e57a55f8a (diff)
downloadpaludis-e2a50eca9a7bd2e311338aebdbd9e855c31c8099.tar.gz
paludis-e2a50eca9a7bd2e311338aebdbd9e855c31c8099.tar.xz
Make the default environment query_use more useful
-rw-r--r--paludis/default_environment.cc7
-rw-r--r--paludis/environment.cc35
-rw-r--r--paludis/environment.hh3
3 files changed, 41 insertions, 4 deletions
diff --git a/paludis/default_environment.cc b/paludis/default_environment.cc
index 3217407..e893cc0 100644
--- a/paludis/default_environment.cc
+++ b/paludis/default_environment.cc
@@ -59,8 +59,13 @@ DefaultEnvironment::query_use(const UseFlagName & f, const PackageDatabaseEntry
package_database()->fetch_repository(e->repository).raw_pointer() :
0));
- if (repo && repo->use_interface && repo->use_interface->query_use_mask(f, e))
+ if (repo && repo->use_interface)
+ {
+ if (repo->use_interface->query_use_mask(f, e))
return false;
+ if (repo->use_interface->query_use_force(f, e))
+ return true;
+ }
/* check use: per package user config */
if (e)
diff --git a/paludis/environment.cc b/paludis/environment.cc
index cac9e9d..fc2e5f6 100644
--- a/paludis/environment.cc
+++ b/paludis/environment.cc
@@ -380,9 +380,40 @@ Hook::operator() (const std::string & k, const std::string & v) const
}
bool
-Environment::query_use(const UseFlagName &, const PackageDatabaseEntry *) const
+Environment::query_use(const UseFlagName & f, const PackageDatabaseEntry * e) const
{
- return false;
+ /* first check package database use masks... */
+ const Repository * const repo((e ?
+ package_database()->fetch_repository(e->repository).raw_pointer() :
+ 0));
+
+ if (repo && repo->use_interface)
+ {
+ if (repo->use_interface->query_use_mask(f, e))
+ return false;
+ if (repo->use_interface->query_use_force(f, e))
+ return true;
+ }
+
+ /* check use: package database config */
+ if (repo && repo->use_interface)
+ {
+ switch (repo->use_interface->query_use(f, e))
+ {
+ case use_disabled:
+ case use_unspecified:
+ return false;
+
+ case use_enabled:
+ return true;
+ }
+
+ throw InternalError(PALUDIS_HERE, "bad state");
+ }
+ else
+ {
+ return false;
+ }
}
UseFlagNameCollection::Pointer
diff --git a/paludis/environment.hh b/paludis/environment.hh
index c4e06c4..97911f0 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -125,7 +125,8 @@ namespace paludis
* Does the user want the specified USE flag set for a
* particular package?
*
- * Default behaviour: all USE flags turned off.
+ * Default behaviour: all USE flags turned off, unless overridden by
+ * the repository for the pde.
*/
virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const;