aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 20:43:08 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-04 20:43:08 +0000
commit2b88556545a9c52908a8bed0f7856f8916ddc95f (patch)
tree657dbf5214653930a38545e072efcfbf1a94ae79
parent5d423e3e09364283c20cf989b980823b38ed461d (diff)
downloadpaludis-2b88556545a9c52908a8bed0f7856f8916ddc95f.tar.gz
paludis-2b88556545a9c52908a8bed0f7856f8916ddc95f.tar.xz
Mask rather than remove test build_options when restricted
Fixes: ticket:1058
-rw-r--r--paludis/elike_choices.cc24
-rw-r--r--paludis/elike_choices.hh12
-rw-r--r--paludis/repositories/e/ebuild_id.cc17
3 files changed, 33 insertions, 20 deletions
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index f68f620..6e606b5 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -176,8 +176,10 @@ ELikeOptionalTestsChoiceValue::canonical_name_with_prefix()
}
ELikeOptionalTestsChoiceValue::ELikeOptionalTestsChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice) :
- _enabled(env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())
+ const Environment * const env, const std::shared_ptr<const Choice> & choice,
+ const bool l) :
+ _enabled((! l) && (env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())),
+ _mask(l)
{
}
@@ -208,7 +210,7 @@ ELikeOptionalTestsChoiceValue::enabled_by_default() const
bool
ELikeOptionalTestsChoiceValue::locked() const
{
- return false;
+ return _mask;
}
const std::string
@@ -242,8 +244,10 @@ ELikeRecommendedTestsChoiceValue::canonical_name_with_prefix()
}
ELikeRecommendedTestsChoiceValue::ELikeRecommendedTestsChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice) :
- _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())
+ const Environment * const env, const std::shared_ptr<const Choice> & choice,
+ const bool l) :
+ _enabled((! l) && (! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false())),
+ _mask(l)
{
}
@@ -274,7 +278,7 @@ ELikeRecommendedTestsChoiceValue::enabled_by_default() const
bool
ELikeRecommendedTestsChoiceValue::locked() const
{
- return false;
+ return _mask;
}
const std::string
@@ -326,8 +330,10 @@ ELikeExpensiveTestsChoiceValue::canonical_name_with_prefix()
}
ELikeExpensiveTestsChoiceValue::ELikeExpensiveTestsChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice) :
- _enabled(env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())
+ const Environment * const env, const std::shared_ptr<const Choice> & choice,
+ const bool l) :
+ _enabled((! l) && (env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())),
+ _mask(l)
{
}
@@ -358,7 +364,7 @@ ELikeExpensiveTestsChoiceValue::enabled_by_default() const
bool
ELikeExpensiveTestsChoiceValue::locked() const
{
- return false;
+ return _mask;
}
const std::string
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index 832071a..9304c74 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -82,10 +82,12 @@ namespace paludis
{
private:
const bool _enabled;
+ const bool _mask;
public:
ELikeOptionalTestsChoiceValue(const std::shared_ptr<const PackageID> &,
- const Environment * const env, const std::shared_ptr<const Choice> &);
+ const Environment * const env, const std::shared_ptr<const Choice> &,
+ const bool mask);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -105,10 +107,12 @@ namespace paludis
{
private:
const bool _enabled;
+ const bool _mask;
public:
ELikeRecommendedTestsChoiceValue(const std::shared_ptr<const PackageID> &,
- const Environment * const env, const std::shared_ptr<const Choice> &);
+ const Environment * const env, const std::shared_ptr<const Choice> &,
+ const bool mask);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -128,10 +132,12 @@ namespace paludis
{
private:
const bool _enabled;
+ const bool _mask;
public:
ELikeExpensiveTestsChoiceValue(const std::shared_ptr<const PackageID> &,
- const Environment * const env, const std::shared_ptr<const Choice> &);
+ const Environment * const env, const std::shared_ptr<const Choice> &,
+ const bool mask);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 3d6e351..86807ab 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1483,9 +1483,9 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
{
bool may_be_unrestricted_test(true), may_be_unrestricted_strip(true);
- /* if we unconditionally restrict an action, don't add a build option
- * for it. but if we conditionally restrict it, do, to avoid weirdness
- * in cases like RESTRICT="test? ( test )." */
+ /* if we unconditionally restrict an action, don't add / force mask
+ * a build option for it. but if we conditionally restrict it, do,
+ * to avoid weirdness in cases like RESTRICT="test? ( test )." */
if (restrict_key())
{
UnconditionalRestrictFinder f;
@@ -1496,13 +1496,13 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
/* optional_tests */
if (eapi()->supported()->choices_options()->has_optional_tests())
- if (may_be_unrestricted_test)
- build_options->add(std::make_shared<ELikeOptionalTestsChoiceValue>(shared_from_this(), _imp->environment, build_options));
+ build_options->add(std::make_shared<ELikeOptionalTestsChoiceValue>(shared_from_this(), _imp->environment, build_options,
+ ! may_be_unrestricted_test));
/* recommended_tests */
if (eapi()->supported()->choices_options()->has_recommended_tests())
- if (may_be_unrestricted_test)
- build_options->add(std::make_shared<ELikeRecommendedTestsChoiceValue>(shared_from_this(), _imp->environment, build_options));
+ build_options->add(std::make_shared<ELikeRecommendedTestsChoiceValue>(shared_from_this(), _imp->environment, build_options,
+ ! may_be_unrestricted_test));
/* expensive_tests */
if (eapi()->supported()->choices_options()->has_expensive_tests())
@@ -1526,7 +1526,8 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
}
if (has_expensive_test_phase)
- build_options->add(std::make_shared<ELikeExpensiveTestsChoiceValue>(shared_from_this(), _imp->environment, build_options));
+ build_options->add(std::make_shared<ELikeExpensiveTestsChoiceValue>(shared_from_this(), _imp->environment, build_options,
+ ! may_be_unrestricted_test));
}
/* split, strip */