aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2012-09-09 00:13:03 +0100
committerAvatar David Leverton <levertond@googlemail.com> 2012-09-09 00:13:03 +0100
commit6c4de368635996faddd354ae8a7e26a0b6a138ff (patch)
treef1750f647b6b4fc4c9e89b338cbce018a3eeaf74
parentff863a7160da5dcbe8a007847a0d82aabc9580e4 (diff)
downloadpaludis-6c4de368635996faddd354ae8a7e26a0b6a138ff.tar.gz
paludis-6c4de368635996faddd354ae8a7e26a0b6a138ff.tar.xz
Optionally accept ~test keyword in TestEnvironment
-rw-r--r--paludis/environments/test/test_environment.cc25
-rw-r--r--paludis/environments/test/test_environment.hh2
2 files changed, 23 insertions, 4 deletions
diff --git a/paludis/environments/test/test_environment.cc b/paludis/environments/test/test_environment.cc
index 7d93ffc..74ddf01 100644
--- a/paludis/environments/test/test_environment.cc
+++ b/paludis/environments/test/test_environment.cc
@@ -57,12 +57,14 @@ namespace paludis
{
std::unordered_map<std::string, Tribool> override_want_choice_enabled;
FSPath root;
+ bool accept_unstable;
Sets sets;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > preferred_root_key;
std::shared_ptr<LiteralMetadataValueKey<FSPath> > system_root_key;
- Imp(const FSPath & r) :
+ Imp(const FSPath & r, bool au) :
root(r),
+ accept_unstable(au),
preferred_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("root", "Root", mkt_normal, root)),
system_root_key(std::make_shared<LiteralMetadataValueKey<FSPath>>("system_root", "System Root", mkt_normal, FSPath("/")))
{
@@ -71,14 +73,28 @@ namespace paludis
}
TestEnvironment::TestEnvironment() :
- _imp(FSPath("/"))
+ _imp(FSPath("/"), false)
+{
+ add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
+}
+
+TestEnvironment::TestEnvironment(bool au) :
+ _imp(FSPath("/"), au)
{
add_metadata_key(_imp->preferred_root_key);
add_metadata_key(_imp->system_root_key);
}
TestEnvironment::TestEnvironment(const FSPath & r) :
- _imp(r)
+ _imp(r, false)
+{
+ add_metadata_key(_imp->preferred_root_key);
+ add_metadata_key(_imp->system_root_key);
+}
+
+TestEnvironment::TestEnvironment(const FSPath & r, bool au) :
+ _imp(r, au)
{
add_metadata_key(_imp->preferred_root_key);
add_metadata_key(_imp->system_root_key);
@@ -91,7 +107,8 @@ TestEnvironment::~TestEnvironment()
bool
TestEnvironment::accept_keywords(const std::shared_ptr<const KeywordNameSet> & k, const std::shared_ptr<const PackageID> &) const
{
- return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"));
+ return k->end() != k->find(KeywordName("test")) || k->end() != k->find(KeywordName("*"))
+ || (_imp->accept_unstable && k->end() != k->find(KeywordName("~test")));
}
bool
diff --git a/paludis/environments/test/test_environment.hh b/paludis/environments/test/test_environment.hh
index 48c69af..6e6d765 100644
--- a/paludis/environments/test/test_environment.hh
+++ b/paludis/environments/test/test_environment.hh
@@ -54,7 +54,9 @@ namespace paludis
///\{
TestEnvironment();
+ TestEnvironment(bool);
TestEnvironment(const FSPath &);
+ TestEnvironment(const FSPath &, bool);
~TestEnvironment();