aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-01 19:25:04 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-08-03 12:19:12 +0100
commitd890f35932ee517f541bd0273dca7281bcb8483d (patch)
treef72f7a9939235259d5132ae8e4b64b9f5bdad4dc
parentc929ffe552fec9262a6afa392bdf19c46ada9c00 (diff)
downloadpaludis-d890f35932ee517f541bd0273dca7281bcb8483d.tar.gz
paludis-d890f35932ee517f541bd0273dca7281bcb8483d.tar.xz
More filters
-rw-r--r--paludis/filter-fwd.hh5
-rw-r--r--paludis/filter.cc25
-rw-r--r--paludis/filter.hh28
3 files changed, 51 insertions, 7 deletions
diff --git a/paludis/filter-fwd.hh b/paludis/filter-fwd.hh
index 84bed5b..d68dffe 100644
--- a/paludis/filter-fwd.hh
+++ b/paludis/filter-fwd.hh
@@ -38,10 +38,13 @@ namespace paludis
class All;
template <typename> class SupportsAction;
class NotMasked;
- class InstalledAtRoot;
class And;
class Slot;
class Matches;
+
+ class InstalledAtRoot;
+ class InstalledAtSlash;
+ class InstalledAtNotSlash;
}
/**
diff --git a/paludis/filter.cc b/paludis/filter.cc
index 1ef209f..87e515b 100644
--- a/paludis/filter.cc
+++ b/paludis/filter.cc
@@ -204,13 +204,15 @@ namespace
}
};
- struct InstalledAtRootFilterHandler :
+ struct InstalledAtFilterHandler :
AllFilterHandlerBase
{
const FSEntry root;
+ const bool equal;
- InstalledAtRootFilterHandler(const FSEntry & r) :
- root(r)
+ InstalledAtFilterHandler(const FSEntry & r, const bool e) :
+ root(r),
+ equal(e)
{
}
@@ -224,12 +226,13 @@ namespace
r != r_end ; ++r)
{
const std::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(*r));
- if (repo->installed_root_key() && root == repo->installed_root_key()->value())
+ if (equal == (repo->installed_root_key() && root == repo->installed_root_key()->value()))
result->insert(*r);
}
return result;
}
+
virtual std::shared_ptr<const PackageIDSet> ids(
const Environment * const,
const std::shared_ptr<const PackageIDSet> & id) const
@@ -245,7 +248,7 @@ namespace
virtual std::string as_string() const
{
- return "installed at root " + stringify(root);
+ return "installed " + std::string(equal ? "" : "not ") + "at root " + stringify(root);
}
};
@@ -443,7 +446,17 @@ filter::NotMasked::NotMasked() :
}
filter::InstalledAtRoot::InstalledAtRoot(const FSEntry & r) :
- Filter(std::make_shared<InstalledAtRootFilterHandler>(r))
+ Filter(std::make_shared<InstalledAtFilterHandler>(r, true))
+{
+}
+
+filter::InstalledAtSlash::InstalledAtSlash() :
+ Filter(std::make_shared<InstalledAtFilterHandler>(FSEntry("/"), true))
+{
+}
+
+filter::InstalledAtNotSlash::InstalledAtNotSlash() :
+ Filter(std::make_shared<InstalledAtFilterHandler>(FSEntry("/"), false))
{
}
diff --git a/paludis/filter.hh b/paludis/filter.hh
index 5564164..34d4f87 100644
--- a/paludis/filter.hh
+++ b/paludis/filter.hh
@@ -171,6 +171,34 @@ namespace paludis
};
/**
+ * A Filter which accepts only PackageID instances that are installed to
+ * the / fs.
+ *
+ * \ingroup g_selections
+ * \since 0.51
+ */
+ class PALUDIS_VISIBLE InstalledAtSlash :
+ public Filter
+ {
+ public:
+ InstalledAtSlash();
+ };
+
+ /**
+ * A Filter which accepts only PackageID instances that are installed to
+ * an fs other than /.
+ *
+ * \ingroup g_selections
+ * \since 0.51
+ */
+ class PALUDIS_VISIBLE InstalledAtNotSlash :
+ public Filter
+ {
+ public:
+ InstalledAtNotSlash();
+ };
+
+ /**
* A Filter which accepts only PackageID instances that are accepted by
* two different filters.
*