aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-13 16:54:47 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-07-13 16:57:08 +0100
commit8d35eb9f91a617d6b0ebf487fe45d277e45e0d53 (patch)
treeea61dbe3c8c9679e334f3df93d1efd3e9e60ccf6
parentb55f8208939c94c4cb723a151061ca09dc7ea7c4 (diff)
downloadpaludis-8d35eb9f91a617d6b0ebf487fe45d277e45e0d53.tar.gz
paludis-8d35eb9f91a617d6b0ebf487fe45d277e45e0d53.tar.xz
Let FakePackageID be masked.
-rw-r--r--paludis/repositories/fake/fake_package_id.cc37
-rw-r--r--paludis/repositories/fake/fake_package_id.hh14
2 files changed, 51 insertions, 0 deletions
diff --git a/paludis/repositories/fake/fake_package_id.cc b/paludis/repositories/fake/fake_package_id.cc
index e6abafb..0b2d792 100644
--- a/paludis/repositories/fake/fake_package_id.cc
+++ b/paludis/repositories/fake/fake_package_id.cc
@@ -350,6 +350,32 @@ FakeUnacceptedMask::unaccepted_key() const
return _imp->unaccepted_key;
}
+FakeUnsupportedMask::FakeUnsupportedMask()
+{
+}
+
+FakeUnsupportedMask::~FakeUnsupportedMask()
+{
+}
+
+char
+FakeUnsupportedMask::key() const
+{
+ return 'E';
+}
+
+const std::string
+FakeUnsupportedMask::description() const
+{
+ return "Unsupported";
+}
+
+const std::string
+FakeUnsupportedMask::explanation() const
+{
+ return "Marked as unsupported";
+}
+
namespace paludis
{
using namespace std::tr1::placeholders;
@@ -384,6 +410,7 @@ namespace paludis
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<FetchableURISpecTree> > src_uri;
std::tr1::shared_ptr<FakeMetadataSpecTreeKey<SimpleURISpecTree> > homepage;
+ std::tr1::shared_ptr<Mask> unsupported_mask;
mutable bool has_masks;
Implementation(const Environment * const e, const std::tr1::shared_ptr<const FakeRepositoryBase> & r,
@@ -825,6 +852,9 @@ FakePackageID::need_masks_added() const
std::tr1::shared_ptr<const Mask> breaks_mask(_imp->env->mask_for_breakage(*this));
if (breaks_mask)
add_mask(breaks_mask);
+
+ if (_imp->unsupported_mask)
+ add_mask(_imp->unsupported_mask);
}
void
@@ -839,6 +869,13 @@ FakePackageID::invalidate_masks() const
PackageID::invalidate_masks();
}
+void
+FakePackageID::make_unsupported()
+{
+ invalidate_masks();
+ _imp->unsupported_mask.reset(new FakeUnsupportedMask);
+}
+
namespace
{
struct PerformAction :
diff --git a/paludis/repositories/fake/fake_package_id.hh b/paludis/repositories/fake/fake_package_id.hh
index 95d513e..a709408 100644
--- a/paludis/repositories/fake/fake_package_id.hh
+++ b/paludis/repositories/fake/fake_package_id.hh
@@ -177,6 +177,18 @@ namespace paludis
const std::tr1::shared_ptr<const MetadataKey> unaccepted_key() const;
};
+ class PALUDIS_VISIBLE FakeUnsupportedMask :
+ public UnsupportedMask
+ {
+ public:
+ FakeUnsupportedMask();
+ ~FakeUnsupportedMask();
+
+ char key() const;
+ const std::string description() const;
+ const std::string explanation() const;
+ };
+
/**
* A PackageID in a FakeRepository or a FakeInstalledRepository.
*
@@ -269,6 +281,8 @@ namespace paludis
virtual void invalidate_masks() const;
+ void make_unsupported();
+
};
}