aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-01 18:38:33 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-01 18:38:33 +0000
commitc4e44dcc589a7640a949d2e804ae46e220c8b471 (patch)
tree810106f05be269740c9c124ad1db11c3023fd313
parent98e9406026a1a688bd1d06a2ea87e0ff0b58214b (diff)
downloadpaludis-c4e44dcc589a7640a949d2e804ae46e220c8b471.tar.gz
paludis-c4e44dcc589a7640a949d2e804ae46e220c8b471.tar.xz
Various interface tidyups
-rw-r--r--paludis/dep_list/dep_list.cc2
-rw-r--r--paludis/environment.hh10
-rw-r--r--paludis/environment/default/default_environment.cc4
-rw-r--r--paludis/package_database.cc68
-rw-r--r--paludis/package_database.hh25
-rw-r--r--paludis/package_database_TEST.cc12
-rw-r--r--paludis/qa/deps_exist_check.cc5
-rw-r--r--paludis/repositories/portage/portage_repository.cc3
-rw-r--r--paludis/repositories/portage/portage_repository_news.cc3
-rw-r--r--paludis/repositories/portage/portage_repository_sets.cc9
-rw-r--r--paludis/repositories/virtuals/virtuals_repository.cc4
-rw-r--r--paludis/repositories/virtuals/vr_entry.hh3
-rw-r--r--paludis/tasks/install_task.cc4
-rw-r--r--paludis/tasks/uninstall_task.cc2
-rw-r--r--ruby/package_database.cc18
-rw-r--r--ruby/package_database_TEST.rb5
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc4
-rw-r--r--src/clients/contrarius/install.cc4
-rw-r--r--src/clients/contrarius/stage.cc15
-rw-r--r--src/clients/gtkpaludis/package_overview.cc4
-rw-r--r--src/clients/gtkpaludis/packages_list.cc4
-rw-r--r--src/clients/gtkpaludis/queue_list.cc8
-rw-r--r--src/clients/paludis/applets.cc8
-rw-r--r--src/clients/paludis/do_contents.cc2
-rw-r--r--src/clients/paludis/install.cc3
-rw-r--r--src/clients/paludis/query.cc4
-rw-r--r--src/output/console_install_task.cc6
27 files changed, 114 insertions, 125 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index eac9692..5f6a5e6 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -450,7 +450,7 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
if (already_installed->empty() || ! can_fall_back)
{
if (a->use_requirements_ptr() && d->_imp->env->package_database()->query(
- a->without_use_requirements(), is_any))
+ *a->without_use_requirements(), is_any))
throw UseRequirementsNotMetError(stringify(*a));
else
throw AllMaskedError(stringify(*a));
diff --git a/paludis/environment.hh b/paludis/environment.hh
index 16d88ed..2304fc9 100644
--- a/paludis/environment.hh
+++ b/paludis/environment.hh
@@ -180,7 +180,15 @@ namespace paludis
/**
* Fetch our package database.
*/
- PackageDatabase::Pointer package_database() const
+ PackageDatabase::ConstPointer package_database() const
+ {
+ return _package_database;
+ }
+
+ /**
+ * Fetch our package database.
+ */
+ PackageDatabase::Pointer package_database()
{
return _package_database;
}
diff --git a/paludis/environment/default/default_environment.cc b/paludis/environment/default/default_environment.cc
index 4ebab09..fb0f3a4 100644
--- a/paludis/environment/default/default_environment.cc
+++ b/paludis/environment/default/default_environment.cc
@@ -491,9 +491,7 @@ DefaultEnvironment::local_package_set(const SetName & s) const
{
PackageDepAtom::Pointer p(new PackageDepAtom(tokens.at(1)));
p->set_tag(tag);
- if (! package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
- is_installed_only)->empty())
+ if (! package_database()->query(PackageDepAtom(p->package()), is_installed_only)->empty())
result->add_child(p);
}
else
diff --git a/paludis/package_database.cc b/paludis/package_database.cc
index 3b2bb42..943c5de 100644
--- a/paludis/package_database.cc
+++ b/paludis/package_database.cc
@@ -141,7 +141,7 @@ namespace paludis
/**
* Our Repository instances.
*/
- std::list<Repository::ConstPointer> repositories;
+ std::list<Repository::Pointer> repositories;
/// Our environment.
const Environment * environment;
@@ -159,11 +159,11 @@ PackageDatabase::~PackageDatabase()
}
void
-PackageDatabase::add_repository(const Repository::ConstPointer r)
+PackageDatabase::add_repository(const Repository::Pointer r)
{
Context c("When adding a repository named '" + stringify(r->name()) + "':");
- IndirectIterator<std::list<Repository::ConstPointer>::const_iterator, const Repository>
+ IndirectIterator<std::list<Repository::Pointer>::const_iterator, const Repository>
r_c(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r_c != r_end ; ++r_c)
@@ -181,7 +181,7 @@ PackageDatabase::fetch_unique_qualified_package_name(
QualifiedPackageNameCollection::Pointer result(new QualifiedPackageNameCollection::Concrete);
- IndirectIterator<std::list<Repository::ConstPointer>::const_iterator, const Repository>
+ IndirectIterator<std::list<Repository::Pointer>::const_iterator, const Repository>
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
@@ -203,11 +203,11 @@ PackageDatabase::fetch_unique_qualified_package_name(
}
PackageDatabaseEntryCollection::Pointer
-PackageDatabase::_do_query(const PackageDepAtom & a, const InstallState installed_state) const
+PackageDatabase::query(const PackageDepAtom & a, const InstallState installed_state) const
{
PackageDatabaseEntryCollection::Concrete::Pointer result(new PackageDatabaseEntryCollection::Concrete);
- IndirectIterator<std::list<Repository::ConstPointer>::const_iterator, const Repository>
+ IndirectIterator<std::list<Repository::Pointer>::const_iterator, const Repository>
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
@@ -235,16 +235,23 @@ PackageDatabase::_do_query(const PackageDepAtom & a, const InstallState installe
return result;
}
-PackageDatabaseEntryCollection::Pointer
-PackageDatabase::query(const PackageDepAtom & a, const InstallState s) const
+Repository::ConstPointer
+PackageDatabase::fetch_repository(const RepositoryName & n) const
{
- return _do_query(a, s);
+ std::list<Repository::Pointer>::const_iterator
+ r(_imp->repositories.begin()),
+ r_end(_imp->repositories.end());
+ for ( ; r != r_end ; ++r)
+ if ((*r)->name() == n)
+ return *r;
+
+ throw NoSuchRepositoryError(stringify(n));
}
-Repository::ConstPointer
-PackageDatabase::fetch_repository(const RepositoryName & n) const
+Repository::Pointer
+PackageDatabase::fetch_repository(const RepositoryName & n)
{
- std::list<Repository::ConstPointer>::const_iterator
+ std::list<Repository::Pointer>::const_iterator
r(_imp->repositories.begin()),
r_end(_imp->repositories.end());
for ( ; r != r_end ; ++r)
@@ -265,20 +272,25 @@ PackageDatabase::favourite_repository() const
return RepositoryName("unnamed");
}
-const RepositoryName &
-PackageDatabase::better_repository(const RepositoryName & r1,
- const RepositoryName & r2) const
+bool
+PackageDatabase::more_important_than(const RepositoryName & lhs,
+ const RepositoryName & rhs) const
{
- IndirectIterator<std::list<Repository::ConstPointer>::const_iterator, const Repository>
- r(_imp->repositories.begin()),
- r_end(_imp->repositories.end());
- for ( ; r != r_end ; ++r)
- {
- if (r->name() == r1)
- return r2;
- else if (r->name() == r2)
- return r1;
- }
+ std::map<std::string, int> rank;
+ int x(0);
+ for (PackageDatabase::RepositoryIterator r(begin_repositories()), r_end(end_repositories()) ;
+ r != r_end ; ++r)
+ rank.insert(std::make_pair(stringify((*r)->name()), ++x));
+
+ std::map<std::string, int>::const_iterator l(rank.find(stringify(lhs)));
+ if (l == rank.end())
+ throw InternalError(PALUDIS_HERE, "lhs.repository '" + stringify(lhs) + "' not in rank");
+
+ std::map<std::string, int>::const_iterator r(rank.find(stringify(rhs)));
+ if (r == rank.end())
+ throw InternalError(PALUDIS_HERE, "rhs.repository '" + stringify(rhs) + "' not in rank");
+
+ return l->second > r->second;
throw InternalError(PALUDIS_HERE, "better_repository called on non-owned repositories");
}
@@ -348,12 +360,6 @@ PackageDatabase::_sort_package_database_entry_collection(PackageDatabaseEntryCol
p.sort(PDEComparator(this));
}
-PackageDatabaseEntryCollection::Pointer
-PackageDatabase::query(PackageDepAtom::ConstPointer a, const InstallState s) const
-{
- return _do_query(*a.raw_pointer(), s);
-}
-
PackageDatabase::RepositoryIterator
PackageDatabase::begin_repositories() const
{
diff --git a/paludis/package_database.hh b/paludis/package_database.hh
index 7f68fac..b3cee9b 100644
--- a/paludis/package_database.hh
+++ b/paludis/package_database.hh
@@ -220,9 +220,6 @@ namespace paludis
public InternalCounted<PackageDatabase>
{
private:
- PackageDatabaseEntryCollection::Pointer _do_query(
- const PackageDepAtom & a, const InstallState) const;
-
void _sort_package_database_entry_collection(
PackageDatabaseEntryCollection::Concrete &) const;
@@ -244,7 +241,7 @@ namespace paludis
* same name as the new Repository already exists in our
* collection.
*/
- void add_repository(Repository::ConstPointer);
+ void add_repository(Repository::Pointer);
/**
* Fetch a named repository.
@@ -252,6 +249,11 @@ namespace paludis
Repository::ConstPointer fetch_repository(const RepositoryName &) const;
/**
+ * Fetch a named repository.
+ */
+ Repository::Pointer fetch_repository(const RepositoryName &);
+
+ /**
* Fetch the name of our 'favourite' repository (if a repository's
* name matches this when doing a graphical display, the repository
* name part may be omitted).
@@ -275,23 +277,14 @@ namespace paludis
const InstallState) const;
/**
- * Query the repository (overload for a CountedPtr)
- */
- PackageDatabaseEntryCollection::Pointer query(
- PackageDepAtom::ConstPointer a,
- const InstallState) const;
-
- /**
- * Which repository is better?
+ * Return true if the first repository is more important than the second.
*/
- const RepositoryName & better_repository(const RepositoryName &,
- const RepositoryName &) const;
+ bool more_important_than(const RepositoryName &, const RepositoryName &) const;
///\name Iterate over our repositories
///\{
- typedef libwrapiter::ForwardIterator<PackageDatabase,
- const Repository::ConstPointer> RepositoryIterator;
+ typedef libwrapiter::ForwardIterator<PackageDatabase, const Repository::Pointer> RepositoryIterator;
RepositoryIterator begin_repositories() const;
diff --git a/paludis/package_database_TEST.cc b/paludis/package_database_TEST.cc
index 142a9b8..7c552d7 100644
--- a/paludis/package_database_TEST.cc
+++ b/paludis/package_database_TEST.cc
@@ -78,14 +78,10 @@ namespace test_cases
TEST_CHECK_EQUAL(p.fetch_repository(RepositoryName("repo2"))->name(),
RepositoryName("repo2"));
- TEST_CHECK_EQUAL(p.better_repository(RepositoryName("repo1"), RepositoryName("repo2")),
- RepositoryName("repo2"));
- TEST_CHECK_EQUAL(p.better_repository(RepositoryName("repo2"), RepositoryName("repo1")),
- RepositoryName("repo2"));
- TEST_CHECK_EQUAL(p.better_repository(RepositoryName("repo2"), RepositoryName("repo2")),
- RepositoryName("repo2"));
- TEST_CHECK_EQUAL(p.better_repository(RepositoryName("repo1"), RepositoryName("repo1")),
- RepositoryName("repo1"));
+ TEST_CHECK(! p.more_important_than(RepositoryName("repo1"), RepositoryName("repo2")));
+ TEST_CHECK(p.more_important_than(RepositoryName("repo2"), RepositoryName("repo1")));
+ TEST_CHECK(! p.more_important_than(RepositoryName("repo2"), RepositoryName("repo2")));
+ TEST_CHECK(! p.more_important_than(RepositoryName("repo1"), RepositoryName("repo1")));
}
} package_database_repository_test;
diff --git a/paludis/qa/deps_exist_check.cc b/paludis/qa/deps_exist_check.cc
index 4bc034e..d453cb1 100644
--- a/paludis/qa/deps_exist_check.cc
+++ b/paludis/qa/deps_exist_check.cc
@@ -47,8 +47,7 @@ namespace
void visit(const PackageDepAtom * const p)
{
- if (env->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(p->package())), is_any)->empty())
+ if (env->package_database()->query(PackageDepAtom(p->package()), is_any)->empty())
{
if (in_any)
result << Message(qal_maybe, "No match for " + role + " entry '"
@@ -78,7 +77,7 @@ namespace
void visit(const BlockDepAtom * const b)
{
- if (env->package_database()->query(b->blocked_atom(), is_any)->empty())
+ if (env->package_database()->query(*b->blocked_atom(), is_any)->empty())
result << Message(qal_maybe, "No match for " + role + " block '!"
+ stringify(*b->blocked_atom()) + "'");
}
diff --git a/paludis/repositories/portage/portage_repository.cc b/paludis/repositories/portage/portage_repository.cc
index 272868e..4e1177f 100644
--- a/paludis/repositories/portage/portage_repository.cc
+++ b/paludis/repositories/portage/portage_repository.cc
@@ -857,8 +857,7 @@ PortageRepository::info(bool verbose) const
i_end(info_pkgs.end()) ; i != i_end ; ++i)
{
PackageDatabaseEntryCollection::ConstPointer q(
- _imp->params.environment->package_database()->query(
- PackageDepAtom::ConstPointer(new PackageDepAtom(*i)), is_installed_only));
+ _imp->params.environment->package_database()->query(PackageDepAtom(*i), is_installed_only));
if (q->empty())
package_info->add_kv(*i, "(none)");
else
diff --git a/paludis/repositories/portage/portage_repository_news.cc b/paludis/repositories/portage/portage_repository_news.cc
index 8936219..6c21b75 100644
--- a/paludis/repositories/portage/portage_repository_news.cc
+++ b/paludis/repositories/portage/portage_repository_news.cc
@@ -118,8 +118,7 @@ PortageRepositoryNews::update_news() const
bool local_show(false);
for (NewsFile::DisplayIfInstalledIterator i(news.begin_display_if_installed()),
i_end(news.end_display_if_installed()) ; i != i_end ; ++i)
- if (! _imp->environment->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(*i)), is_installed_only)->empty())
+ if (! _imp->environment->package_database()->query(PackageDepAtom(*i), is_installed_only)->empty())
local_show = true;
show &= local_show;
}
diff --git a/paludis/repositories/portage/portage_repository_sets.cc b/paludis/repositories/portage/portage_repository_sets.cc
index 8d28aad..bf5f9f6 100644
--- a/paludis/repositories/portage/portage_repository_sets.cc
+++ b/paludis/repositories/portage/portage_repository_sets.cc
@@ -121,8 +121,7 @@ PortageRepositorySets::package_set(const SetName & s) const
{
PackageDepAtom::Pointer p(new PackageDepAtom(tokens.at(1)));
p->set_tag(tag);
- if (! _imp->environment->package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
+ if (! _imp->environment->package_database()->query(PackageDepAtom(p->package()),
is_installed_only)->empty())
result->add_child(p);
}
@@ -296,8 +295,7 @@ PortageRepositorySets::security_set(bool insecurity) const
glsa_pkg_end(glsa->end_packages()) ; glsa_pkg != glsa_pkg_end ; ++glsa_pkg)
{
PackageDatabaseEntryCollection::ConstPointer candidates(_imp->environment->package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(stringify(glsa_pkg->name()))),
- insecurity ? is_any : is_installed_only));
+ PackageDepAtom(glsa_pkg->name()), insecurity ? is_any : is_installed_only));
for (PackageDatabaseEntryCollection::Iterator c(candidates->begin()), c_end(candidates->end()) ;
c != c_end ; ++c)
{
@@ -325,8 +323,7 @@ PortageRepositorySets::security_set(bool insecurity) const
c->repository)->version_metadata(c->name, c->version)->slot);
PackageDatabaseEntryCollection::ConstPointer available(
- _imp->environment->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(stringify(glsa_pkg->name()))), is_installable_only));
+ _imp->environment->package_database()->query(PackageDepAtom(glsa_pkg->name()), is_installable_only));
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 bc198f6..c984602 100644
--- a/paludis/repositories/virtuals/virtuals_repository.cc
+++ b/paludis/repositories/virtuals/virtuals_repository.cc
@@ -171,8 +171,8 @@ VirtualsRepository::need_entries() const
for (std::vector<std::pair<QualifiedPackageName, PackageDepAtom::ConstPointer> >::const_iterator
v(_imp->names.begin()), v_end(_imp->names.end()) ; v != v_end ; ++v)
{
- PackageDatabaseEntryCollection::ConstPointer matches(_imp->env->package_database()->query(v->second,
- is_installable_only));
+ PackageDatabaseEntryCollection::ConstPointer matches(_imp->env->package_database()->query(
+ *v->second, is_installable_only));
if (matches->empty())
Log::get_instance()->message(ll_warning, lc_context, "No packages matching '"
diff --git a/paludis/repositories/virtuals/vr_entry.hh b/paludis/repositories/virtuals/vr_entry.hh
index 90251e9..1e08837 100644
--- a/paludis/repositories/virtuals/vr_entry.hh
+++ b/paludis/repositories/virtuals/vr_entry.hh
@@ -69,8 +69,7 @@ namespace paludis
if (a.provided_by_repository != b.provided_by_repository)
{
// not a bug
- if (a.provided_by_repository == db->better_repository(a.provided_by_repository,
- b.provided_by_repository))
+ if (db->more_important_than(a.provided_by_repository, b.provided_by_repository))
return true;
return false;
}
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 932d2ea..64747d0 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -296,9 +296,7 @@ InstallTask::execute()
// look for packages with the same name in the same slot
PackageDatabaseEntryCollection::Pointer collision_list(_imp->env->package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(
- stringify(dep->package.name) + ":" +
- stringify(dep->metadata->slot))),
+ PackageDepAtom(stringify(dep->package.name) + ":" + stringify(dep->metadata->slot)),
is_installed_only));
// don't clean the thing we just installed
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 9537c96..92378c8 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -152,7 +152,7 @@ UninstallTask::execute()
Context local_context("When looking for target '" + stringify(**t) + "':");
PackageDatabaseEntryCollection::ConstPointer r(_imp->env->package_database()->query(
- *t, is_installed_only));
+ **t, is_installed_only));
if (r->empty())
throw NoSuchPackageError(stringify(**t));
else if (next(r->begin()) != r->end())
diff --git a/ruby/package_database.cc b/ruby/package_database.cc
index 88f0e14..8f58b77 100644
--- a/ruby/package_database.cc
+++ b/ruby/package_database.cc
@@ -90,7 +90,7 @@ namespace
Data_Get_Struct(self, PackageDatabase::Pointer, self_ptr);
PackageDatabaseEntryCollection::ConstPointer items((*self_ptr)->query(
- value_to_package_dep_atom(atom),
+ *value_to_package_dep_atom(atom),
static_cast<InstallState>(NUM2INT(state))));
VALUE result(rb_ary_new());
@@ -156,22 +156,20 @@ namespace
/*
* call-seq:
- * better_repository(repository_name_a, repository_name_b) -> String
+ * more_important_than(repository_name_a, repository_name_b) -> bool
*
- * Which repository is better?
+ * True if repository_name_a is more important than repository_name_b .
*/
VALUE
- package_database_better_repository(VALUE self, VALUE name1, VALUE name2)
+ package_database_more_important_than(VALUE self, VALUE name1, VALUE name2)
{
try
{
PackageDatabase::Pointer * self_ptr;
Data_Get_Struct(self, PackageDatabase::Pointer, self_ptr);
- return rb_str_new2(stringify((*self_ptr)->better_repository(
- RepositoryName(StringValuePtr(name1)),
- RepositoryName(StringValuePtr(name2))
- )).c_str());
+ return (*self_ptr)->more_important_than(RepositoryName(StringValuePtr(name1)),
+ RepositoryName(StringValuePtr(name2))) ? Qtrue : Qfalse;
}
catch (const std::exception & e)
{
@@ -197,8 +195,8 @@ namespace
RUBY_FUNC_CAST(&package_database_repositories), 0);
rb_define_method(c_package_database, "fetch_repository",
RUBY_FUNC_CAST(&package_database_fetch_repository), 1);
- rb_define_method(c_package_database, "better_repository",
- RUBY_FUNC_CAST(&package_database_better_repository), 2);
+ rb_define_method(c_package_database, "more_important_than",
+ RUBY_FUNC_CAST(&package_database_more_important_than), 2);
/*
* Document-module: Paludis::InstallState
*
diff --git a/ruby/package_database_TEST.rb b/ruby/package_database_TEST.rb
index daa92fe..183ffe0 100644
--- a/ruby/package_database_TEST.rb
+++ b/ruby/package_database_TEST.rb
@@ -120,8 +120,9 @@ module Paludis
end
end
- def test_better_repository
- assert_equal 'testrepo', db.better_repository('testrepo', 'virtuals')
+ def test_more_important_than
+ assert db.more_important_than('testrepo', 'virtuals')
+ assert ! db.more_important_than('virtuals', 'testrepo')
end
end
end
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index 13b35cf..64ea746 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -181,7 +181,7 @@ namespace
Context context("When checking package '" + stringify(p) + "':");
PackageDatabaseEntryCollection::Pointer p_entries(env.package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(stringify(p))), is_any));
+ PackageDepAtom(p), is_any));
bool found_matches(false);
@@ -241,7 +241,7 @@ int do_find_reverse_deps(NoConfigEnvironment & env)
return 4;
}
- PackageDatabaseEntryCollection::Pointer entries(env.package_database()->query(atom, is_any));
+ PackageDatabaseEntryCollection::Pointer entries(env.package_database()->query(*atom, is_any));
int ret(0);
if (entries->empty())
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 42c5e03..df4747c 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -266,8 +266,8 @@ do_install(PackageDepAtom::ConstPointer atom)
{
PackageDatabaseEntryCollection::ConstPointer p(
DefaultEnvironment::get_instance()->package_database()->query(
- PackageDepAtom::ConstPointer(new PackageDepAtom(e.query())),
- is_installable_only));
+ PackageDepAtom(e.query()), is_installable_only));
+
if (p->empty())
{
cout << endl;
diff --git a/src/clients/contrarius/stage.cc b/src/clients/contrarius/stage.cc
index fe5e5fe..1a4d05c 100644
--- a/src/clients/contrarius/stage.cc
+++ b/src/clients/contrarius/stage.cc
@@ -71,7 +71,8 @@ BinutilsStage::build(const StageOptions &) const
bool
BinutilsStage::is_rebuild() const
{
- return (! DefaultEnvironment::get_instance()->package_database()->query(_options.binutils, is_installed_only)->empty());
+ return (! DefaultEnvironment::get_instance()->package_database()->query(
+ *_options.binutils, is_installed_only)->empty());
}
int
@@ -91,7 +92,8 @@ KernelHeadersStage::build(const StageOptions &) const
bool
KernelHeadersStage::is_rebuild() const
{
- return (! DefaultEnvironment::get_instance()->package_database()->query(_options.headers, is_installed_only)->empty());
+ return (! DefaultEnvironment::get_instance()->package_database()->query(
+ *_options.headers, is_installed_only)->empty());
}
int
@@ -126,8 +128,8 @@ MinimalStage::build(const StageOptions &) const
bool
MinimalStage::is_rebuild() const
{
- return (! DefaultEnvironment::get_instance()->package_database()
- ->query(_options.gcc, is_installed_only)->empty());
+ return (! DefaultEnvironment::get_instance()->package_database()->query(
+ *_options.gcc, is_installed_only)->empty());
}
int
@@ -144,7 +146,8 @@ bool
LibCStage::is_rebuild() const
{
PackageDatabaseEntryCollection::ConstPointer c(
- DefaultEnvironment::get_instance()->package_database()->query(_options.libc, is_installed_only));
+ DefaultEnvironment::get_instance()->package_database()->query(
+ *_options.libc, is_installed_only));
if (c->empty())
return false;
@@ -179,7 +182,7 @@ bool
FullStage::is_rebuild() const
{
PackageDatabaseEntryCollection::ConstPointer c(
- DefaultEnvironment::get_instance()->package_database()->query(_options.gcc, is_installed_only));
+ DefaultEnvironment::get_instance()->package_database()->query(*_options.gcc, is_installed_only));
if (c->empty())
return false;
diff --git a/src/clients/gtkpaludis/package_overview.cc b/src/clients/gtkpaludis/package_overview.cc
index 4d66b51..ce0ee0e 100644
--- a/src/clients/gtkpaludis/package_overview.cc
+++ b/src/clients/gtkpaludis/package_overview.cc
@@ -167,8 +167,8 @@ namespace
PackageDepAtom::Pointer atom(new PackageDepAtom(stringify(_pkg)));
PackageDatabaseEntryCollection::ConstPointer
- entries(DefaultEnvironment::get_instance()->package_database()->query(atom, is_any)),
- preferred_entries(DefaultEnvironment::get_instance()->package_database()->query(atom, is_installed_only));
+ entries(DefaultEnvironment::get_instance()->package_database()->query(*atom, is_any)),
+ preferred_entries(DefaultEnvironment::get_instance()->package_database()->query(*atom, is_installed_only));
if (preferred_entries->empty())
preferred_entries = entries;
diff --git a/src/clients/gtkpaludis/packages_list.cc b/src/clients/gtkpaludis/packages_list.cc
index 99db010..35f0d3f 100644
--- a/src/clients/gtkpaludis/packages_list.cc
+++ b/src/clients/gtkpaludis/packages_list.cc
@@ -160,12 +160,12 @@ namespace
bool is_installed(true);
PackageDatabaseEntryCollection::ConstPointer results(DefaultEnvironment::get_instance()->package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(stringify(i->first))), is_installed_only));
+ PackageDepAtom(i->first), is_installed_only));
if (results->empty())
{
is_installed = false;
results = DefaultEnvironment::get_instance()->package_database()->query(
- PackageDepAtom::Pointer(new PackageDepAtom(stringify(i->first))), is_any);
+ PackageDepAtom(i->first), is_any);
}
if (results->empty())
continue;
diff --git a/src/clients/gtkpaludis/queue_list.cc b/src/clients/gtkpaludis/queue_list.cc
index 26df2d9..950432d 100644
--- a/src/clients/gtkpaludis/queue_list.cc
+++ b/src/clients/gtkpaludis/queue_list.cc
@@ -337,8 +337,7 @@ QueueList::Populate::display_entry(const paludis::DepListEntry & e)
row[_q->_imp->columns.col_left] = left;
PackageDatabaseEntryCollection::Pointer existing(DefaultEnvironment::get_instance()->package_database()->
- query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
- e.package.name))), is_installed_only));
+ query(PackageDepAtom(e.package.name), is_installed_only));
std::string right = stringify(e.package.version);
@@ -346,9 +345,8 @@ QueueList::Populate::display_entry(const paludis::DepListEntry & e)
right.append(" [N]");
else
{
- existing = DefaultEnvironment::get_instance()->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(stringify(e.package.name) + ":" +
- stringify(e.metadata->slot))),
+ existing = DefaultEnvironment::get_instance()->package_database()->query(PackageDepAtom(
+ stringify(e.package.name) + ":" + stringify(e.metadata->slot)),
is_installed_only);
if (existing->empty())
right.append(" [S]");
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index ac003f9..3d9e84f 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -47,7 +47,7 @@ int do_has_version()
std::string query(*CommandLine::get_instance()->begin_parameters());
PackageDepAtom::Pointer atom(new PackageDepAtom(query));
PackageDatabaseEntryCollection::ConstPointer entries(env->package_database()->query(
- atom, is_installed_only));
+ *atom, is_installed_only));
if (entries->empty())
return_code = 1;
@@ -65,7 +65,7 @@ int do_best_version()
std::string query(*CommandLine::get_instance()->begin_parameters());
PackageDepAtom::Pointer atom(new PackageDepAtom(query));
PackageDatabaseEntryCollection::ConstPointer entries(env->package_database()->query(
- atom, is_installed_only));
+ *atom, is_installed_only));
/* make built_with_use work for virtuals... icky... */
while (! entries->empty())
@@ -112,10 +112,10 @@ int do_environment_variable()
PackageDepAtom::Pointer atom(new PackageDepAtom(atom_str));
PackageDatabaseEntryCollection::ConstPointer entries(env->package_database()->query(
- atom, is_installed_only));
+ *atom, is_installed_only));
if (entries->empty())
- entries = env->package_database()->query(atom, is_any);
+ entries = env->package_database()->query(*atom, is_any);
if (entries->empty())
throw NoSuchPackageError(atom_str);
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index 4b88d1d..903cd5e 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -95,7 +95,7 @@ do_one_contents(
new p::PackageDepAtom(q));
p::PackageDatabaseEntryCollection::ConstPointer
- entries(env->package_database()->query(atom, p::is_installed_only));
+ entries(env->package_database()->query(*atom, p::is_installed_only));
if (entries->empty())
throw p::NoSuchPackageError(q);
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 9dac710..b05b55b 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -443,8 +443,7 @@ do_install()
{
PackageDatabaseEntryCollection::ConstPointer p(
DefaultEnvironment::get_instance()->package_database()->query(
- PackageDepAtom::ConstPointer(new PackageDepAtom(e.query())),
- is_installable_only));
+ PackageDepAtom(e.query()), is_installable_only));
if (p->empty())
{
cout << endl;
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index 75ad564..85c4e9b 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -47,8 +47,8 @@ void do_one_package_query(
/* prefer the best installed version, then the best visible version, then
* the best version */
PackageDatabaseEntryCollection::ConstPointer
- entries(env->package_database()->query(atom, is_any)),
- preferred_entries(env->package_database()->query(atom, is_installed_only));
+ entries(env->package_database()->query(*atom, is_any)),
+ preferred_entries(env->package_database()->query(*atom, is_installed_only));
if (entries->empty())
throw NoSuchPackageError(q);
if (preferred_entries->empty())
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index e7ac10d..772df85 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -161,12 +161,10 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
return;
PackageDatabaseEntryCollection::Pointer existing(environment()->package_database()->
- query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
- d.package.name))), is_installed_only));
+ query(PackageDepAtom(d.package.name), is_installed_only));
PackageDatabaseEntryCollection::Pointer existing_slot(environment()->package_database()->
- query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
- d.package.name) + ":" + stringify(d.metadata->slot))), is_installed_only));
+ query(PackageDepAtom(stringify(d.package.name) + ":" + stringify(d.metadata->slot)), is_installed_only));
display_merge_list_entry_start(d);
display_merge_list_entry_package_name(d);