aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-10-25 12:54:15 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2008-10-25 13:12:59 +0100
commit88df640929231d8fec056df9cfc47aab385aa9ef (patch)
tree2dfa80520a0c619209676e34ed12e057c3b31b26
parent9124291229b1e2c42c16771025c066f7de2fcabc (diff)
downloadpaludis-88df640929231d8fec056df9cfc47aab385aa9ef.tar.gz
paludis-88df640929231d8fec056df9cfc47aab385aa9ef.tar.xz
Add ChoiceValue::enabled_by_default
-rw-r--r--paludis/choice.hh6
-rw-r--r--paludis/elike_choices.cc24
-rw-r--r--paludis/elike_choices.hh4
-rw-r--r--paludis/repositories/e/e_choice_value.cc9
-rw-r--r--paludis/repositories/e/e_choice_value.hh4
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc2
-rw-r--r--paludis/repositories/e/ebuild_id.cc35
-rw-r--r--paludis/repositories/fake/fake_package_id.cc5
8 files changed, 68 insertions, 21 deletions
diff --git a/paludis/choice.hh b/paludis/choice.hh
index a877024..22394c4 100644
--- a/paludis/choice.hh
+++ b/paludis/choice.hh
@@ -320,6 +320,12 @@ namespace paludis
virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
/**
+ * Would this flag be enabled by default (i.e. before
+ * considering any overrides from the Environment)?
+ */
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
+
+ /**
* Is this flag locked (forced or masked)?
*/
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result)) = 0;
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index 932b918..7d42d33 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -61,6 +61,12 @@ ELikeStripChoiceValue::enabled() const
}
bool
+ELikeStripChoiceValue::enabled_by_default() const
+{
+ return true;
+}
+
+bool
ELikeStripChoiceValue::locked() const
{
return false;
@@ -115,6 +121,12 @@ ELikeSplitChoiceValue::enabled() const
}
bool
+ELikeSplitChoiceValue::enabled_by_default() const
+{
+ return true;
+}
+
+bool
ELikeSplitChoiceValue::locked() const
{
return false;
@@ -169,6 +181,12 @@ ELikeOptionalTestsChoiceValue::enabled() const
}
bool
+ELikeOptionalTestsChoiceValue::enabled_by_default() const
+{
+ return false;
+}
+
+bool
ELikeOptionalTestsChoiceValue::locked() const
{
return false;
@@ -223,6 +241,12 @@ ELikeRecommendedTestsChoiceValue::enabled() const
}
bool
+ELikeRecommendedTestsChoiceValue::enabled_by_default() const
+{
+ return true;
+}
+
+bool
ELikeRecommendedTestsChoiceValue::locked() const
{
return false;
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index a367d10..f6c78ee 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -41,6 +41,7 @@ namespace paludis
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -62,6 +63,7 @@ namespace paludis
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -83,6 +85,7 @@ namespace paludis
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -104,6 +107,7 @@ namespace paludis
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/e_choice_value.cc b/paludis/repositories/e/e_choice_value.cc
index dbc5766..8d6c36c 100644
--- a/paludis/repositories/e/e_choice_value.cc
+++ b/paludis/repositories/e/e_choice_value.cc
@@ -25,13 +25,14 @@ using namespace paludis::erepository;
EChoiceValue::EChoiceValue(const ChoicePrefixName & r, const UnprefixedChoiceName & v, const ChoiceNameWithPrefix & np, const QualifiedPackageName & p,
const std::tr1::shared_ptr<const UseDesc> & d,
- bool b, bool l, bool x) :
+ bool b, bool def, bool l, bool x) :
_prefix(r),
_unprefixed_name(v),
_name_with_prefix(np),
_package_name(p),
_use_desc(d),
_enabled(b),
+ _enabled_by_default(def),
_locked(l),
_explicitly_listed(x)
{
@@ -64,6 +65,12 @@ EChoiceValue::enabled() const
}
bool
+EChoiceValue::enabled_by_default() const
+{
+ return _enabled_by_default;
+}
+
+bool
EChoiceValue::locked() const
{
return _locked;
diff --git a/paludis/repositories/e/e_choice_value.hh b/paludis/repositories/e/e_choice_value.hh
index a1870ba..85336c6 100644
--- a/paludis/repositories/e/e_choice_value.hh
+++ b/paludis/repositories/e/e_choice_value.hh
@@ -43,6 +43,7 @@ namespace paludis
const QualifiedPackageName _package_name;
const std::tr1::shared_ptr<const UseDesc> _use_desc;
const bool _enabled;
+ const bool _enabled_by_default;
const bool _locked;
const bool _explicitly_listed;
@@ -52,12 +53,13 @@ namespace paludis
const ChoiceNameWithPrefix & np,
const QualifiedPackageName & p,
const std::tr1::shared_ptr<const UseDesc> & d,
- bool b,
+ bool b, bool d,
bool l, bool x);
const UnprefixedChoiceName unprefixed_name() const;
const ChoiceNameWithPrefix name_with_prefix() const;
bool enabled() const;
+ bool enabled_by_default() const;
bool locked() const;
const std::string description() const;
bool explicitly_listed() const;
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index e7abc8e..d1ccb2f 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -961,7 +961,7 @@ EInstalledRepositoryID::make_choice_value(const std::tr1::shared_ptr<const Choic
enabled = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix));
return make_shared_ptr(new EChoiceValue(c->prefix(), v, ChoiceNameWithPrefix(name_with_prefix), name(), std::tr1::shared_ptr<const UseDesc>(),
- enabled, true, explicitly_listed));
+ enabled, enabled, true, explicitly_listed));
}
void
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 89d1c32..f939d8c 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1115,51 +1115,50 @@ EbuildID::make_choice_value(
}
ChoiceNameWithPrefix name_with_prefix(name_with_prefix_s);
- bool locked(false), enabled(false);
+ bool locked(false), enabled(false), enabled_by_default(false);
if (raw_use_key())
{
locked = true;
- enabled = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix_s));
+ enabled = enabled_by_default = (raw_use_key()->value()->end() != raw_use_key()->value()->find(name_with_prefix_s));
}
else
{
if (_imp->repository->profile()->use_masked(shared_from_this(), choice, value_name, name_with_prefix))
{
locked = true;
- enabled = false;
+ enabled = enabled_by_default = false;
}
else if (_imp->repository->profile()->use_forced(shared_from_this(), choice, value_name, name_with_prefix))
{
locked = true;
- enabled = true;
+ enabled = enabled_by_default = true;
}
else
{
+ Tribool profile_want(_imp->repository->profile()->use_state_ignoring_masks(shared_from_this(), choice, value_name, name_with_prefix));
+ if (profile_want.is_true())
+ enabled_by_default = true;
+ else if (profile_want.is_false())
+ enabled_by_default = false;
+ else if (iuse_default.is_true())
+ enabled_by_default = true;
+ else if (iuse_default.is_false())
+ enabled_by_default = false;
+ else
+ enabled_by_default = false;
Tribool env_want(_imp->environment->want_choice_enabled(shared_from_this(), choice, value_name));
if (env_want.is_true())
enabled = true;
else if (env_want.is_false())
enabled = false;
else
- {
- Tribool profile_want(_imp->repository->profile()->use_state_ignoring_masks(shared_from_this(), choice, value_name, name_with_prefix));
- if (profile_want.is_true())
- enabled = true;
- else if (profile_want.is_false())
- enabled = false;
- else if (iuse_default.is_true())
- enabled = true;
- else if (iuse_default.is_false())
- enabled = false;
- else
- enabled = false;
- }
+ enabled = enabled_by_default;
}
}
return make_shared_ptr(new EChoiceValue(choice->prefix(), value_name, ChoiceNameWithPrefix(name_with_prefix), name(),
_imp->repository->use_desc(),
- enabled, locked, explicitly_listed));
+ enabled, enabled_by_default, locked, explicitly_listed));
}
void
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index a25c74d..b05dec9 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -344,6 +344,11 @@ namespace
return env->want_choice_enabled(id, choice, value_name).is_true();
}
+ virtual bool enabled_by_default() const
+ {
+ return false;
+ }
+
virtual bool locked() const
{
return false;