aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-20 17:37:55 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-20 17:37:55 +0000
commit0519308d3fd7a06806458547018255a739eed709 (patch)
treec073490c4d6cbd6e7ad16b7a011dc24e7f80c86d
parent4e7ceb0a59da65b76c86974fca27473ff9ee88f4 (diff)
downloadpaludis-0519308d3fd7a06806458547018255a739eed709.tar.gz
paludis-0519308d3fd7a06806458547018255a739eed709.tar.xz
More new query format
-rw-r--r--paludis/repositories/gentoo/portage_repository_sets.cc5
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc3
-rw-r--r--paludis/tasks/find_unused_packages_task.cc4
-rw-r--r--paludis/tasks/install_task.cc6
-rw-r--r--paludis/tasks/report_task.cc3
-rw-r--r--paludis/tasks/uninstall_task.cc7
-rw-r--r--src/clients/adjutrix/keywords_graph.cc4
-rw-r--r--src/clients/contrarius/install.cc4
-rw-r--r--src/clients/contrarius/stage.cc15
-rw-r--r--src/clients/inquisitio/do_search.cc7
-rw-r--r--src/clients/paludis/applets.cc8
-rw-r--r--src/clients/paludis/do_config.cc2
-rw-r--r--src/clients/paludis/do_contents.cc3
-rw-r--r--src/clients/paludis/install.cc3
-rw-r--r--src/output/console_query_task.cc6
15 files changed, 49 insertions, 31 deletions
diff --git a/paludis/repositories/gentoo/portage_repository_sets.cc b/paludis/repositories/gentoo/portage_repository_sets.cc
index dfa8b5d..15abaf4 100644
--- a/paludis/repositories/gentoo/portage_repository_sets.cc
+++ b/paludis/repositories/gentoo/portage_repository_sets.cc
@@ -329,8 +329,9 @@ PortageRepositorySets::security_set(bool insecurity) const
c->repository)->version_metadata(c->name, c->version)->slot);
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> available(
- _imp->environment->package_database()->query(PackageDepAtom(glsa_pkg->name()), is_installable_only,
- qo_order_by_version));
+ _imp->environment->package_database()->query(
+ query::Matches(PackageDepAtom(glsa_pkg->name())) & query::InstalledAtRoot(
+ _imp->environment->root()), qo_order_by_version));
for (PackageDatabaseEntryCollection::ReverseIterator r(available->rbegin()),
r_end(available->rend()) ; r != r_end ; ++r)
{
diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc
index 2abb68b..9115e91 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -24,6 +24,7 @@
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/fast_unique_copy.hh>
#include <paludis/util/log.hh>
+#include <paludis/query.hh>
#include "vr_entry.hh"
using namespace paludis;
@@ -179,7 +180,7 @@ VirtualsRepository::need_entries() const
v(_imp->names.begin()), v_end(_imp->names.end()) ; v != v_end ; ++v)
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> matches(_imp->env->package_database()->query(
- *v->second, is_installable_only, qo_order_by_version));
+ query::Matches(*v->second) & query::RepositoryHasInstallableInterface(), qo_order_by_version));
if (matches->empty())
Log::get_instance()->message(ll_warning, lc_context, "No packages matching '"
diff --git a/paludis/tasks/find_unused_packages_task.cc b/paludis/tasks/find_unused_packages_task.cc
index ec2b4c6..d9cff3f 100644
--- a/paludis/tasks/find_unused_packages_task.cc
+++ b/paludis/tasks/find_unused_packages_task.cc
@@ -21,6 +21,7 @@
#include <paludis/environment.hh>
#include <paludis/repository.hh>
+#include <paludis/query.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/compare.hh>
#include <paludis/util/collection_concrete.hh>
@@ -38,8 +39,7 @@ FindUnusedPackagesTask::execute(const QualifiedPackageName & package)
{
std::tr1::shared_ptr<PackageDatabaseEntryCollection> result(new PackageDatabaseEntryCollection::Concrete);
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> packages(_env->package_database()->query(
- PackageDepAtom(stringify(package) + "::" + stringify(_repo->name())),
- is_installable_only,
+ query::Matches(PackageDepAtom(stringify(package) + "::" + stringify(_repo->name()))),
qo_group_by_slot));
SlotName old_slot("I_am_a_slot");
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 6458480..fc1297c 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -22,6 +22,7 @@
#include <paludis/portage_dep_parser.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/exception.hh>
+#include <paludis/query.hh>
#include <paludis/tasks/exceptions.hh>
#include <list>
@@ -339,9 +340,8 @@ InstallTask::execute()
d_end(dep->destinations->end()) ; d != d_end ; ++d)
if ((*d)->uninstallable_interface)
collision_list = _imp->env->package_database()->query(
- PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)
- + "::" + stringify((*d)->name())),
- is_installed_only, qo_order_by_version);
+ query::Matches(PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)
+ + "::" + stringify((*d)->name()))) & query::RepositoryHasInstalledInterface(), qo_order_by_version);
// don't clean the thing we just installed
PackageDatabaseEntryCollection::Concrete clean_list;
diff --git a/paludis/tasks/report_task.cc b/paludis/tasks/report_task.cc
index eef5797..b2d8b13 100644
--- a/paludis/tasks/report_task.cc
+++ b/paludis/tasks/report_task.cc
@@ -21,6 +21,7 @@
#include <paludis/util/log.hh>
#include <paludis/dep_list/uninstall_list.hh>
#include <paludis/environment.hh>
+#include <paludis/query.hh>
#include <set>
using namespace paludis;
@@ -80,7 +81,7 @@ namespace
VulnerableChecker::visit(const PackageDepAtom * const a)
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> insecure(
- _env.package_database()->query(*a, is_any, qo_order_by_version));
+ _env.package_database()->query(query::Matches(*a), qo_order_by_version));
for (PackageDatabaseEntryCollection::Iterator i(insecure->begin()),
i_end(insecure->end()) ; i != i_end ; ++i)
if (a->tag())
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 4f861c2..387a23d 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -23,6 +23,7 @@
#include <paludis/dep_atom_flattener.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/tasks/exceptions.hh>
+#include <paludis/query.hh>
#include <list>
using namespace paludis;
@@ -206,7 +207,7 @@ UninstallTask::execute()
Context local_context("When looking for target '" + stringify(**t) + "':");
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> r(_imp->env->package_database()->query(
- **t, is_installed_only, qo_order_by_version));
+ query::Matches(**t) & query::RepositoryHasUninstallableInterface(), qo_order_by_version));
if (r->empty())
{
if (! _imp->had_set_targets)
@@ -263,8 +264,8 @@ UninstallTask::execute()
{
bool remove(true);
std::tr1::shared_ptr<PackageDatabaseEntryCollection> installed(
- _imp->env->package_database()->query(PackageDepAtom(i->first),
- is_installed_only, qo_whatever));
+ _imp->env->package_database()->query(query::Matches(PackageDepAtom(i->first)) &
+ query::RepositoryHasInstalledInterface(), qo_whatever));
for (PackageDatabaseEntryCollection::Iterator r(installed->begin()), r_end(installed->end()) ;
r != r_end && remove ; ++r)
if (i->second.end() == i->second.find(r->version))
diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc
index 4a294e6..d0abe33 100644
--- a/src/clients/adjutrix/keywords_graph.cc
+++ b/src/clients/adjutrix/keywords_graph.cc
@@ -24,6 +24,7 @@
#include <paludis/tasks/find_unused_packages_task.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/compare.hh>
+#include <paludis/query.hh>
#include <set>
#include <map>
@@ -63,8 +64,7 @@ namespace
std::tr1::shared_ptr<const VersionSpecCollection> versions(repo.version_specs(package));
FindUnusedPackagesTask task(&e, &repo);
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> packages(e.package_database()->query(
- PackageDepAtom(stringify(package) + "::" + stringify(repo.name())),
- is_installable_only,
+ query::Matches(PackageDepAtom(stringify(package) + "::" + stringify(repo.name()))),
qo_group_by_slot));
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> unused(task.execute(package));
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index dce5d80..0d09fef 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -36,6 +36,7 @@
#include <paludis/util/tokeniser.hh>
#include <paludis/environment/default/default_environment.hh>
#include <paludis/dep_list/exceptions.hh>
+#include <paludis/query.hh>
/** \file
* Handle the --install action for the contrarius program.
@@ -271,7 +272,8 @@ do_install(std::tr1::shared_ptr<const PackageDepAtom> atom)
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> p(
DefaultEnvironment::get_instance()->package_database()->query(
- PackageDepAtom(e.query()), is_installable_only, qo_order_by_version));
+ query::Matches(PackageDepAtom(e.query())) & query::RepositoryHasUninstallableInterface(),
+ qo_order_by_version));
if (p->empty())
{
diff --git a/src/clients/contrarius/stage.cc b/src/clients/contrarius/stage.cc
index c56c30a..64317f1 100644
--- a/src/clients/contrarius/stage.cc
+++ b/src/clients/contrarius/stage.cc
@@ -20,6 +20,7 @@
#include <paludis/environment/default/default_environment.hh>
#include <paludis/environment/default/default_config.hh>
#include <paludis/util/log.hh>
+#include <paludis/query.hh>
#include <string>
#include "stage.hh"
@@ -72,7 +73,8 @@ bool
BinutilsStage::is_rebuild() const
{
return (! DefaultEnvironment::get_instance()->package_database()->query(
- *_options.binutils, is_installed_only, qo_whatever)->empty());
+ query::Matches(*_options.binutils) & query::InstalledAtRoot(DefaultEnvironment::get_instance()->root()),
+ qo_whatever)->empty());
}
int
@@ -93,7 +95,8 @@ bool
KernelHeadersStage::is_rebuild() const
{
return (! DefaultEnvironment::get_instance()->package_database()->query(
- *_options.headers, is_installed_only, qo_whatever)->empty());
+ query::Matches(*_options.headers) & query::InstalledAtRoot(DefaultEnvironment::get_instance()->root()),
+ qo_whatever)->empty());
}
int
@@ -129,7 +132,8 @@ bool
MinimalStage::is_rebuild() const
{
return (! DefaultEnvironment::get_instance()->package_database()->query(
- *_options.gcc, is_installed_only, qo_whatever)->empty());
+ query::Matches(*_options.gcc) & query::InstalledAtRoot(DefaultEnvironment::get_instance()->root()),
+ qo_whatever)->empty());
}
int
@@ -147,7 +151,8 @@ LibCStage::is_rebuild() const
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> c(
DefaultEnvironment::get_instance()->package_database()->query(
- *_options.libc, is_installed_only, qo_whatever));
+ query::Matches(*_options.libc) & query::InstalledAtRoot(DefaultEnvironment::get_instance()->root()),
+ qo_whatever));
if (c->empty())
return false;
@@ -183,7 +188,7 @@ FullStage::is_rebuild() const
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> c(
DefaultEnvironment::get_instance()->package_database()->query(
- *_options.gcc, is_installed_only, qo_whatever));
+ query::Matches(*_options.gcc) & query::InstalledAtRoot(DefaultEnvironment::get_instance()->root()), qo_whatever));
if (c->empty())
return false;
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index 85f8025..8fa6f91 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -24,6 +24,7 @@
#include "query_task.hh"
#include <paludis/environment.hh>
+#include <paludis/query.hh>
#include <list>
#include <set>
#include <iostream>
@@ -90,8 +91,10 @@ do_search(const Environment & env)
p != p_end ; ++p)
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection>
- entries(env.package_database()->query(PackageDepAtom(*p), is_any, qo_order_by_version)),
- preferred_entries(env.package_database()->query(PackageDepAtom(*p), is_installed_only, qo_order_by_version));
+ entries(env.package_database()->query(
+ query::Package(*p), qo_order_by_version)),
+ preferred_entries(env.package_database()->query(query::Package(*p) &
+ query::InstalledAtRoot(env.root()), qo_order_by_version));
if (entries->empty())
continue;
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index 6a9a524..6499563 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -51,7 +51,7 @@ int do_has_version()
std::string query(*CommandLine::get_instance()->begin_parameters());
std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(query));
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> entries(env->package_database()->query(
- *atom, is_installed_only, qo_whatever));
+ query::Matches(*atom) & query::InstalledAtRoot(env->root()), qo_whatever));
if (entries->empty())
return_code = 1;
@@ -69,7 +69,7 @@ int do_best_version()
std::string query(*CommandLine::get_instance()->begin_parameters());
std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(query));
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> entries(env->package_database()->query(
- *atom, is_installed_only, qo_order_by_version));
+ query::Matches(*atom) & query::InstalledAtRoot(env->root()), qo_order_by_version));
/* make built_with_use work for virtuals... icky... */
while (! entries->empty())
@@ -116,10 +116,10 @@ int do_environment_variable()
std::tr1::shared_ptr<PackageDepAtom> atom(new PackageDepAtom(atom_str));
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> entries(env->package_database()->query(
- *atom, is_installed_only, qo_order_by_version));
+ query::Matches(*atom) & query::InstalledAtRoot(env->root()), qo_order_by_version));
if (entries->empty())
- entries = env->package_database()->query(*atom, is_any, qo_order_by_version);
+ entries = env->package_database()->query(query::Matches(*atom), qo_order_by_version);
if (entries->empty())
throw NoSuchPackageError(atom_str);
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index 79b6e2e..0535b41 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -80,7 +80,7 @@ namespace
new PackageDepAtom(target));
std::tr1::shared_ptr<const PackageDatabaseEntryCollection>
- entries(env->package_database()->query(*atom, is_installed_only, qo_order_by_version));
+ entries(env->package_database()->query(query::Matches(*atom) & query::InstalledAtRoot(env->root()), qo_order_by_version));
if (entries->empty())
throw NoSuchPackageError(target);
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index 09488f3..6810d7b 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -105,7 +105,8 @@ do_one_contents(
new PackageDepAtom(q));
std::tr1::shared_ptr<const PackageDatabaseEntryCollection>
- entries(env->package_database()->query(*atom, is_installed_only, qo_order_by_version));
+ entries(env->package_database()->query(query::Matches(*atom) & query::InstalledAtRoot(
+ env->root()), qo_order_by_version));
if (entries->empty())
throw NoSuchPackageError(q);
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 0272536..f5f00b2 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -576,7 +576,8 @@ do_install()
{
std::tr1::shared_ptr<const PackageDatabaseEntryCollection> p(
DefaultEnvironment::get_instance()->package_database()->query(
- PackageDepAtom(e.query()), is_installable_only, qo_order_by_version));
+ query::Matches(PackageDepAtom(e.query())) & query::RepositoryHasInstalledInterface(),
+ qo_order_by_version));
if (p->empty())
{
cout << endl;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 98a1e82..65cbe33 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -22,6 +22,7 @@
#include "use_flag_pretty_printer.hh"
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/query.hh>
#include <list>
using namespace paludis;
@@ -56,8 +57,9 @@ ConsoleQueryTask::show(const PackageDepAtom & a, const PackageDatabaseEntry * di
/* prefer the best installed version, then the best visible version, then
* the best version */
std::tr1::shared_ptr<const PackageDatabaseEntryCollection>
- entries(_imp->env->package_database()->query(a, is_any, qo_order_by_version)),
- preferred_entries(_imp->env->package_database()->query(a, is_installed_only, qo_order_by_version));
+ entries(_imp->env->package_database()->query(query::Matches(a), qo_order_by_version)),
+ preferred_entries(_imp->env->package_database()->query(
+ query::Matches(a) & query::InstalledAtRoot(_imp->env->root()), qo_order_by_version));
if (entries->empty())
throw NoSuchPackageError(stringify(a));
if (preferred_entries->empty())