aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-08-06 19:26:26 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-08-06 19:26:26 +0100
commita5a402331f246c81bdd14dea34639ec2f916928c (patch)
tree407f145f026e209c48434d41997d8c9bbe127ae3
parentfdb9b51c3f39bede186061b40da196e6816dcb2b (diff)
downloadpaludis-a5a402331f246c81bdd14dea34639ec2f916928c.tar.gz
paludis-a5a402331f246c81bdd14dea34639ec2f916928c.tar.xz
Don't allow optionq build_options:*
Fixes: ticket:1182
-rw-r--r--paludis/elike_choices-fwd.hh3
-rw-r--r--paludis/elike_choices.cc19
-rw-r--r--paludis/repositories/e/pipe_command_handler.cc3
3 files changed, 25 insertions, 0 deletions
diff --git a/paludis/elike_choices-fwd.hh b/paludis/elike_choices-fwd.hh
index 25df2e8..37ab43f 100644
--- a/paludis/elike_choices-fwd.hh
+++ b/paludis/elike_choices-fwd.hh
@@ -22,6 +22,7 @@
#include <paludis/util/attributes.hh>
#include <paludis/choice-fwd.hh>
+#include <memory>
#include <string>
#include <iosfwd>
@@ -31,6 +32,7 @@ namespace paludis
struct ELikeRecommendedTestsChoiceValue;
struct ELikeExpensiveTestsChoiceValue;
struct ELikeJobsChoiceValue;
+ struct ELikeTraceChoiceValue;
struct ELikePreserveWorkChoiceValue;
struct ELikeSymbolsChoiceValue;
@@ -40,6 +42,7 @@ namespace paludis
#include <paludis/elike_choices-se.hh>
+ bool is_special_elike_choice_value(const std::shared_ptr<const ChoiceValue> &) PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
}
#endif
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index d7cd238..0425bf7 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -28,6 +28,7 @@
#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/util/enum_iterator.hh>
#include <paludis/util/map.hh>
+#include <set>
#include <limits>
#include <istream>
#include <ostream>
@@ -716,3 +717,21 @@ ELikeSymbolsChoiceValue::should_compress(const std::string & v)
throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
}
+
+bool
+paludis::is_special_elike_choice_value(
+ const std::shared_ptr<const ChoiceValue> & v)
+{
+ static const std::set<std::string> specials({
+ stringify(ELikeOptionalTestsChoiceValue::canonical_name_with_prefix()),
+ stringify(ELikeRecommendedTestsChoiceValue::canonical_name_with_prefix()),
+ stringify(ELikeExpensiveTestsChoiceValue::canonical_name_with_prefix()),
+ stringify(ELikeJobsChoiceValue::canonical_name_with_prefix()),
+ stringify(ELikeTraceChoiceValue::canonical_name_with_prefix()),
+ stringify(ELikePreserveWorkChoiceValue::canonical_name_with_prefix()),
+ stringify(ELikeSymbolsChoiceValue::canonical_name_with_prefix())
+ });
+
+ return specials.end() != specials.find(stringify(v->name_with_prefix()));
+}
+
diff --git a/paludis/repositories/e/pipe_command_handler.cc b/paludis/repositories/e/pipe_command_handler.cc
index 77f6901..bde711e 100644
--- a/paludis/repositories/e/pipe_command_handler.cc
+++ b/paludis/repositories/e/pipe_command_handler.cc
@@ -447,6 +447,9 @@ paludis::erepository::pipe_command_handler(const Environment * const environment
return "EOPTIONQ ID " + stringify(*package_id) + " has no choice named '" + stringify(name) + "'";
}
+ if (is_special_elike_choice_value(value))
+ return "Ecannot query option '" + stringify(name) + "' for ID " + stringify(*package_id);
+
if (value->enabled())
return "O0;";
else