aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-27 19:21:52 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-06-27 19:21:52 +0000
commit7e0e5a87926b77173ab057059394c463deac7b69 (patch)
treeff9cc1da484e72be33f9a8945cc13f61115a42e8 /src
parent1e5290d4a82c9c83314a6c81aaad7324e12b5321 (diff)
downloadpaludis-7e0e5a87926b77173ab057059394c463deac7b69.tar.gz
paludis-7e0e5a87926b77173ab057059394c463deac7b69.tar.xz
r3606@snowflake: ciaranm | 2007-06-27 20:17:54 +0100
Switch to Package IDs. Known to be broken: CRAN, Gems, QA / qualudis, gtkpaludis, contrarius, Ruby, Python, paludis --query / inquisitio output
Diffstat (limited to 'src')
-rw-r--r--src/clients/adjutrix/Makefile.am1
-rw-r--r--src/clients/adjutrix/adjutrix.cc12
-rw-r--r--src/clients/adjutrix/command_line.cc2
-rw-r--r--src/clients/adjutrix/command_line.hh1
-rw-r--r--src/clients/adjutrix/display_default_system_resolution.cc2
-rw-r--r--src/clients/adjutrix/display_profiles_use.cc184
-rw-r--r--src/clients/adjutrix/display_profiles_use.hh27
-rw-r--r--src/clients/adjutrix/downgrade_check.cc15
-rw-r--r--src/clients/adjutrix/find_dropped_keywords.cc29
-rw-r--r--src/clients/adjutrix/find_insecure_packages.cc20
-rw-r--r--src/clients/adjutrix/find_reverse_deps.cc50
-rw-r--r--src/clients/adjutrix/find_stable_candidates.cc30
-rw-r--r--src/clients/adjutrix/find_unused_packages.cc6
-rw-r--r--src/clients/adjutrix/keywords_graph.cc53
-rw-r--r--src/clients/adjutrix/what_needs_keywording.cc15
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc2
-rw-r--r--src/clients/inquisitio/description_extractor.cc9
-rw-r--r--src/clients/inquisitio/description_extractor.hh2
-rw-r--r--src/clients/inquisitio/do_search.cc14
-rw-r--r--src/clients/inquisitio/extractor.hh6
-rw-r--r--src/clients/inquisitio/name_extractor.cc6
-rw-r--r--src/clients/inquisitio/name_extractor.hh2
-rw-r--r--src/clients/paludis/applets.cc38
-rw-r--r--src/clients/paludis/do_config.cc22
-rw-r--r--src/clients/paludis/do_contents.cc17
-rw-r--r--src/clients/paludis/install.cc45
-rwxr-xr-xsrc/clients/paludis/install_TEST10
-rw-r--r--src/clients/paludis/list.cc1
-rw-r--r--src/clients/paludis/owner.cc11
-rw-r--r--src/clients/paludis/query.cc2
-rw-r--r--src/clients/paludis/report.cc37
-rw-r--r--src/clients/paludis/uninstall.cc8
-rw-r--r--src/output/console_install_task.cc147
-rw-r--r--src/output/console_install_task.hh29
-rw-r--r--src/output/console_install_task.sr2
-rw-r--r--src/output/console_query_task.cc168
-rw-r--r--src/output/console_query_task.hh15
-rw-r--r--src/output/console_task.cc2
-rw-r--r--src/output/licence.cc8
-rw-r--r--src/output/licence.hh8
-rw-r--r--src/output/use_flag_pretty_printer.cc28
-rw-r--r--src/output/use_flag_pretty_printer.hh8
42 files changed, 437 insertions, 657 deletions
diff --git a/src/clients/adjutrix/Makefile.am b/src/clients/adjutrix/Makefile.am
index af114f676..39d4dfa54 100644
--- a/src/clients/adjutrix/Makefile.am
+++ b/src/clients/adjutrix/Makefile.am
@@ -41,7 +41,6 @@ adjutrix_SOURCES = \
find_reverse_deps.hh find_reverse_deps.cc \
find_unused_packages.hh find_unused_packages.cc \
keywords_graph.hh keywords_graph.cc \
- display_profiles_use.hh display_profiles_use.cc \
display_default_system_resolution.hh display_default_system_resolution.cc \
what_needs_keywording.hh what_needs_keywording.cc \
downgrade_check.hh downgrade_check.cc \
diff --git a/src/clients/adjutrix/adjutrix.cc b/src/clients/adjutrix/adjutrix.cc
index 063aa4dbd..df9e2ccb6 100644
--- a/src/clients/adjutrix/adjutrix.cc
+++ b/src/clients/adjutrix/adjutrix.cc
@@ -25,7 +25,6 @@
#include "find_reverse_deps.hh"
#include "find_unused_packages.hh"
#include "keywords_graph.hh"
-#include "display_profiles_use.hh"
#include "display_default_system_resolution.hh"
#include "what_needs_keywording.hh"
#include "downgrade_check.hh"
@@ -136,7 +135,6 @@ main(int argc, char *argv[])
CommandLine::get_instance()->a_find_unused_packages.specified() +
CommandLine::get_instance()->a_keywords_graph.specified() +
CommandLine::get_instance()->a_reverse_deps.specified() +
- CommandLine::get_instance()->a_display_profiles_use.specified() +
CommandLine::get_instance()->a_display_default_system_resolution.specified() +
CommandLine::get_instance()->a_build_downgrade_check_list.specified() +
CommandLine::get_instance()->a_downgrade_check.specified() +
@@ -216,16 +214,6 @@ main(int argc, char *argv[])
return do_find_reverse_deps(env);
}
- if (CommandLine::get_instance()->a_display_profiles_use.specified())
- {
- if (CommandLine::get_instance()->begin_parameters() !=
- CommandLine::get_instance()->end_parameters())
- throw DoHelp("display-profiles-use action takes no parameters");
-
- do_display_profiles_use(env);
- return EXIT_SUCCESS;
- }
-
if (CommandLine::get_instance()->a_display_default_system_resolution.specified())
{
if (CommandLine::get_instance()->begin_parameters() !=
diff --git a/src/clients/adjutrix/command_line.cc b/src/clients/adjutrix/command_line.cc
index f712bf47b..104500579 100644
--- a/src/clients/adjutrix/command_line.cc
+++ b/src/clients/adjutrix/command_line.cc
@@ -49,8 +49,6 @@ CommandLine::CommandLine() :
"Selects which basic profile-oriented action to perform. Exactly one action should "
"be specified."),
- a_display_profiles_use(&profile_action_args,
- "display-profiles-use", 'u', "Display USE information for all profiles"),
a_display_default_system_resolution(&profile_action_args,
"display-default-system-resolution", 'S', "Display package names and versions that are included in "
"the default resolution of the system set"),
diff --git a/src/clients/adjutrix/command_line.hh b/src/clients/adjutrix/command_line.hh
index cec43ad04..7996bd191 100644
--- a/src/clients/adjutrix/command_line.hh
+++ b/src/clients/adjutrix/command_line.hh
@@ -69,7 +69,6 @@ class CommandLine :
paludis::args::SwitchArg a_what_needs_keywording;
paludis::args::ArgsGroup profile_action_args;
- paludis::args::SwitchArg a_display_profiles_use;
paludis::args::SwitchArg a_display_default_system_resolution;
paludis::args::ArgsGroup downgrade_check_args;
diff --git a/src/clients/adjutrix/display_default_system_resolution.cc b/src/clients/adjutrix/display_default_system_resolution.cc
index 3888d22ab..29a5dd2ca 100644
--- a/src/clients/adjutrix/display_default_system_resolution.cc
+++ b/src/clients/adjutrix/display_default_system_resolution.cc
@@ -78,7 +78,7 @@ namespace
d.add(*env.set(SetName("system")), env.default_destinations());
for (DepList::Iterator e(d.begin()), e_end(d.end()) ; e != e_end ; ++e)
- cout << " " << e->package << ":" << e->metadata->slot << endl;
+ cout << " " << *e->package_id << endl;
}
catch (const NoSuchPackageError & e)
{
diff --git a/src/clients/adjutrix/display_profiles_use.cc b/src/clients/adjutrix/display_profiles_use.cc
deleted file mode 100644
index 7cee03674..000000000
--- a/src/clients/adjutrix/display_profiles_use.cc
+++ /dev/null
@@ -1,184 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006, 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "display_profiles_use.hh"
-#include "command_line.hh"
-#include <output/colour.hh>
-#include <paludis/config_file.hh>
-#include <paludis/package_database.hh>
-#include <paludis/util/log.hh>
-#include <paludis/util/tokeniser.hh>
-#include <paludis/util/dir_iterator.hh>
-#include <paludis/util/is_file_with_extension.hh>
-#include <paludis/util/strip.hh>
-
-#include <iostream>
-#include <iomanip>
-#include <vector>
-#include <cstdlib>
-#include <algorithm>
-#include <set>
-#include <map>
-
-using namespace paludis;
-using std::cout;
-using std::cerr;
-using std::endl;
-
-using namespace paludis;
-
-namespace
-{
- std::string
- upperify(const std::string & s)
- {
- std::string result;
- std::transform(s.begin(), s.end(), std::back_inserter(result), &::toupper);
- return result;
- }
-
- void
- display_profiles_use(const NoConfigEnvironment & env, const std::string & desc,
- const FSEntry & profile, const std::set<UseFlagName> & all_use,
- const std::multimap<std::string, UseFlagName> & all_use_expand_flags)
- {
- Context context("When displaying profile use for '" + stringify(desc) + "' at '"
- + stringify(profile) + "':");
-
- std::string display_profile(stringify(profile)), display_profile_chop(
- stringify(env.main_repository_dir() / "profiles"));
- if (0 == display_profile.compare(0, display_profile_chop.length(), display_profile_chop))
- {
- display_profile.erase(0, display_profile_chop.length());
- if (0 == display_profile.compare(0, 1, "/"))
- display_profile.erase(0, 1);
- if (display_profile.empty())
- display_profile = "/";
- }
-
- cout << std::left << std::setw(20) << (desc + ":") << display_profile << endl;
-
- cout << std::setw(20) << "USE:";
-
- PackageDatabaseEntry e(QualifiedPackageName("dummy-category/dummy-package"), VersionSpec("0"),
- env.package_database()->favourite_repository());
- for (std::set<UseFlagName>::const_iterator u(all_use.begin()), u_end(all_use.end()) ;
- u != u_end ; ++u)
- if (env.query_use(*u, e))
- cout << *u << " ";
-
- std::string current_prefix("not on a boat");
- for (std::multimap<std::string, UseFlagName>::const_iterator u(all_use_expand_flags.begin()),
- u_end(all_use_expand_flags.end()) ; u != u_end ; ++u)
- {
- if (u->first != current_prefix)
- cout << endl << std::setw(20) << (upperify(stringify(u->first)) + ":");
- current_prefix = u->first;
-
- if (env.query_use(UseFlagName(current_prefix + "_" + stringify(u->second)), e))
- cout << u->second << " ";
- }
-
- cout << endl << endl;
- }
-}
-
-void do_display_profiles_use(NoConfigEnvironment & env)
-{
- Context context("When performing display-profiles-use action:");
-
- std::set<UseFlagName> all_use_flags;
- {
- LineConfigFile use_desc(env.main_repository_dir() / "profiles"/ "use.desc", LineConfigFileOptions());
- for (LineConfigFile::Iterator line(use_desc.begin()), line_end(use_desc.end()) ;
- line != line_end ; ++line)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
-
- if (tokens.size() < 2)
- {
- Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
- + *line + "'");
- continue;
- }
-
- all_use_flags.insert(UseFlagName(tokens.at(0)));
- }
- }
-
- std::multimap<std::string, UseFlagName> all_use_expand_flags;
- {
- for (DirIterator d(env.main_repository_dir() / "profiles" / "desc"), d_end ;
- d != d_end ; ++d)
- {
- if (! is_file_with_extension(*d, ".desc", IsFileWithOptions()))
- continue;
-
- std::string prefix(strip_trailing_string(d->basename(), ".desc"));
-
- LineConfigFile use_desc(*d, LineConfigFileOptions());
- for (LineConfigFile::Iterator line(use_desc.begin()), line_end(use_desc.end()) ;
- line != line_end ; ++line)
- {
- std::vector<std::string> tokens;
- WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
-
- if (tokens.size() < 2)
- {
- Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
- + *line + "'");
- continue;
- }
-
- all_use_expand_flags.insert(std::make_pair(prefix, UseFlagName(tokens.at(0))));
- }
- }
- }
-
- if (CommandLine::get_instance()->a_profile.begin_args() ==
- CommandLine::get_instance()->a_profile.end_args())
- {
- for (RepositoryPortageInterface::ProfilesIterator p(env.main_repository()->portage_interface->begin_profiles()),
- p_end(env.main_repository()->portage_interface->end_profiles()) ; p != p_end ; ++p)
- {
- env.main_repository()->portage_interface->set_profile(p);
- display_profiles_use(env, p->arch + "." + p->status, p->path,
- all_use_flags, all_use_expand_flags);
- }
- }
- else
- {
- for (args::StringSetArg::Iterator i(CommandLine::get_instance()->a_profile.begin_args()),
- i_end(CommandLine::get_instance()->a_profile.end_args()) ; i != i_end ; ++i)
- {
- RepositoryPortageInterface::ProfilesIterator p(
- env.main_repository()->portage_interface->find_profile(
- env.main_repository_dir() / "profiles" / (*i)));
- if (p == env.main_repository()->portage_interface->end_profiles())
- throw ConfigurationError("Repository does not have a profile listed in profiles.desc matching '"
- + stringify(*i) + "'");
- env.main_repository()->portage_interface->set_profile(p);
- display_profiles_use(env, *i, env.main_repository_dir() /
- "profiles" / *i, all_use_flags, all_use_expand_flags);
- }
- }
-}
-
-
diff --git a/src/clients/adjutrix/display_profiles_use.hh b/src/clients/adjutrix/display_profiles_use.hh
deleted file mode 100644
index 9d588808b..000000000
--- a/src/clients/adjutrix/display_profiles_use.hh
+++ /dev/null
@@ -1,27 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_SRC_ADJUTRIX_DISPLAY_PROFILES_USE_HH
-#define PALUDIS_GUARD_SRC_ADJUTRIX_DISPLAY_PROFILES_USE_HH 1
-
-#include <paludis/environments/no_config/no_config_environment.hh>
-
-void do_display_profiles_use(paludis::NoConfigEnvironment & env);
-
-#endif
diff --git a/src/clients/adjutrix/downgrade_check.cc b/src/clients/adjutrix/downgrade_check.cc
index 6b1ccced7..8271705da 100644
--- a/src/clients/adjutrix/downgrade_check.cc
+++ b/src/clients/adjutrix/downgrade_check.cc
@@ -42,25 +42,22 @@ namespace
int
build_one_list(NoConfigEnvironment & env, std::ostream & f)
{
- tr1::shared_ptr<const PackageDatabaseEntryCollection> matches(
+ tr1::shared_ptr<const PackageIDSequence> matches(
env.package_database()->query(query::NotMasked(), qo_group_by_slot));
QualifiedPackageName old_package("dummy/dummy");
SlotName old_slot("dummy");
VersionSpec best_version("0");
- for (PackageDatabaseEntryCollection::Iterator m(matches->begin()), m_end(matches->end()) ;
+ for (IndirectIterator<PackageIDSequence::Iterator> m(matches->begin()), m_end(matches->end()) ;
m != m_end ; ++m)
{
- SlotName slot(env.package_database()->fetch_repository(m->repository)->version_metadata(
- m->name, m->version)->slot);
-
- if (m->name != old_package || slot != old_slot)
+ if (m->name() != old_package || m->slot() != old_slot)
{
f << old_package << " " << old_slot << " " << best_version << std::endl;
- old_package = m->name;
- old_slot = slot;
- best_version = m->version;
+ old_package = m->name();
+ old_slot = m->slot();
+ best_version = m->version();
}
}
diff --git a/src/clients/adjutrix/find_dropped_keywords.cc b/src/clients/adjutrix/find_dropped_keywords.cc
index 087a0ff31..b5c87370a 100644
--- a/src/clients/adjutrix/find_dropped_keywords.cc
+++ b/src/clients/adjutrix/find_dropped_keywords.cc
@@ -25,6 +25,8 @@
#include <paludis/version_spec.hh>
#include <paludis/repository.hh>
#include <paludis/package_database.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <set>
#include <map>
@@ -115,33 +117,32 @@ namespace
typedef std::map<SlotName, VersionsEntry> VersionsInSlots;
VersionsInSlots versions_in_slots;
- tr1::shared_ptr<const VersionSpecCollection> versions(repo.version_specs(package));
- for (VersionSpecCollection::Iterator v(versions->begin()), v_end(versions->end()) ;
+ tr1::shared_ptr<const PackageIDSequence> versions(repo.package_ids(package));
+ for (PackageIDSequence::Iterator v(versions->begin()), v_end(versions->end()) ;
v != v_end ; ++v)
{
- tr1::shared_ptr<const VersionMetadata> metadata(repo.version_metadata(package, *v));
- if (! metadata->ebuild_interface)
+ if (! (*v)->keywords_key())
continue;
- tr1::shared_ptr<const KeywordNameCollection> keywords(metadata->ebuild_interface->keywords());;
/* ensure that there's an entry for this SLOT */
- versions_in_slots.insert(std::make_pair(metadata->slot, VersionsEntry(
+ versions_in_slots.insert(std::make_pair((*v)->slot(), VersionsEntry(
VersionsEntry::create()
.best_keyworded(VersionSpec("0"))
.best_anywhere(VersionSpec("0")))));
- if (keywords->end() != keywords->find(keyword) ||
- keywords->end() != keywords->find(KeywordName("~" + stringify(keyword))))
+ if ((*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(keyword) ||
+ (*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(KeywordName("~" + stringify(keyword))))
{
is_interesting = true;
- versions_in_slots.find(metadata->slot)->second.best_keyworded =
- std::max(versions_in_slots.find(metadata->slot)->second.best_keyworded, *v);
- worst_keyworded = std::min(worst_keyworded, *v);
+ versions_in_slots.find((*v)->slot())->second.best_keyworded =
+ std::max(versions_in_slots.find((*v)->slot())->second.best_keyworded, (*v)->version());
+ worst_keyworded = std::min(worst_keyworded, (*v)->version());
}
- if (keywords->end() != std::find_if(keywords->begin(), keywords->end(), IsStableOrUnstableKeyword()))
- versions_in_slots.find(metadata->slot)->second.best_anywhere =
- std::max(versions_in_slots.find(metadata->slot)->second.best_anywhere, *v);
+ if ((*v)->keywords_key()->value()->end() != std::find_if((*v)->keywords_key()->value()->begin(),
+ (*v)->keywords_key()->value()->end(), IsStableOrUnstableKeyword()))
+ versions_in_slots.find((*v)->slot())->second.best_anywhere =
+ std::max(versions_in_slots.find((*v)->slot())->second.best_anywhere, (*v)->version());
}
if (! is_interesting)
diff --git a/src/clients/adjutrix/find_insecure_packages.cc b/src/clients/adjutrix/find_insecure_packages.cc
index ea77f288d..f974e5b15 100644
--- a/src/clients/adjutrix/find_insecure_packages.cc
+++ b/src/clients/adjutrix/find_insecure_packages.cc
@@ -69,8 +69,7 @@ namespace
{
private:
const Environment & _env;
- std::multimap<PackageDatabaseEntry, std::string,
- ArbitrarilyOrderedPackageDatabaseEntryCollectionComparator> _found;
+ std::multimap<tr1::shared_ptr<const PackageID>, std::string, PackageIDSetComparator> _found;
public:
using ConstVisitor<SetSpecTree>::VisitConstSequence<ListInsecureVisitor, AllDepSpec>::visit;
@@ -82,9 +81,9 @@ namespace
void visit_leaf(const PackageDepSpec & a)
{
- tr1::shared_ptr<const PackageDatabaseEntryCollection> insecure(
+ tr1::shared_ptr<const PackageIDSequence> insecure(
_env.package_database()->query(query::Matches(a), qo_order_by_version));
- for (PackageDatabaseEntryCollection::Iterator i(insecure->begin()),
+ for (PackageIDSequence::Iterator i(insecure->begin()),
i_end(insecure->end()) ; i != i_end ; ++i)
if (a.tag())
_found.insert(std::make_pair(*i, a.tag()->short_text()));
@@ -98,18 +97,17 @@ namespace
std::ostream & operator<< (std::ostream & s, const ListInsecureVisitor & v)
{
QualifiedPackageName old_name("dormouse/teapot");
- for (std::multimap<PackageDatabaseEntry, std::string,
- ArbitrarilyOrderedPackageDatabaseEntryCollectionComparator>::const_iterator
+ for (std::multimap<tr1::shared_ptr<const PackageID>, std::string, PackageIDSetComparator>::const_iterator
f(v._found.begin()), f_end(v._found.end()) ; f != f_end ; ++f)
{
- if (f->first.name != old_name)
- s << std::setw(col_width_package) << (stringify(f->first.name) + " ") << endl;
- old_name = f->first.name;
- s << std::setw(col_width_package) << (" " + stringify(f->first.version) + " ")
+ if (f->first->name() != old_name)
+ s << std::setw(col_width_package) << (stringify(f->first->name()) + " ") << endl;
+ old_name = f->first->name();
+ s << std::setw(col_width_package) << (" " + stringify(f->first->canonical_form(idcf_version)) + " ")
<< f->second;
while (next(f) != f_end)
{
- if (next(f)->first != f->first)
+ if (*next(f)->first != *f->first)
break;
cout << " " << f->second;
++f;
diff --git a/src/clients/adjutrix/find_reverse_deps.cc b/src/clients/adjutrix/find_reverse_deps.cc
index 4bd99af44..49a6d4466 100644
--- a/src/clients/adjutrix/find_reverse_deps.cc
+++ b/src/clients/adjutrix/find_reverse_deps.cc
@@ -28,6 +28,7 @@
#include <paludis/query.hh>
#include <paludis/dep_spec.hh>
#include <paludis/package_database.hh>
+#include <paludis/metadata_key.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -50,7 +51,7 @@ namespace
{
private:
tr1::shared_ptr<const PackageDatabase> _db;
- const PackageDatabaseEntryCollection & _entries;
+ const PackageIDSequence & _entries;
std::string _depname;
std::string _p;
@@ -64,7 +65,7 @@ namespace
using ConstVisitor<DependencySpecTree>::VisitConstSequence<ReverseDepChecker, AllDepSpec>::visit_sequence;
ReverseDepChecker(tr1::shared_ptr<const PackageDatabase> db,
- const PackageDatabaseEntryCollection & entries,
+ const PackageIDSequence & entries,
const std::string & p) :
_db(db),
_entries(entries),
@@ -129,16 +130,17 @@ namespace
void
ReverseDepChecker::visit_leaf(const PackageDepSpec & a)
{
- tr1::shared_ptr<const PackageDatabaseEntryCollection> dep_entries(_db->query(
+ tr1::shared_ptr<const PackageIDSequence> dep_entries(_db->query(
query::Matches(a), qo_order_by_version));
- tr1::shared_ptr<PackageDatabaseEntryCollection> matches(new PackageDatabaseEntryCollection::Concrete);
+ tr1::shared_ptr<PackageIDSequence> matches(new PackageIDSequence::Concrete);
bool header_written = false;
- for (PackageDatabaseEntryCollection::Iterator e(dep_entries->begin()), e_end(dep_entries->end()) ;
+ for (IndirectIterator<PackageIDSequence::Iterator> e(dep_entries->begin()), e_end(dep_entries->end()) ;
e != e_end ; ++e)
{
- if (_entries.find(*e) != _entries.end())
+ if (indirect_iterator(_entries.end()) != std::find(indirect_iterator(_entries.begin()),
+ indirect_iterator(_entries.end()), *e))
{
_found_matches |= true;
@@ -174,36 +176,38 @@ namespace
cout << "Reverse dependencies for '" << spec << "':" << std::endl;
}
- int check_one_package(const Environment & env, const Repository & r,
- const PackageDatabaseEntryCollection & entries, const QualifiedPackageName & p)
+ int check_one_package(const Environment & env,
+ const PackageIDSequence & entries, const QualifiedPackageName & p)
{
Context context("When checking package '" + stringify(p) + "':");
- tr1::shared_ptr<PackageDatabaseEntryCollection> p_entries(env.package_database()->query(
+ tr1::shared_ptr<const PackageIDSequence> p_entries(env.package_database()->query(
query::Package(p), qo_order_by_version));
bool found_matches(false);
- for (PackageDatabaseEntryCollection::Iterator e(p_entries->begin()), e_end(p_entries->end()) ;
+ for (IndirectIterator<PackageIDSequence::Iterator> e(p_entries->begin()), e_end(p_entries->end()) ;
e != e_end ; ++e)
{
try
{
- tr1::shared_ptr<const VersionMetadata> metadata(r.version_metadata(e->name, e->version));
- ReverseDepChecker checker(env.package_database(), entries,
- stringify(p) + "-" + stringify(e->version));
+ ReverseDepChecker checker(env.package_database(), entries, stringify(p) + "-" + stringify(e->canonical_form(idcf_version)));
- if (metadata->deps_interface)
- {
- checker.check(metadata->deps_interface->build_depend(), std::string("DEPEND"));
- checker.check(metadata->deps_interface->run_depend(), std::string("RDEPEND"));
- checker.check(metadata->deps_interface->post_depend(), std::string("PDEPEND"));
- checker.check(metadata->deps_interface->suggested_depend(), std::string("SDEPEND"));
- }
+ if (e->build_dependencies_key())
+ checker.check(e->build_dependencies_key()->value(), e->build_dependencies_key()->raw_name());
+
+ if (e->run_dependencies_key())
+ checker.check(e->run_dependencies_key()->value(), e->run_dependencies_key()->raw_name());
+
+ if (e->post_dependencies_key())
+ checker.check(e->post_dependencies_key()->value(), e->post_dependencies_key()->raw_name());
+
+ if (e->suggested_dependencies_key())
+ checker.check(e->suggested_dependencies_key()->value(), e->suggested_dependencies_key()->raw_name());
found_matches |= checker.found_matches();
}
- catch (Exception & exception)
+ catch (const Exception & exception)
{
cerr << "Caught exception:" << endl;
cerr << " * " << exception.backtrace("\n * ") << endl;
@@ -246,7 +250,7 @@ int do_find_reverse_deps(NoConfigEnvironment & env)
return 4;
}
- tr1::shared_ptr<PackageDatabaseEntryCollection> entries(env.package_database()->query(
+ tr1::shared_ptr<const PackageIDSequence> entries(env.package_database()->query(
query::Matches(*spec), qo_order_by_version));
int ret(0);
@@ -290,7 +294,7 @@ int do_find_reverse_deps(NoConfigEnvironment & env)
stringify(p->package)))
continue;
- ret |= check_one_package(env, *r, *entries, *p);
+ ret |= check_one_package(env, *entries, *p);
}
}
}
diff --git a/src/clients/adjutrix/find_stable_candidates.cc b/src/clients/adjutrix/find_stable_candidates.cc
index 17715ecf1..43409c631 100644
--- a/src/clients/adjutrix/find_stable_candidates.cc
+++ b/src/clients/adjutrix/find_stable_candidates.cc
@@ -25,6 +25,8 @@
#include <paludis/version_spec.hh>
#include <paludis/repository.hh>
#include <paludis/package_database.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <set>
#include <map>
@@ -114,40 +116,38 @@ namespace
typedef std::map<SlotName, SlotsEntry> SlotsToVersions;
SlotsToVersions slots_to_versions;
- tr1::shared_ptr<const VersionSpecCollection> versions(repo.version_specs(package));
- for (VersionSpecCollection::Iterator v(versions->begin()), v_end(versions->end()) ;
+ tr1::shared_ptr<const PackageIDSequence> versions(repo.package_ids(package));
+ for (PackageIDSequence::Iterator v(versions->begin()), v_end(versions->end()) ;
v != v_end ; ++v)
{
- tr1::shared_ptr<const VersionMetadata> metadata(repo.version_metadata(package, *v));
- if (! metadata->ebuild_interface)
+ if (! (*v)->keywords_key())
continue;
- tr1::shared_ptr<const KeywordNameCollection> keywords(metadata->ebuild_interface->keywords());
-
- if (keywords->end() != keywords->find(keyword))
+ if ((*v)->keywords_key()->value()->end() != (*v)->keywords_key()->value()->find(keyword))
{
is_interesting = true;
/* replace the entry */
- slots_to_versions.erase(metadata->slot);
- slots_to_versions.insert(std::make_pair(metadata->slot,
+ slots_to_versions.erase((*v)->slot());
+ slots_to_versions.insert(std::make_pair((*v)->slot(),
SlotsEntry(SlotsEntry::create()
- .our_version(*v)
+ .our_version((*v)->version())
.best_version(VersionSpec("0")))));
}
- if (keywords->end() != std::find_if(keywords->begin(), keywords->end(), IsStableKeyword()))
+ if ((*v)->keywords_key()->value()->end() != std::find_if((*v)->keywords_key()->value()->begin(),
+ (*v)->keywords_key()->value()->end(), IsStableKeyword()))
{
/* ensure that an entry exists */
- slots_to_versions.insert(std::make_pair(metadata->slot,
+ slots_to_versions.insert(std::make_pair((*v)->slot(),
SlotsEntry(SlotsEntry::create()
.our_version(VersionSpec("0"))
- .best_version(*v))));
+ .best_version((*v)->version()))));
/* update the entry to mark our current version as the best
* version */
- if (slots_to_versions.find(metadata->slot)->second.best_version <= *v)
- slots_to_versions.find(metadata->slot)->second.best_version = *v;
+ if (slots_to_versions.find((*v)->slot())->second.best_version <= (*v)->version())
+ slots_to_versions.find((*v)->slot())->second.best_version = (*v)->version();
}
}
diff --git a/src/clients/adjutrix/find_unused_packages.cc b/src/clients/adjutrix/find_unused_packages.cc
index d0ad58529..06d367a83 100644
--- a/src/clients/adjutrix/find_unused_packages.cc
+++ b/src/clients/adjutrix/find_unused_packages.cc
@@ -22,6 +22,8 @@
#include <paludis/tasks/find_unused_packages_task.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/util/iterator.hh>
+#include <paludis/package_database.hh>
#include <set>
#include <map>
@@ -81,8 +83,8 @@ void do_find_unused_packages(const Environment & env)
stringify(*c)))
continue;
- tr1::shared_ptr<const PackageDatabaseEntryCollection> unused(task.execute(*p));
- for (PackageDatabaseEntryCollection::Iterator u(unused->begin()), u_end(unused->end()) ;
+ tr1::shared_ptr<const PackageIDSequence> unused(task.execute(*p));
+ for (IndirectIterator<PackageIDSequence::Iterator> u(unused->begin()), u_end(unused->end()) ;
u != u_end ; ++u)
cout << stringify(*u) << endl;
}
diff --git a/src/clients/adjutrix/keywords_graph.cc b/src/clients/adjutrix/keywords_graph.cc
index f81dde8ad..aa63b1dfd 100644
--- a/src/clients/adjutrix/keywords_graph.cc
+++ b/src/clients/adjutrix/keywords_graph.cc
@@ -23,7 +23,11 @@
#include <paludis/tasks/find_unused_packages_task.hh>
#include <paludis/util/tokeniser.hh>
+#include <paludis/util/tr1_functional.hh>
#include <paludis/query.hh>
+#include <paludis/repository.hh>
+#include <paludis/package_database.hh>
+#include <paludis/metadata_key.hh>
#include <set>
#include <map>
@@ -38,9 +42,10 @@ using std::endl;
namespace
{
- struct CompareByStringLength
+ template <typename T_>
+ struct CompareByStringLength :
+ std::binary_function<const T_ &, const T_ &, bool>
{
- template<typename T_>
bool
operator() (const T_ & l, const T_ & r) const
{
@@ -52,15 +57,16 @@ namespace
write_keywords_graph(const Environment & e, const Repository & repo,
const QualifiedPackageName & package)
{
+ using namespace tr1::placeholders;
+
Context context("When writing keyword graph for '" + stringify(package) + "' in '"
+ stringify(repo.name()) + "':");
cout << "Keywords for " << package << ":" << endl;
cout << endl;
- tr1::shared_ptr<const VersionSpecCollection> versions(repo.version_specs(package));
FindUnusedPackagesTask task(&e, &repo);
- tr1::shared_ptr<const PackageDatabaseEntryCollection> packages(e.package_database()->query(
+ tr1::shared_ptr<const PackageIDSequence> packages(e.package_database()->query(
query::Matches(PackageDepSpec(
tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(package)),
tr1::shared_ptr<CategoryNamePart>(),
@@ -70,7 +76,7 @@ namespace
tr1::shared_ptr<SlotName>(),
tr1::shared_ptr<RepositoryName>(new RepositoryName(repo.name())))),
qo_group_by_slot));
- tr1::shared_ptr<const PackageDatabaseEntryCollection> unused(task.execute(package));
+ tr1::shared_ptr<const PackageIDSequence> unused(task.execute(package));
if (packages->empty())
return;
@@ -83,18 +89,21 @@ namespace
return;
std::set<SlotName> slots;
- for (PackageDatabaseEntryCollection::Iterator p(packages->begin()), p_end(packages->end()) ;
- p != p_end ; ++p)
- slots.insert(repo.version_metadata(package, p->version)->slot);
+ std::copy(packages->begin(), packages->end(),
+ transform_inserter(std::inserter(slots, slots.begin()), tr1::mem_fn(&PackageID::slot)));
- unsigned version_specs_columns_width(stringify(*std::max_element(versions->begin(),
- versions->end(), CompareByStringLength())).length() + 1);
+ unsigned version_specs_columns_width(std::max_element(indirect_iterator(packages->begin()),
+ indirect_iterator(packages->end()),
+ tr1::bind(CompareByStringLength<std::string>(),
+ tr1::bind(tr1::mem_fn(&PackageID::canonical_form), _1, idcf_version),
+ tr1::bind(tr1::mem_fn(&PackageID::canonical_form), _2, idcf_version))
+ )->canonical_form(idcf_version).length() + 1);
unsigned tallest_arch_name(std::max(stringify(*std::max_element(arch_flags->begin(),
- arch_flags->end(), CompareByStringLength())).length(), static_cast<std::size_t>(6)));
+ arch_flags->end(), CompareByStringLength<UseFlagName>())).length(), static_cast<std::size_t>(6)));
unsigned longest_slot_name(stringify(*std::max_element(slots.begin(),
- slots.end(), CompareByStringLength())).length());
+ slots.end(), CompareByStringLength<SlotName>())).length());
for (unsigned h = 0 ; h < tallest_arch_name ; ++h)
{
@@ -125,22 +134,21 @@ namespace
<< std::string(longest_slot_name + 3, '-') << endl;
SlotName old_slot("first_slot");
- for (PackageDatabaseEntryCollection::Iterator p(packages->begin()), p_end(packages->end()) ;
+ for (IndirectIterator<PackageIDSequence::Iterator> p(packages->begin()), p_end(packages->end()) ;
p != p_end ; ++p)
{
- tr1::shared_ptr<const VersionMetadata> metadata(repo.version_metadata(package, p->version));
- if (! metadata->ebuild_interface)
+ if (! p->keywords_key())
continue;
- if (metadata->slot != old_slot)
+ if (p->slot() != old_slot)
if (old_slot != SlotName("first_slot"))
cout << std::string(version_specs_columns_width, '-') << "+"
<< std::string(arch_flags->size() * 2 + 1, '-') << "+"
<< std::string(longest_slot_name + 3, '-') << endl;
- cout << std::left << std::setw(version_specs_columns_width) << p->version << "| ";
+ cout << std::left << std::setw(version_specs_columns_width) << p->canonical_form(idcf_version) << "| ";
- tr1::shared_ptr<const KeywordNameCollection> keywords(metadata->ebuild_interface->keywords());
+ tr1::shared_ptr<const KeywordNameCollection> keywords(p->keywords_key()->value());
for (UseFlagNameCollection::Iterator a(arch_flags->begin()), a_end(arch_flags->end()) ;
a != a_end ; ++a)
@@ -157,12 +165,13 @@ namespace
cout << " ";
}
- cout << "| " << (unused->find(*p) != unused->end() ? "* " : " ");
+ cout << "| " << (indirect_iterator(unused->end()) !=
+ std::find(indirect_iterator(unused->begin()), indirect_iterator(unused->end()), *p) ? "* " : " ");
- if (metadata->slot != old_slot)
+ if (p->slot() != old_slot)
{
- cout << metadata->slot;
- old_slot = metadata->slot;
+ cout << p->slot();
+ old_slot = p->slot();
}
cout << endl;
diff --git a/src/clients/adjutrix/what_needs_keywording.cc b/src/clients/adjutrix/what_needs_keywording.cc
index 4c211cfa4..0de297d5a 100644
--- a/src/clients/adjutrix/what_needs_keywording.cc
+++ b/src/clients/adjutrix/what_needs_keywording.cc
@@ -25,6 +25,8 @@
#include <paludis/repositories/fake/fake_installed_repository.hh>
#include <paludis/dep_list/exceptions.hh>
#include <paludis/dep_list/dep_list.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <set>
#include <map>
@@ -94,17 +96,14 @@ int do_what_needs_keywording(NoConfigEnvironment & env)
if (dlk_masked == p->kind)
{
none = false;
- cout << std::setw(30) << std::left << stringify(p->package.name);
- cout << std::setw(20) << std::left << stringify(p->package.version);
+ cout << std::setw(30) << std::left << stringify(p->package_id->name());
+ cout << std::setw(20) << std::left << stringify(p->package_id->canonical_form(idcf_version));
std::string current;
- tr1::shared_ptr<const VersionMetadata> m(env.package_database()->fetch_repository(
- p->package.repository)->version_metadata(p->package.name,
- p->package.version));
- if (m->ebuild_interface)
+ if (p->package_id->keywords_key())
{
- tr1::shared_ptr<const KeywordNameCollection> keywords(m->ebuild_interface->keywords());
+ tr1::shared_ptr<const KeywordNameCollection> keywords(p->package_id->keywords_key()->value());
for (KeywordNameCollection::Iterator k(keywords->begin()), k_end(keywords->end()) ;
k != k_end ; ++k)
if (*k == KeywordName("-*")
@@ -117,7 +116,7 @@ int do_what_needs_keywording(NoConfigEnvironment & env)
std::string masks;
- MaskReasons r(env.mask_reasons(p->package));
+ MaskReasons r(env.mask_reasons(*p->package_id));
if (r[mr_repository_mask])
masks.append("R");
if (r[mr_profile_mask])
diff --git a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
index f2cb7c541..5375ead48 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/packages_list_model.cc
@@ -258,7 +258,7 @@ PackagesListModel::populate_in_paludis_thread()
_imp->main_window->environment()->set(*_imp->packages_page->get_set())->accept(f);
std::set<std::string> a;
std::transform(indirect_iterator(f.begin()), indirect_iterator(f.end()), std::inserter(a, a.begin()),
- std::tr1::mem_fn(&StringDepSpec::text));
+ tr1::mem_fn(&StringDepSpec::text));
for (std::set<std::string>::const_iterator i(a.begin()), i_end(a.end()) ;
i != i_end ; ++i)
diff --git a/src/clients/inquisitio/description_extractor.cc b/src/clients/inquisitio/description_extractor.cc
index ec4b26b75..a9368d4de 100644
--- a/src/clients/inquisitio/description_extractor.cc
+++ b/src/clients/inquisitio/description_extractor.cc
@@ -19,6 +19,8 @@
#include "description_extractor.hh"
#include <paludis/package_database.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
using namespace paludis;
@@ -48,9 +50,10 @@ DescriptionExtractor::~DescriptionExtractor()
}
std::string
-DescriptionExtractor::operator() (const PackageDatabaseEntry & p) const
+DescriptionExtractor::operator() (const PackageID & p) const
{
- return _imp->env->package_database()->fetch_repository(p.repository)->
- version_metadata(p.name, p.version)->description;
+ if (p.short_description_key())
+ return p.short_description_key()->value();
+ return "";
}
diff --git a/src/clients/inquisitio/description_extractor.hh b/src/clients/inquisitio/description_extractor.hh
index aa8a30500..96f145acb 100644
--- a/src/clients/inquisitio/description_extractor.hh
+++ b/src/clients/inquisitio/description_extractor.hh
@@ -32,7 +32,7 @@ namespace inquisitio
DescriptionExtractor(const paludis::Environment &);
virtual ~DescriptionExtractor();
- std::string operator() (const paludis::PackageDatabaseEntry &) const;
+ std::string operator() (const paludis::PackageID &) const;
};
}
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index 6f3a52539..f27d85c37 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -93,7 +93,7 @@ do_search(const Environment & env)
for (std::set<QualifiedPackageName>::const_iterator p(pkgs.begin()), p_end(pkgs.end()) ;
p != p_end ; ++p)
{
- tr1::shared_ptr<const PackageDatabaseEntryCollection>
+ tr1::shared_ptr<const PackageIDSequence>
entries(env.package_database()->query(
query::Package(*p), qo_order_by_version)),
preferred_entries(env.package_database()->query(query::Package(*p) &
@@ -104,17 +104,17 @@ do_search(const Environment & env)
if (preferred_entries->empty())
preferred_entries = entries;
- PackageDatabaseEntry display_entry(*preferred_entries->last());
- for (PackageDatabaseEntryCollection::Iterator i(preferred_entries->begin()),
+ tr1::shared_ptr<const PackageID> display_entry(*preferred_entries->last());
+ for (PackageIDSequence::Iterator i(preferred_entries->begin()),
i_end(preferred_entries->end()) ; i != i_end ; ++i)
- if (! env.mask_reasons(*i).any())
+ if (! env.mask_reasons(**i).any())
display_entry = *i;
bool match(false);
for (std::list<tr1::shared_ptr<Extractor> >::const_iterator x(extractors.begin()),
x_end(extractors.end()) ; x != x_end && ! match ; ++x)
{
- std::string xx((**x)(display_entry));
+ std::string xx((**x)(*display_entry));
for (std::list<tr1::shared_ptr<Matcher> >::const_iterator m(matchers.begin()),
m_end(matchers.end()) ; m != m_end && ! match ; ++m)
if ((**m)(xx))
@@ -126,8 +126,8 @@ do_search(const Environment & env)
InquisitioQueryTask query(&env);
query.show(PackageDepSpec(
- tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(display_entry.name))),
- &display_entry);
+ tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(display_entry->name()))),
+ display_entry.get());
}
return 0;
diff --git a/src/clients/inquisitio/extractor.hh b/src/clients/inquisitio/extractor.hh
index 4a1fb7879..4f78c6748 100644
--- a/src/clients/inquisitio/extractor.hh
+++ b/src/clients/inquisitio/extractor.hh
@@ -23,8 +23,8 @@
#include <string>
#include <paludis/util/instantiation_policy.hh>
#include <paludis/util/virtual_constructor.hh>
-#include <paludis/package_database_entry.hh>
-#include <paludis/environment.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
namespace inquisitio
{
@@ -37,7 +37,7 @@ namespace inquisitio
public:
virtual ~Extractor();
- virtual std::string operator() (const paludis::PackageDatabaseEntry &) const = 0;
+ virtual std::string operator() (const paludis::PackageID &) const = 0;
};
class NoSuchExtractorError :
diff --git a/src/clients/inquisitio/name_extractor.cc b/src/clients/inquisitio/name_extractor.cc
index 983616e2a..ccc037859 100644
--- a/src/clients/inquisitio/name_extractor.cc
+++ b/src/clients/inquisitio/name_extractor.cc
@@ -20,6 +20,8 @@
#include "name_extractor.hh"
#include <paludis/util/stringify.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
+#include <paludis/package_id.hh>
+#include <paludis/name.hh>
using namespace inquisitio;
using namespace paludis;
@@ -29,8 +31,8 @@ NameExtractor::NameExtractor(const paludis::Environment &)
}
std::string
-NameExtractor::operator() (const PackageDatabaseEntry & p) const
+NameExtractor::operator() (const PackageID & p) const
{
- return stringify(p.name);
+ return stringify(p.name());
}
diff --git a/src/clients/inquisitio/name_extractor.hh b/src/clients/inquisitio/name_extractor.hh
index 94977c970..1b522711f 100644
--- a/src/clients/inquisitio/name_extractor.hh
+++ b/src/clients/inquisitio/name_extractor.hh
@@ -30,7 +30,7 @@ namespace inquisitio
public:
NameExtractor(const paludis::Environment &);
- std::string operator() (const paludis::PackageDatabaseEntry &) const;
+ std::string operator() (const paludis::PackageID &) const;
};
}
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index b2ebbc8a5..9544c708b 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -51,7 +51,7 @@ int do_has_version(tr1::shared_ptr<Environment> env)
std::string query(*CommandLine::get_instance()->begin_parameters());
tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(query, pds_pm_permissive));
- tr1::shared_ptr<const PackageDatabaseEntryCollection> entries(env->package_database()->query(
+ tr1::shared_ptr<const PackageIDSequence> entries(env->package_database()->query(
query::Matches(*spec) & query::InstalledAtRoot(env->root()), qo_whatever));
if (entries->empty())
@@ -68,25 +68,22 @@ int do_best_version(tr1::shared_ptr<Environment> env)
std::string query(*CommandLine::get_instance()->begin_parameters());
tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(query, pds_pm_permissive));
- tr1::shared_ptr<const PackageDatabaseEntryCollection> entries(env->package_database()->query(
+ tr1::shared_ptr<const PackageIDSequence> entries(env->package_database()->query(
query::Matches(*spec) & query::InstalledAtRoot(env->root()), qo_order_by_version));
/* make built_with_use work for virtuals... icky... */
while (! entries->empty())
{
- tr1::shared_ptr<const VersionMetadata> metadata(env->package_database()->fetch_repository(
- entries->last()->repository)->version_metadata(entries->last()->name,
- entries->last()->version));
- if (! metadata->virtual_interface)
+ if (! (*entries->last())->virtual_for_key())
break;
- Log::get_instance()->message(ll_qa, lc_context, "best-version of '" + query +
- "' resolves to '" + stringify(*entries->last()) + "', which is a virtual for '"
- + stringify(*metadata->virtual_interface->virtual_for) + "'. This will break with "
- "new style virtuals.");
- tr1::shared_ptr<PackageDatabaseEntryCollection> new_entries(
- new PackageDatabaseEntryCollection::Concrete);
- new_entries->push_back(*metadata->virtual_interface->virtual_for);
+ Log::get_instance()->message(ll_qa, lc_context) << "best-version of '" << query <<
+ "' resolves to '" << **entries->last() << "', which is a virtual for '"
+ << *(*entries->last())->virtual_for_key()->value() << "'. This will break with "
+ "new style virtuals.";
+ tr1::shared_ptr<PackageIDSequence> new_entries(
+ new PackageIDSequence::Concrete);
+ new_entries->push_back((*entries->last())->virtual_for_key()->value());
entries = new_entries;
}
@@ -96,8 +93,8 @@ int do_best_version(tr1::shared_ptr<Environment> env)
{
// don't include repo, it breaks built_with_use and the like.
std::string entry(
- stringify(entries->last()->name) + "-" +
- stringify(entries->last()->version));
+ stringify((*entries->last())->name()) + "-" +
+ stringify((*entries->last())->version()));
std::cout << entry << std::endl;
}
@@ -114,7 +111,7 @@ int do_environment_variable(tr1::shared_ptr<Environment> env)
std::string var_str(* next(CommandLine::get_instance()->begin_parameters()));
tr1::shared_ptr<PackageDepSpec> spec(new PackageDepSpec(spec_str, pds_pm_permissive));
- tr1::shared_ptr<const PackageDatabaseEntryCollection> entries(env->package_database()->query(
+ tr1::shared_ptr<const PackageIDSequence> entries(env->package_database()->query(
query::Matches(*spec) & query::InstalledAtRoot(env->root()), qo_order_by_version));
if (entries->empty())
@@ -123,19 +120,16 @@ int do_environment_variable(tr1::shared_ptr<Environment> env)
if (entries->empty())
throw NoSuchPackageError(spec_str);
- tr1::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(
- entries->begin()->repository));
- RepositoryEnvironmentVariableInterface * env_if(
- repo->environment_variable_interface);
+ RepositoryEnvironmentVariableInterface * env_if((*entries->last())->repository()->environment_variable_interface);
if (! env_if)
{
- std::cerr << "Repository '" << repo->name() <<
+ std::cerr << "Repository '" << (*entries->last())->repository()->name() <<
"' cannot be queried for environment variables" << std::endl;
return_code |= 1;
}
else
- std::cout << env_if->get_environment_variable(*entries->begin(), var_str) << std::endl;
+ std::cout << env_if->get_environment_variable(*entries->last(), var_str) << std::endl;
return return_code;
}
diff --git a/src/clients/paludis/do_config.cc b/src/clients/paludis/do_config.cc
index b3d7ef8bb..2b8649fa2 100644
--- a/src/clients/paludis/do_config.cc
+++ b/src/clients/paludis/do_config.cc
@@ -33,9 +33,9 @@ namespace
struct AmbiguousConfigTarget :
public Exception
{
- tr1::shared_ptr<const PackageDatabaseEntryCollection> matches;
+ tr1::shared_ptr<const PackageIDSequence> matches;
- AmbiguousConfigTarget(tr1::shared_ptr<const PackageDatabaseEntryCollection> & m) throw () :
+ AmbiguousConfigTarget(tr1::shared_ptr<const PackageIDSequence> & m) throw () :
Exception("Ambiguous config target"),
matches(m)
{
@@ -47,21 +47,19 @@ namespace
};
int
- do_one_config_entry(tr1::shared_ptr<Environment> env, const PackageDatabaseEntry & p)
+ do_one_config_entry(const tr1::shared_ptr<const PackageID> & p)
{
int return_code(0);
- tr1::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(p.repository));
- const RepositoryConfigInterface * conf_if(repo->config_interface);
-
+ const RepositoryConfigInterface * conf_if(p->repository()->config_interface);
if (! conf_if)
{
- std::cerr << "Repository '" << repo->name() <<
+ std::cerr << "Repository '" << p->repository()->name() <<
"' does not support post-install configuration" << std::endl;
return_code |= 1;
}
else
- conf_if->config(p.name, p.version);
+ conf_if->config(p);
return return_code;
}
@@ -79,7 +77,7 @@ namespace
PackageNamePart(target))))) :
new PackageDepSpec(target, pds_pm_permissive));
- tr1::shared_ptr<const PackageDatabaseEntryCollection>
+ tr1::shared_ptr<const PackageIDSequence>
entries(env->package_database()->query(query::Matches(*spec) & query::InstalledAtRoot(env->root()), qo_order_by_version));
if (entries->empty())
@@ -88,7 +86,7 @@ namespace
if (next(entries->begin()) != entries->end())
throw AmbiguousConfigTarget(entries);
- return do_one_config_entry(env, *entries->begin());
+ return do_one_config_entry(*entries->begin());
}
}
@@ -124,9 +122,9 @@ do_config(tr1::shared_ptr<Environment> env)
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
cerr << "Ambiguous config target '" << *q << "'. Did you mean:" << endl;
- for (PackageDatabaseEntryCollection::Iterator o(e.matches->begin()),
+ for (PackageIDSequence::Iterator o(e.matches->begin()),
o_end(e.matches->end()) ; o != o_end ; ++o)
- cerr << " * =" << colour(cl_package_name, *o) << endl;
+ cerr << " * =" << colour(cl_package_name, **o) << endl;
cerr << endl;
}
}
diff --git a/src/clients/paludis/do_contents.cc b/src/clients/paludis/do_contents.cc
index d5a3608ac..5dae469f0 100644
--- a/src/clients/paludis/do_contents.cc
+++ b/src/clients/paludis/do_contents.cc
@@ -69,18 +69,15 @@ namespace
void
do_one_contents_entry(
- const tr1::shared_ptr<Environment> env,
- const PackageDatabaseEntry & e)
+ const tr1::shared_ptr<Environment>,
+ const PackageID & e)
{
cout << "* " << colour(cl_package_name, e) << endl;
- const RepositoryContentsInterface * const contents_interface(
- env->package_database()->fetch_repository(e.repository)->
- contents_interface);
+ const RepositoryContentsInterface * const contents_interface(e.repository()->contents_interface);
if (contents_interface)
{
- tr1::shared_ptr<const Contents> contents(contents_interface->contents(
- e.name, e.version));
+ tr1::shared_ptr<const Contents> contents(contents_interface->contents(e));
ContentsDisplayer d;
std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d));
}
@@ -104,16 +101,16 @@ do_one_contents(
env->package_database()->fetch_unique_qualified_package_name(PackageNamePart(q))))) :
new PackageDepSpec(q, pds_pm_permissive));
- tr1::shared_ptr<const PackageDatabaseEntryCollection>
+ tr1::shared_ptr<const PackageIDSequence>
entries(env->package_database()->query(query::Matches(*spec) & query::InstalledAtRoot(
env->root()), qo_order_by_version));
if (entries->empty())
throw NoSuchPackageError(q);
- for (PackageDatabaseEntryCollection::Iterator i(entries->begin()),
+ for (PackageIDSequence::Iterator i(entries->begin()),
i_end(entries->end()) ; i != i_end ; ++i)
- do_one_contents_entry(env, *i);
+ do_one_contents_entry(env, **i);
}
int
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 0fda4c431..24f79ddb2 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -39,13 +39,20 @@
#include <paludis/tasks/install_task.hh>
#include <paludis/tasks/exceptions.hh>
+
#include <paludis/util/fd_output_stream.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/log.hh>
#include <paludis/util/tokeniser.hh>
#include <paludis/util/system.hh>
+
#include <paludis/dep_list/exceptions.hh>
+#include <paludis/hook.hh>
+#include <paludis/query.hh>
+#include <paludis/eapi.hh>
+#include <paludis/metadata_key.hh>
+
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -74,10 +81,7 @@ namespace
task.current_dep_list_entry()), i_end(task.dep_list().end()) ;
i != i_end ; ++i)
if (dlk_package == i->kind)
- resume_command = resume_command + " '="
- + stringify(i->package.name) + "-"
- + stringify(i->package.version) + "::"
- + stringify(i->package.repository) + "'";
+ resume_command = resume_command + " '=" + stringify(*i->package_id) + "'";
if (CommandLine::get_instance()->a_add_to_world_spec.specified())
resume_command = resume_command + " --" + CommandLine::get_instance()->a_add_to_world_spec.long_name()
@@ -614,7 +618,7 @@ do_install(tr1::shared_ptr<Environment> env)
{
try
{
- tr1::shared_ptr<const PackageDatabaseEntryCollection> p(
+ tr1::shared_ptr<const PackageIDSequence> p(
env->package_database()->query(
query::Matches(e.query()) & query::RepositoryHasInstallableInterface(), qo_order_by_version));
if (p->empty())
@@ -630,13 +634,13 @@ do_install(tr1::shared_ptr<Environment> env)
cerr << "Query error:" << endl;
cerr << " * " << e.backtrace("\n * ");
cerr << "All versions of '" << e.query() << "' are masked. Candidates are:" << endl;
- for (PackageDatabaseEntryCollection::Iterator pp(p->begin()), pp_end(p->end()) ;
+ for (PackageIDSequence::Iterator pp(p->begin()), pp_end(p->end()) ;
pp != pp_end ; ++pp)
{
- cerr << " * " << colour(cl_package_name, *pp) << ": Masked by ";
+ cerr << " * " << colour(cl_package_name, **pp) << ": Masked by ";
bool need_comma(false);
- MaskReasons m(env->mask_reasons(*pp));
+ MaskReasons m(env->mask_reasons(**pp));
for (unsigned mm = 0 ; mm < last_mr ; ++mm)
if (m[static_cast<MaskReason>(mm)])
{
@@ -646,9 +650,7 @@ do_install(tr1::shared_ptr<Environment> env)
if (mr_eapi == mm)
{
- std::string eapi_str(env->package_database()->fetch_repository(
- pp->repository)->version_metadata(
- pp->name, pp->version)->eapi->name);
+ std::string eapi_str((*pp)->eapi()->name);
if (eapi_str == "UNKNOWN")
cerr << " ( " << colour(cl_masked, eapi_str) <<
@@ -658,30 +660,19 @@ do_install(tr1::shared_ptr<Environment> env)
}
else if (mr_license == mm)
{
- tr1::shared_ptr<const VersionMetadata> meta(
- env->package_database()->fetch_repository(
- pp->repository)->version_metadata(
- pp->name, pp->version));
-
- if (meta->license_interface)
+ if ((*pp)->license_key())
{
cerr << " ";
-
LicenceDisplayer ld(cerr, env.get(), *pp);
- meta->license_interface->license()->accept(ld);
+ (*pp)->license_key()->value()->accept(ld);
}
}
else if (mr_keyword == mm)
{
- tr1::shared_ptr<const VersionMetadata> meta(env->
- package_database()->fetch_repository(
- pp->repository)->version_metadata(
- pp->name, pp->version));
- if (meta->ebuild_interface)
+ if ((*pp)->keywords_key())
{
- tr1::shared_ptr<const KeywordNameCollection> keywords(meta->ebuild_interface->keywords());
- cerr << " ( " << colour(cl_masked, join(keywords->begin(),
- keywords->end(), " ")) << " )";
+ cerr << " ( " << colour(cl_masked, join((*pp)->keywords_key()->value()->begin(),
+ (*pp)->keywords_key()->value()->end(), " ")) << " )";
}
}
diff --git a/src/clients/paludis/install_TEST b/src/clients/paludis/install_TEST
index 5ad0ca0e8..d7356c5f7 100755
--- a/src/clients/paludis/install_TEST
+++ b/src/clients/paludis/install_TEST
@@ -1,6 +1,12 @@
#!/bin/bash
PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
+ --list-packages || exit 12
+
+PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
+ --query test-category/target || exit 13
+
+PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
--has-version test-category/target && exit 1
PALUDIS_INSTALL_TEST_DIE_PLEASE=yes \
PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
@@ -18,5 +24,9 @@ PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
--has-version test-category/target && exit 9
grep target install_TEST_dir/root/var/db/pkg/world >/dev/null && exit 10
+
+PALUDIS_HOME=./install_TEST_dir/config/ ./paludis --environment :install-test \
+ --query test-category/target || exit 11
+
true
diff --git a/src/clients/paludis/list.cc b/src/clients/paludis/list.cc
index 25bca2c53..a25c09a90 100644
--- a/src/clients/paludis/list.cc
+++ b/src/clients/paludis/list.cc
@@ -22,6 +22,7 @@
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
+#include <paludis/repository_info.hh>
#include <paludis/util/log.hh>
#include <paludis/util/visitor.hh>
#include <src/output/colour.hh>
diff --git a/src/clients/paludis/owner.cc b/src/clients/paludis/owner.cc
index 75a684510..94c022068 100644
--- a/src/clients/paludis/owner.cc
+++ b/src/clients/paludis/owner.cc
@@ -110,17 +110,15 @@ do_one_owner(
for (QualifiedPackageNameCollection::Iterator p(pkgs->begin()),
p_end(pkgs->end()) ; p != p_end ; ++p)
{
- tr1::shared_ptr<const VersionSpecCollection> vers((*r)->version_specs(*p));
- for (VersionSpecCollection::Iterator v(vers->begin()),
- v_end(vers->end()) ; v != v_end ; ++v)
+ tr1::shared_ptr<const PackageIDSequence> ids((*r)->package_ids(*p));
+ for (PackageIDSequence::Iterator v(ids->begin()), v_end(ids->end()) ; v != v_end ; ++v)
{
- PackageDatabaseEntry e(*p, *v, (*r)->name());
- tr1::shared_ptr<const Contents> contents((*r)->contents_interface->contents(*p, *v));
+ tr1::shared_ptr<const Contents> contents((*r)->contents_interface->contents(**v));
ContentsFinder d(query, CommandLine::get_instance()->a_full_match.specified());
std::for_each(indirect_iterator(contents->begin()), indirect_iterator(contents->end()), accept_visitor(d));
if (d.found)
{
- cout << " " << e << endl;
+ cout << " " << **v << endl;
found_owner=true;
}
}
@@ -132,7 +130,6 @@ do_one_owner(
return found_owner ? 0 : 1;
}
-
int
do_owner(tr1::shared_ptr<Environment> env)
{
diff --git a/src/clients/paludis/query.cc b/src/clients/paludis/query.cc
index cc02eb4b3..33cbd9ccf 100644
--- a/src/clients/paludis/query.cc
+++ b/src/clients/paludis/query.cc
@@ -204,8 +204,6 @@ int do_query(tr1::shared_ptr<Environment> env)
case mr_breaks_portage:
cout << "* " << colour(cl_masked, "B") << ": breaks Portage";
break;
- case mr_interactive:
- cout << "* " << colour(cl_masked, "I") << ": interactive";
case last_mr:
break;
diff --git a/src/clients/paludis/report.cc b/src/clients/paludis/report.cc
index 8020265a4..7735e098c 100644
--- a/src/clients/paludis/report.cc
+++ b/src/clients/paludis/report.cc
@@ -49,15 +49,15 @@ namespace
virtual void on_report_all_pre();
virtual void on_report_check_package_pre(const QualifiedPackageName & p);
- virtual void on_report_package_success(const PackageDatabaseEntry & pde);
- virtual void on_report_package_failure_pre(const PackageDatabaseEntry & pde);
- virtual void on_report_package_is_masked(const PackageDatabaseEntry & pde, const MaskReasons & mr);
- virtual void on_report_package_is_vulnerable_pre(const PackageDatabaseEntry & pde);
- virtual void on_report_package_is_vulnerable(const PackageDatabaseEntry & pde, const std::string & tag);
- virtual void on_report_package_is_vulnerable_post(const PackageDatabaseEntry & pde);
- virtual void on_report_package_is_missing(const PackageDatabaseEntry & pde);
- virtual void on_report_package_is_unused(const PackageDatabaseEntry & pde);
- virtual void on_report_package_failure_post(const PackageDatabaseEntry & pde);
+ virtual void on_report_package_success(const PackageID & id);
+ virtual void on_report_package_failure_pre(const PackageID & id);
+ virtual void on_report_package_is_masked(const PackageID & id, const MaskReasons & mr);
+ virtual void on_report_package_is_vulnerable_pre(const PackageID & id);
+ virtual void on_report_package_is_vulnerable(const PackageID & id, const std::string & tag);
+ virtual void on_report_package_is_vulnerable_post(const PackageID & id);
+ virtual void on_report_package_is_missing(const PackageID & id);
+ virtual void on_report_package_is_unused(const PackageID & id);
+ virtual void on_report_package_failure_post(const PackageID & id);
virtual void on_report_check_package_post(const QualifiedPackageName & p);
virtual void on_report_all_post();
@@ -79,18 +79,18 @@ namespace
}
void
- OurReportTask::on_report_package_success(const PackageDatabaseEntry &)
+ OurReportTask::on_report_package_success(const PackageID &)
{
}
void
- OurReportTask::on_report_package_failure_pre(const PackageDatabaseEntry & pde)
+ OurReportTask::on_report_package_failure_pre(const PackageID & pde)
{
cout << "* " << colour(cl_package_name, pde) << " NOT OK";
}
void
- OurReportTask::on_report_package_is_masked(const PackageDatabaseEntry &, const MaskReasons & mr)
+ OurReportTask::on_report_package_is_masked(const PackageID &, const MaskReasons & mr)
{
cout << endl << " Masked by: ";
@@ -107,39 +107,39 @@ namespace
}
void
- OurReportTask::on_report_package_is_vulnerable_pre(const PackageDatabaseEntry &)
+ OurReportTask::on_report_package_is_vulnerable_pre(const PackageID &)
{
cout << endl << " Affected by:";
}
void
- OurReportTask::on_report_package_is_vulnerable(const PackageDatabaseEntry &, const std::string & tag)
+ OurReportTask::on_report_package_is_vulnerable(const PackageID &, const std::string & tag)
{
cout << " " << colour(cl_tag, tag);
++_n_errors;
}
void
- OurReportTask::on_report_package_is_vulnerable_post(const PackageDatabaseEntry &)
+ OurReportTask::on_report_package_is_vulnerable_post(const PackageID &)
{
}
void
- OurReportTask::on_report_package_is_missing(const PackageDatabaseEntry &)
+ OurReportTask::on_report_package_is_missing(const PackageID &)
{
cout << endl << " No longer exists in its original repository";
++_n_errors;
}
void
- OurReportTask::on_report_package_is_unused(const PackageDatabaseEntry &)
+ OurReportTask::on_report_package_is_unused(const PackageID &)
{
cout << endl << " Not used by any package in world";
++_n_errors;
}
void
- OurReportTask::on_report_package_failure_post(const PackageDatabaseEntry &)
+ OurReportTask::on_report_package_failure_post(const PackageID &)
{
cout << endl << endl;
}
@@ -168,3 +168,4 @@ int do_report(tr1::shared_ptr<Environment> env)
return task.return_code();
}
+
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index 3caff7260..cdff5f7d8 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -82,7 +82,7 @@ namespace
if (CommandLine::get_instance()->a_show_reasons.argument() != "full")
return;
- cout << "* " << colour(d.skip_uninstall ? cl_unimportant : cl_package_name, stringify(d.package));
+ cout << "* " << colour(d.skip_uninstall ? cl_unimportant : cl_package_name, stringify(*d.package_id));
++_count;
if ((CommandLine::get_instance()->a_show_reasons.argument() == "summary") ||
@@ -130,9 +130,7 @@ namespace
virtual void on_uninstall_pre(const UninstallListEntry & d)
{
std::string msg("(" + stringify(++_current_count) + " of " +
- stringify(_count) + ") Uninstalling " +
- stringify(d.package.name) + "-" + stringify(d.package.version) +
- "::" + stringify(d.package.repository));
+ stringify(_count) + ") Uninstalling " + stringify(*d.package_id));
cout << endl << colour(cl_heading, msg) << endl << endl;
@@ -214,7 +212,7 @@ namespace
cerr << "Ambiguous unmerge target '" << e.target() << "'. Did you mean:" << endl;
for (AmbiguousUnmergeTargetError::Iterator o(e.begin()),
o_end(e.end()) ; o != o_end ; ++o)
- cerr << " * =" << colour(cl_package_name, *o) << endl;
+ cerr << " * =" << colour(cl_package_name, **o) << endl;
cerr << endl;
cerr << "Consider using --all-versions if appropriate." << endl;
cerr << endl;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index c7f69f54f..1a961aee5 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -30,7 +30,14 @@
#include <paludis/util/join.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/tr1_functional.hh>
#include <paludis/query.hh>
+#include <paludis/repository.hh>
+#include <paludis/package_database.hh>
+#include <paludis/eapi.hh>
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
@@ -52,17 +59,17 @@ UseDescriptionComparator::operator() (const UseDescription & lhs, const UseDescr
if (lhs.flag > rhs.flag)
return false;
- if (lhs.package.name < rhs.package.name)
+ if (lhs.package_id->name() < rhs.package_id->name())
return true;
- if (lhs.package.name > rhs.package.name)
+ if (lhs.package_id->name() > rhs.package_id->name())
return false;
- if (lhs.package.version < rhs.package.version)
+ if (lhs.package_id->version() < rhs.package_id->version())
return true;
- if (lhs.package.version < rhs.package.version)
+ if (lhs.package_id->version() < rhs.package_id->version())
return false;
- if (lhs.package.repository.data() < rhs.package.repository.data())
+ if (lhs.package_id->repository()->name().data() < rhs.package_id->repository()->name().data())
return true;
return false;
@@ -94,8 +101,7 @@ ConsoleInstallTask::on_build_deplist_post()
void
ConsoleInstallTask::on_build_cleanlist_pre(const DepListEntry & d)
{
- output_heading("Cleaning stale versions after installing " +
- stringify(d.package));
+ output_heading("Cleaning stale versions after installing " + stringify(*d.package_id));
}
void
@@ -105,13 +111,13 @@ ConsoleInstallTask::on_build_cleanlist_post(const DepListEntry &)
void
ConsoleInstallTask::on_clean_all_pre(const DepListEntry & d,
- const PackageDatabaseEntryCollection & c)
+ const PackageIDSequence & c)
{
display_clean_all_pre_list_start(d, c);
- for (PackageDatabaseEntryCollection::Iterator cc(c.begin()),
- cc_end(c.end()) ; cc != cc_end ; ++cc)
- display_one_clean_all_pre_list_entry(*cc);
+ using namespace tr1::placeholders;
+ std::for_each(indirect_iterator(c.begin()), indirect_iterator(c.end()),
+ tr1::bind(tr1::mem_fn(&ConsoleInstallTask::display_one_clean_all_pre_list_entry), this, _1));
display_clean_all_pre_list_end(d, c);
}
@@ -124,7 +130,7 @@ ConsoleInstallTask::on_no_clean_needed(const DepListEntry &)
void
ConsoleInstallTask::on_clean_pre(const DepListEntry &,
- const PackageDatabaseEntry & c)
+ const PackageID & c)
{
std::string m("(" + stringify(count<current_count>()) + " of "
+ stringify(count<max_count>()) + ") Cleaning " + stringify(c));
@@ -134,13 +140,13 @@ ConsoleInstallTask::on_clean_pre(const DepListEntry &,
void
ConsoleInstallTask::on_clean_post(const DepListEntry &,
- const PackageDatabaseEntry &)
+ const PackageID &)
{
}
void
ConsoleInstallTask::on_clean_fail(const DepListEntry &,
- const PackageDatabaseEntry & c)
+ const PackageID & c)
{
output_xterm_title("(" + stringify(count<current_count>()) + " of "
+ stringify(count<max_count>()) + ") Failed cleaning " + stringify(c));
@@ -148,7 +154,7 @@ ConsoleInstallTask::on_clean_fail(const DepListEntry &,
void
ConsoleInstallTask::on_clean_all_post(const DepListEntry &,
- const PackageDatabaseEntryCollection &)
+ const PackageIDSequence &)
{
}
@@ -220,9 +226,9 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
if (d.destination)
repo.reset(new RepositoryName(d.destination->name()));
- tr1::shared_ptr<PackageDatabaseEntryCollection> existing_repo(environment()->package_database()->
+ tr1::shared_ptr<const PackageIDSequence> existing_repo(environment()->package_database()->
query(query::Matches(PackageDepSpec(
- tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(d.package.name)),
+ tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(d.package_id->name())),
tr1::shared_ptr<CategoryNamePart>(),
tr1::shared_ptr<PackageNamePart>(),
tr1::shared_ptr<VersionRequirements>(),
@@ -231,14 +237,14 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
repo)),
qo_order_by_version));
- tr1::shared_ptr<PackageDatabaseEntryCollection> existing_slot_repo(environment()->package_database()->
+ tr1::shared_ptr<const PackageIDSequence> existing_slot_repo(environment()->package_database()->
query(query::Matches(PackageDepSpec(
- tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(d.package.name)),
+ tr1::shared_ptr<QualifiedPackageName>(new QualifiedPackageName(d.package_id->name())),
tr1::shared_ptr<CategoryNamePart>(),
tr1::shared_ptr<PackageNamePart>(),
tr1::shared_ptr<VersionRequirements>(),
vr_and,
- tr1::shared_ptr<SlotName>(new SlotName(d.metadata->slot)),
+ tr1::shared_ptr<SlotName>(new SlotName(d.package_id->slot())),
repo)),
qo_order_by_version));
@@ -247,8 +253,8 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_version(d, m);
display_merge_list_entry_repository(d, m);
- if (d.metadata->virtual_interface)
- display_merge_list_entry_for(*d.metadata->virtual_interface->virtual_for, m);
+ if (d.package_id->virtual_for_key())
+ display_merge_list_entry_for(*d.package_id->virtual_for_key()->value(), m);
display_merge_list_entry_slot(d, m);
@@ -272,7 +278,7 @@ ConsoleInstallTask::on_fetch_pre(const DepListEntry & d)
set_count<current_count>(count<current_count>() + 1);
std::string m("(" + stringify(count<current_count>()) + " of "
- + stringify(count<max_count>()) + ") Fetching " + stringify(d.package));
+ + stringify(count<max_count>()) + ") Fetching " + stringify(*d.package_id));
output_heading(m);
output_xterm_title(m);
@@ -299,7 +305,7 @@ ConsoleInstallTask::on_install_pre(const DepListEntry & d)
set_count<current_count>(count<current_count>() + 1);
std::string m("(" + stringify(count<current_count>()) + " of "
- + stringify(count<max_count>()) + ") Installing " + stringify(d.package));
+ + stringify(count<max_count>()) + ") Installing " + stringify(*d.package_id));
output_heading(m);
output_xterm_title(m);
@@ -314,7 +320,7 @@ void
ConsoleInstallTask::on_install_fail(const DepListEntry & d)
{
output_xterm_title("(" + stringify(count<current_count>()) + "of "
- + stringify(count<max_count>()) + ") Failed install of " + stringify(d.package));
+ + stringify(count<max_count>()) + ") Failed install of " + stringify(*d.package_id));
}
void
@@ -369,20 +375,20 @@ ConsoleInstallTask::on_preserve_world()
void
ConsoleInstallTask::display_clean_all_pre_list_start(const DepListEntry &,
- const PackageDatabaseEntryCollection &)
+ const PackageIDSequence &)
{
}
void
ConsoleInstallTask::display_one_clean_all_pre_list_entry(
- const PackageDatabaseEntry & c)
+ const PackageID & c)
{
output_starred_item(render_as_package_name(stringify(c)));
}
void
ConsoleInstallTask::display_clean_all_pre_list_end(const DepListEntry &,
- const PackageDatabaseEntryCollection &)
+ const PackageIDSequence &)
{
}
@@ -615,7 +621,7 @@ ConsoleInstallTask::display_use_summary_flag(const std::string & prefix,
for ( ; i != i_end ; ++i)
{
std::ostringstream s;
- s << i->description << " (for " << render_as_package_name(stringify(i->package)) << ")";
+ s << i->description << " (for " << render_as_package_name(stringify(*i->package_id)) << ")";
output_starred_item(s.str(), 1);
}
}
@@ -735,21 +741,21 @@ ConsoleInstallTask::display_merge_list_entry_package_name(const DepListEntry & d
{
case normal_entry:
case suggested_entry:
- output_no_endl(render_as_package_name(stringify(d.package.name)));
+ output_no_endl(render_as_package_name(stringify(d.package_id->name())));
break;
case unimportant_entry:
- output_no_endl(render_as_unimportant(stringify(d.package.name)));
+ output_no_endl(render_as_unimportant(stringify(d.package_id->name())));
break;
case error_entry:
- output_no_endl(render_as_error(stringify(d.package.name)));
+ output_no_endl(render_as_error(stringify(d.package_id->name())));
break;
}
}
void
-ConsoleInstallTask::display_merge_list_entry_for(const PackageDatabaseEntry & d, const DisplayMode m)
+ConsoleInstallTask::display_merge_list_entry_for(const PackageID & d, const DisplayMode m)
{
switch (m)
{
@@ -765,8 +771,8 @@ ConsoleInstallTask::display_merge_list_entry_for(const PackageDatabaseEntry & d,
case error_entry:
output_no_endl(" (for ");
- output_no_endl(render_as_package_name(stringify(d.name)));
- output_no_endl("-" + stringify(d.version) + "::" + stringify(d.repository));
+ output_no_endl(render_as_package_name(stringify(d.name())));
+ output_no_endl("-" + stringify(d.version()) + "::" + stringify(d.repository()->name()));
output_no_endl(")");
break;
}
@@ -775,16 +781,16 @@ ConsoleInstallTask::display_merge_list_entry_for(const PackageDatabaseEntry & d,
void
ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d, const DisplayMode)
{
- if ((VersionSpec("0") != d.package.version) ||
- CategoryNamePart("virtual") != d.package.name.category)
- output_no_endl("-" + stringify(d.package.version));
+ if ((VersionSpec("0") != d.package_id->version()) ||
+ CategoryNamePart("virtual") != d.package_id->name().category)
+ output_no_endl("-" + stringify(d.package_id->version()));
}
void
ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d, const DisplayMode)
{
- if (environment()->package_database()->favourite_repository() != d.package.repository)
- output_no_endl("::" + stringify(d.package.repository));
+ if (environment()->package_database()->favourite_repository() != d.package_id->repository()->name())
+ output_no_endl("::" + stringify(d.package_id->repository()->name()));
}
void
@@ -794,23 +800,23 @@ ConsoleInstallTask::display_merge_list_entry_slot(const DepListEntry & d, const
{
case normal_entry:
case suggested_entry:
- output_no_endl(render_as_slot_name(" {:" + stringify(d.metadata->slot) + "}"));
+ output_no_endl(render_as_slot_name(" {:" + stringify(d.package_id->slot()) + "}"));
break;
case unimportant_entry:
- output_no_endl(render_as_unimportant(" {:" + stringify(d.metadata->slot) + "}"));
+ output_no_endl(render_as_unimportant(" {:" + stringify(d.package_id->slot()) + "}"));
break;
case error_entry:
- output_no_endl(render_as_slot_name(" {:" + stringify(d.metadata->slot) + "}"));
+ output_no_endl(render_as_slot_name(" {:" + stringify(d.package_id->slot()) + "}"));
break;
}
}
void
ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepListEntry & d,
- tr1::shared_ptr<const PackageDatabaseEntryCollection> existing_repo,
- tr1::shared_ptr<const PackageDatabaseEntryCollection> existing_slot_repo,
+ tr1::shared_ptr<const PackageIDSequence> existing_repo,
+ tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
const DisplayMode m)
{
bool need_comma(false);
@@ -852,17 +858,17 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
set_count<new_slot_count>(count<new_slot_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
- else if (existing_slot_repo->last()->version < d.package.version)
+ else if ((*existing_slot_repo->last())->version() < d.package_id->version())
{
output_no_endl(render_as_update_mode("U " +
- stringify(existing_slot_repo->last()->version) + "" + destination_str));
+ stringify((*existing_slot_repo->last())->version()) + destination_str));
set_count<upgrade_count>(count<upgrade_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
- else if (existing_slot_repo->last()->version > d.package.version)
+ else if ((*existing_slot_repo->last())->version() > d.package_id->version())
{
output_no_endl(render_as_update_mode("D " +
- stringify(existing_slot_repo->last()->version) + "" + destination_str));
+ stringify((*existing_slot_repo->last())->version()) + destination_str));
set_count<downgrade_count>(count<downgrade_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
@@ -909,30 +915,29 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
void
ConsoleInstallTask::_add_descriptions(tr1::shared_ptr<const UseFlagNameCollection> c,
- const PackageDatabaseEntry & p, UseDescriptionState s)
+ const tr1::shared_ptr<const PackageID> & p, UseDescriptionState s)
{
for (UseFlagNameCollection::Iterator f(c->begin()), f_end(c->end()) ;
f != f_end ; ++f)
{
std::string d;
- const RepositoryUseInterface * const i(environment()->package_database()->
- fetch_repository(p.repository)->use_interface);
+ const RepositoryUseInterface * const i(p->repository()->use_interface);
if (i)
- d = i->describe_use_flag(*f, p);
+ d = i->describe_use_flag(*f, *p);
_all_use_descriptions->insert(UseDescription::create()
.flag(*f)
.state(s)
- .package(p)
+ .package_id(p)
.description(d));
}
}
void
ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
- tr1::shared_ptr<const PackageDatabaseEntryCollection> existing_repo,
- tr1::shared_ptr<const PackageDatabaseEntryCollection> existing_slot_repo,
+ tr1::shared_ptr<const PackageIDSequence> existing_repo,
+ tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
const DisplayMode m)
{
if (normal_entry != m && suggested_entry != m)
@@ -940,12 +945,12 @@ ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
output_no_endl(" ");
tr1::shared_ptr<UseFlagPrettyPrinter> printer(make_use_flag_pretty_printer());
- printer->print_package_flags(d.package, ! existing_slot_repo->empty() ? &*existing_slot_repo->last() :
- ! existing_repo->empty() ? &*existing_repo->last() : 0);
+ printer->print_package_flags(*d.package_id, ! existing_slot_repo->empty() ? existing_slot_repo->last()->get() :
+ ! existing_repo->empty() ? existing_repo->last()->get() : 0);
- _add_descriptions(printer->new_flags(), d.package, uds_new);
- _add_descriptions(printer->changed_flags(), d.package, uds_changed);
- _add_descriptions(printer->unchanged_flags(), d.package, uds_unchanged);
+ _add_descriptions(printer->new_flags(), d.package_id, uds_new);
+ _add_descriptions(printer->changed_flags(), d.package_id, uds_changed);
+ _add_descriptions(printer->unchanged_flags(), d.package_id, uds_unchanged);
_all_expand_prefixes->insert(printer->expand_prefixes()->begin(),
printer->expand_prefixes()->end());
}
@@ -1116,7 +1121,7 @@ EntryDepTagDisplayer::visit(const GeneralSetDepTag & tag)
void
ConsoleInstallTask::display_merge_list_entry_mask_reasons(const DepListEntry & e)
{
- MaskReasons r(environment()->mask_reasons(e.package));
+ MaskReasons r(environment()->mask_reasons(*e.package_id));
bool need_comma(false);
output_no_endl(" Masked by: ");
@@ -1130,8 +1135,7 @@ ConsoleInstallTask::display_merge_list_entry_mask_reasons(const DepListEntry & e
if (mr_eapi == mm)
{
- std::string eapi_str(environment()->package_database()->fetch_repository(
- e.package.repository)->version_metadata(e.package.name, e.package.version)->eapi->name);
+ std::string eapi_str(e.package_id->eapi()->name);
if (eapi_str == "UNKNOWN")
output_no_endl(" ( " + render_as_masked(eapi_str) + " ) (probably a broken ebuild)");
@@ -1140,24 +1144,19 @@ ConsoleInstallTask::display_merge_list_entry_mask_reasons(const DepListEntry & e
}
else if (mr_license == mm)
{
- tr1::shared_ptr<const VersionMetadata> metadata(environment()->package_database()->fetch_repository(
- e.package.repository)->version_metadata(e.package.name, e.package.version));
-
- if (metadata->license_interface)
+ if (e.package_id->license_key())
{
output_no_endl(" ");
- LicenceDisplayer ld(output_stream(), environment(), e.package);
- metadata->license_interface->license()->accept(ld);
+ LicenceDisplayer ld(output_stream(), environment(), e.package_id);
+ e.package_id->license_key()->value()->accept(ld);
}
}
else if (mr_keyword == mm)
{
- tr1::shared_ptr<const VersionMetadata> meta(environment()->package_database()->fetch_repository(
- e.package.repository)->version_metadata(e.package.name, e.package.version));
- if (meta->ebuild_interface)
+ if (e.package_id->keywords_key())
{
- tr1::shared_ptr<const KeywordNameCollection> keywords(meta->ebuild_interface->keywords());
+ tr1::shared_ptr<const KeywordNameCollection> keywords(e.package_id->keywords_key()->value());
output_no_endl(" ( " + render_as_masked(join(keywords->begin(), keywords->end(), " ")) + " )");
}
}
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index c61960bdd..3efde75ab 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -21,7 +21,6 @@
#define PALUDIS_GUARD_SRC_CONSOLE_INSTALL_TASK_HH 1
#include <paludis/tasks/install_task.hh>
-#include <paludis/package_database_entry.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <src/output/use_flag_pretty_printer.hh>
#include <src/output/console_task.hh>
@@ -121,7 +120,7 @@ namespace paludis
tr1::shared_ptr<UseFlagNameCollection> _all_expand_prefixes;
void _add_descriptions(tr1::shared_ptr<const UseFlagNameCollection>,
- const PackageDatabaseEntry &, UseDescriptionState);
+ const tr1::shared_ptr<const PackageID> &, UseDescriptionState);
protected:
ConsoleInstallTask(Environment * const env, const DepListOptions & options,
@@ -152,15 +151,15 @@ namespace paludis
virtual void on_no_clean_needed(const DepListEntry &);
virtual void on_clean_all_pre(const DepListEntry &,
- const PackageDatabaseEntryCollection &);
+ const PackageIDSequence &);
virtual void on_clean_pre(const DepListEntry &,
- const PackageDatabaseEntry &);
+ const PackageID &);
virtual void on_clean_post(const DepListEntry &,
- const PackageDatabaseEntry &);
+ const PackageID &);
virtual void on_clean_fail(const DepListEntry &,
- const PackageDatabaseEntry &);
+ const PackageID &);
virtual void on_clean_all_post(const DepListEntry &,
- const PackageDatabaseEntryCollection &);
+ const PackageIDSequence &);
virtual void on_update_world_pre();
virtual void on_update_world(const PackageDepSpec &);
@@ -174,11 +173,11 @@ namespace paludis
///\{
virtual void display_clean_all_pre_list_start(const DepListEntry &,
- const PackageDatabaseEntryCollection &);
+ const PackageIDSequence &);
virtual void display_one_clean_all_pre_list_entry(
- const PackageDatabaseEntry &);
+ const PackageID &);
virtual void display_clean_all_pre_list_end(const DepListEntry &,
- const PackageDatabaseEntryCollection &);
+ const PackageIDSequence &);
virtual void display_merge_list_post_counts();
virtual void display_merge_list_post_tags();
@@ -188,13 +187,13 @@ namespace paludis
virtual void display_merge_list_entry_version(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_repository(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_slot(const DepListEntry &, const DisplayMode);
- virtual void display_merge_list_entry_for(const PackageDatabaseEntry &, const DisplayMode);
+ virtual void display_merge_list_entry_for(const PackageID &, const DisplayMode);
virtual void display_merge_list_entry_status_and_update_counts(const DepListEntry &,
- tr1::shared_ptr<const PackageDatabaseEntryCollection>,
- tr1::shared_ptr<const PackageDatabaseEntryCollection>, const DisplayMode);
+ tr1::shared_ptr<const PackageIDSequence>,
+ tr1::shared_ptr<const PackageIDSequence>, const DisplayMode);
virtual void display_merge_list_entry_use(const DepListEntry &,
- tr1::shared_ptr<const PackageDatabaseEntryCollection>,
- tr1::shared_ptr<const PackageDatabaseEntryCollection>, const DisplayMode);
+ tr1::shared_ptr<const PackageIDSequence>,
+ tr1::shared_ptr<const PackageIDSequence>, const DisplayMode);
virtual void display_merge_list_entry_tags(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_end(const DepListEntry &, const DisplayMode);
diff --git a/src/output/console_install_task.sr b/src/output/console_install_task.sr
index b7a02bf26..acc01f10b 100644
--- a/src/output/console_install_task.sr
+++ b/src/output/console_install_task.sr
@@ -6,7 +6,7 @@ make_class_UseDescription()
visible
key flag UseFlagName
- key package PackageDatabaseEntry
+ key package_id "tr1::shared_ptr<const PackageID>"
key state UseDescriptionState
key description std::string
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index 7bb602a40..9383421c8 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -28,6 +28,10 @@
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include <paludis/query.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/eapi.hh>
+#include <paludis/package_database.hh>
+#include <paludis/dep_spec_pretty_printer.hh>
#include <list>
using namespace paludis;
@@ -57,11 +61,11 @@ ConsoleQueryTask::~ConsoleQueryTask()
}
void
-ConsoleQueryTask::show(const PackageDepSpec & a, const PackageDatabaseEntry * display_entry) const
+ConsoleQueryTask::show(const PackageDepSpec & a, const PackageID * display_entry) const
{
/* prefer the best installed version, then the best visible version, then
* the best version */
- tr1::shared_ptr<const PackageDatabaseEntryCollection>
+ tr1::shared_ptr<const PackageIDSequence>
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));
@@ -72,11 +76,11 @@ ConsoleQueryTask::show(const PackageDepSpec & a, const PackageDatabaseEntry * di
if (! display_entry)
{
- display_entry = &*preferred_entries->last();
- for (PackageDatabaseEntryCollection::Iterator i(preferred_entries->begin()),
+ display_entry = preferred_entries->last()->get();
+ for (PackageIDSequence::Iterator i(preferred_entries->begin()),
i_end(preferred_entries->end()) ; i != i_end ; ++i)
- if (! _imp->env->mask_reasons(*i).any())
- display_entry = &*i;
+ if (! _imp->env->mask_reasons(**i).any())
+ display_entry = i->get();
}
display_header(a, *display_entry);
@@ -86,25 +90,26 @@ ConsoleQueryTask::show(const PackageDepSpec & a, const PackageDatabaseEntry * di
}
void
-ConsoleQueryTask::display_header(const PackageDepSpec & a, const PackageDatabaseEntry & e) const
+ConsoleQueryTask::display_header(const PackageDepSpec & a, const PackageID & e) const
{
if (a.version_requirements_ptr() || a.slot_ptr() || a.use_requirements_ptr() ||
a.repository_ptr())
output_starred_item(render_as_package_name(stringify(a)));
else
- output_starred_item(render_as_package_name(stringify(e.name)));
+ output_starred_item(render_as_package_name(stringify(e.name())));
}
void
ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
- tr1::shared_ptr<const PackageDatabaseEntryCollection> entries,
- const PackageDatabaseEntry & display_entry) const
+ tr1::shared_ptr<const PackageIDSequence> entries,
+ const PackageID & display_entry) const
{
/* find all repository names. */
RepositoryNameCollection::Concrete repo_names;
- PackageDatabaseEntryCollection::Iterator e(entries->begin()), e_end(entries->end());
+ PackageIDSequence::Iterator e(entries->begin()), e_end(entries->end());
for ( ; e != e_end ; ++e)
- repo_names.append(e->repository);
+ if (repo_names.end() == std::find(repo_names.begin(), repo_names.end(), (*e)->repository()->name()))
+ repo_names.push_back((*e)->repository()->name());
/* display versions, by repository. */
RepositoryNameCollection::Iterator r(repo_names.begin()), r_end(repo_names.end());
@@ -115,26 +120,22 @@ ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
std::string old_slot, right_column;
for (e = entries->begin() ; e != e_end ; ++e)
{
- Context context("When displaying entry '" + stringify(*e) + "':'");
+ Context context("When displaying entry '" + stringify(**e) + "':'");
- if (e->repository == *r)
+ if ((*e)->repository()->name() == *r)
{
- tr1::shared_ptr<const VersionMetadata> metadata(
- _imp->env->package_database()->fetch_repository(e->repository)->version_metadata(e->name,
- e->version));
-
/* show the slot, if we're about to move onto a new slot */
- std::string slot_name(stringify(metadata->slot));
+ std::string slot_name(stringify((*e)->slot()));
if (old_slot.empty())
old_slot = slot_name;
else if (old_slot != slot_name)
right_column.append(render_as_slot_name("{:" + old_slot + "} "));
old_slot = slot_name;
- const MaskReasons masks(_imp->env->mask_reasons(*e));
+ const MaskReasons masks(_imp->env->mask_reasons(**e));
if (masks.none())
- right_column.append(render_as_visible(stringify(e->version)));
+ right_column.append(render_as_visible((*e)->canonical_form(idcf_version)));
else
{
std::string reasons;
@@ -173,18 +174,15 @@ ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
case mr_breaks_portage:
reasons.append("B");
break;
- case mr_interactive:
- reasons.append("I");
- break;
case last_mr:
break;
}
}
_imp->mask_reasons_to_explain |= masks;
- right_column.append(render_as_masked("(" + stringify(e->version) + ")" + reasons));
+ right_column.append(render_as_masked("(" + (*e)->canonical_form(idcf_version) + ")" + reasons));
}
- if (*e == display_entry)
+ if (**e == display_entry)
right_column.append("*");
right_column.append(" ");
}
@@ -197,60 +195,80 @@ ConsoleQueryTask::display_versions_by_repository(const PackageDepSpec &,
}
}
-void
-ConsoleQueryTask::display_metadata(const PackageDepSpec &, const PackageDatabaseEntry & e) const
+namespace
{
- tr1::shared_ptr<const VersionMetadata> metadata(_imp->env->package_database()->fetch_repository(e.repository)->
- version_metadata(e.name, e.version));
-
- if (! metadata->eapi->supported)
+ class Displayer :
+ public ConstVisitor<MetadataKeyVisitorTypes>
{
- display_metadata_key("EAPI", "EAPI", metadata->eapi->name);
- return;
- }
+ private:
+ const ConsoleQueryTask * const task;
- display_metadata_uri("Homepage", "HOMEPAGE", metadata->homepage(), true);
- display_metadata_key("Description", "DESCRIPTION", metadata->description);
+ public:
+ Displayer(const ConsoleQueryTask * const t) :
+ task(t)
+ {
+ }
- if (metadata->license_interface)
- display_metadata_license("License", "LICENSE", metadata->license_interface->license(), e);
+ void visit(const MetadataCollectionKey<IUseFlagCollection> &)
+ {
+ }
- if (want_deps() && metadata->deps_interface)
- {
- display_metadata_dependency("Build dependencies", "DEPEND", metadata->deps_interface->build_depend(), want_raw());
- display_metadata_dependency("Runtime dependencies", "RDEPEND", metadata->deps_interface->run_depend(), want_raw());
- display_metadata_dependency("Post dependencies", "PDEPEND", metadata->deps_interface->post_depend(), want_raw());
- display_metadata_dependency("Suggested dependencies", "SDEPEND", metadata->deps_interface->suggested_depend(), want_raw());
- }
+ void visit(const MetadataCollectionKey<InheritedCollection> &)
+ {
+ }
- if (metadata->origins_interface)
- {
- if (metadata->origins_interface->source)
- display_metadata_pde("Source origin", "SOURCE_ORIGIN", *metadata->origins_interface->source);
- if (metadata->origins_interface->binary)
- display_metadata_pde("Binary origin", "BINARY_ORIGIN", *metadata->origins_interface->binary);
- }
+ void visit(const MetadataCollectionKey<UseFlagNameCollection> &)
+ {
+ }
- if (0 != _imp->env->package_database()->fetch_repository(e.repository)->installed_interface)
- display_metadata_time("Installed time", "INSTALLED_TIME", _imp->env->package_database()->fetch_repository(
- e.repository)->installed_interface->installed_time(e.name, e.version));
+ void visit(const MetadataCollectionKey<KeywordNameCollection> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
+ {
+ task->display_metadata_dependency(k.human_name(), k.raw_name(), k.value(), false);
+ }
- if (metadata->ebuild_interface)
+ void visit(const MetadataSpecTreeKey<URISpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> &)
+ {
+ }
+
+ void visit(const MetadataPackageIDKey & k)
+ {
+ task->display_metadata_pde(k.human_name(), k.raw_name(), *k.value());
+ }
+
+ void visit(const MetadataStringKey & k)
+ {
+ task->display_metadata_key(k.human_name(), k.raw_name(), k.value());
+ }
+ };
+}
+
+void
+ConsoleQueryTask::display_metadata(const PackageDepSpec &, const PackageID & id) const
+{
+ if (! id.eapi()->supported)
{
- display_metadata_provides("Provides", "PROVIDE", metadata->ebuild_interface->provide(), true);
- display_metadata_iuse("Use flags", "IUSE", join(metadata->ebuild_interface->iuse()->begin(),
- metadata->ebuild_interface->iuse()->end(), " "), e);
- if (want_raw())
- {
- display_metadata_key("Keywords", "KEYWORDS", join(metadata->ebuild_interface->keywords()->begin(),
- metadata->ebuild_interface->keywords()->end(), " "));
- display_metadata_uri("SRC_URI", "SRC_URI", metadata->ebuild_interface->src_uri(), true);
- display_metadata_restrict("Restrict", "RESTRICT", metadata->ebuild_interface->restrictions(), true);
- }
+ display_metadata_key("EAPI", "EAPI", id.eapi()->name);
+ return;
}
- if (metadata->virtual_interface)
- display_metadata_pde("Virtual for", "VIRTUAL_FOR", *metadata->virtual_interface->virtual_for);
+ Displayer d(this);
+ std::for_each(id.begin(), id.end(), accept_visitor(d));
}
namespace
@@ -275,7 +293,7 @@ ConsoleQueryTask::display_metadata_key(const std::string & k, const std::string
void
ConsoleQueryTask::display_metadata_license(const std::string & k, const std::string & kk, tr1::shared_ptr<const LicenseSpecTree::ConstItem> l,
- const PackageDatabaseEntry & display_entry) const
+ const tr1::shared_ptr<const PackageID> & display_entry) const
{
output_left_column((want_raw() ? kk : k) + ":");
@@ -399,14 +417,10 @@ ConsoleQueryTask::display_metadata_restrict(const std::string & k, const std::st
void
ConsoleQueryTask::display_metadata_pde(const std::string & k, const std::string & kk,
- const PackageDatabaseEntry & v) const
+ const PackageID & v) const
{
output_left_column((want_raw() ? kk : k) + ":");
- if (want_raw())
- output_right_column(stringify(v));
- else
- output_right_column(render_as_package_name(stringify(v.name)) + "-"
- + stringify(v.version) + "::" + stringify(v.repository));
+ output_right_column(stringify(v));
}
void
@@ -434,7 +448,7 @@ ConsoleQueryTask::display_metadata_time(const std::string & k, const std::string
void
ConsoleQueryTask::display_metadata_iuse(const std::string & k, const std::string & kk,
- const std::string & v, const PackageDatabaseEntry & e) const
+ const std::string & v, const PackageID & e) const
{
if (v.empty())
return;
diff --git a/src/output/console_query_task.hh b/src/output/console_query_task.hh
index db5f735d1..81eca3da0 100644
--- a/src/output/console_query_task.hh
+++ b/src/output/console_query_task.hh
@@ -22,7 +22,6 @@
#include <paludis/environment.hh>
#include <paludis/dep_spec.hh>
-#include <paludis/package_database_entry.hh>
#include <src/output/console_task.hh>
namespace paludis
@@ -37,17 +36,17 @@ namespace paludis
public:
virtual ~ConsoleQueryTask();
- virtual void show(const PackageDepSpec &, const PackageDatabaseEntry * = 0) const;
+ virtual void show(const PackageDepSpec &, const PackageID * = 0) const;
- virtual void display_header(const PackageDepSpec &, const PackageDatabaseEntry &) const;
+ virtual void display_header(const PackageDepSpec &, const PackageID &) const;
virtual void display_versions_by_repository(const PackageDepSpec &,
- tr1::shared_ptr<const PackageDatabaseEntryCollection>, const PackageDatabaseEntry &) const;
- virtual void display_metadata(const PackageDepSpec &, const PackageDatabaseEntry &) const;
+ tr1::shared_ptr<const PackageIDSequence>, const PackageID &) const;
+ virtual void display_metadata(const PackageDepSpec &, const PackageID &) const;
virtual void display_metadata_key(const std::string &, const std::string &,
const std::string &) const;
virtual void display_metadata_license(const std::string &, const std::string &,
- tr1::shared_ptr<const LicenseSpecTree::ConstItem>, const PackageDatabaseEntry &) const;
+ tr1::shared_ptr<const LicenseSpecTree::ConstItem>, const tr1::shared_ptr<const PackageID> &) const;
virtual void display_metadata_dependency(const std::string &, const std::string &,
tr1::shared_ptr<const DependencySpecTree::ConstItem>, const bool one_line) const;
virtual void display_metadata_provides(const std::string &, const std::string &,
@@ -56,10 +55,10 @@ namespace paludis
tr1::shared_ptr<const URISpecTree::ConstItem>, const bool one_line) const;
virtual void display_metadata_restrict(const std::string &, const std::string &,
tr1::shared_ptr<const RestrictSpecTree::ConstItem>, const bool one_line) const;
- virtual void display_metadata_pde(const std::string &, const std::string &, const PackageDatabaseEntry &) const;
+ virtual void display_metadata_pde(const std::string &, const std::string &, const PackageID &) const;
virtual void display_metadata_time(const std::string &, const std::string &, time_t) const;
virtual void display_metadata_iuse(const std::string &, const std::string &, const std::string &,
- const PackageDatabaseEntry &) const;
+ const PackageID &) const;
virtual bool want_deps() const = 0;
virtual bool want_raw() const = 0;
diff --git a/src/output/console_task.cc b/src/output/console_task.cc
index 60f9e9103..5125e880d 100644
--- a/src/output/console_task.cc
+++ b/src/output/console_task.cc
@@ -182,6 +182,6 @@ ConsoleTask::output_right_column(const std::string & s) const
int
ConsoleTask::left_column_width() const
{
- return 18;
+ return 24;
}
diff --git a/src/output/licence.cc b/src/output/licence.cc
index 027d6845c..aebb50e63 100644
--- a/src/output/licence.cc
+++ b/src/output/licence.cc
@@ -19,6 +19,8 @@
#include "licence.hh"
#include "colour.hh"
+#include <paludis/dep_spec.hh>
+#include <paludis/environment.hh>
#include <ostream>
#include <algorithm>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -61,7 +63,7 @@ LicenceDisplayer::visit_sequence(const UseDepSpec & spec,
void
LicenceDisplayer::visit_leaf(const PlainTextDepSpec & spec)
{
- if (env->accept_license(spec.text(), db_entry))
+ if (env->accept_license(spec.text(), *package_id))
stream << colour(cl_not_masked, spec.text());
else
stream << colour(cl_masked, "(" + spec.text() + ")!");
@@ -71,10 +73,10 @@ LicenceDisplayer::visit_leaf(const PlainTextDepSpec & spec)
LicenceDisplayer::LicenceDisplayer(
std::ostream & s,
const Environment * const e,
- const PackageDatabaseEntry & d) :
+ const tr1::shared_ptr<const PackageID> & d) :
stream(s),
env(e),
- db_entry(d)
+ package_id(d)
{
}
diff --git a/src/output/licence.hh b/src/output/licence.hh
index 33c06c40e..6677425a0 100644
--- a/src/output/licence.hh
+++ b/src/output/licence.hh
@@ -20,7 +20,9 @@
#ifndef PALUDIS_GUARD_SRC_LICENCE_HH
#define PALUDIS_GUARD_SRC_LICENCE_HH 1
-#include <paludis/paludis.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
+#include <paludis/dep_spec-fwd.hh>
#include <iosfwd>
/**
@@ -36,13 +38,13 @@ struct PALUDIS_VISIBLE LicenceDisplayer :
const paludis::Environment * const env;
/// Our db entry.
- const paludis::PackageDatabaseEntry db_entry;
+ const paludis::tr1::shared_ptr<const paludis::PackageID> package_id;
/// Constructor.
LicenceDisplayer(
std::ostream & stream,
const paludis::Environment * const e,
- const paludis::PackageDatabaseEntry & d);
+ const paludis::tr1::shared_ptr<const paludis::PackageID> & d);
///\name Visit methods
///{
diff --git a/src/output/use_flag_pretty_printer.cc b/src/output/use_flag_pretty_printer.cc
index efb85a043..49aea96d5 100644
--- a/src/output/use_flag_pretty_printer.cc
+++ b/src/output/use_flag_pretty_printer.cc
@@ -18,12 +18,13 @@
*/
#include "use_flag_pretty_printer.hh"
-#include <paludis/version_metadata.hh>
#include <paludis/environment.hh>
+#include <paludis/package_id.hh>
#include <paludis/package_database.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/iterator.hh>
#include <paludis/util/tr1_functional.hh>
+#include <paludis/metadata_key.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
#include "colour.hh"
@@ -57,31 +58,22 @@ UseFlagPrettyPrinter::use_expand_delim_pos(const UseFlagName & u,
}
void
-UseFlagPrettyPrinter::print_package_flags(const PackageDatabaseEntry & pkg,
- const PackageDatabaseEntry * const old_pkg)
+UseFlagPrettyPrinter::print_package_flags(const PackageID & pkg,
+ const PackageID * const old_pkg)
{
std::set<UseFlagName> iuse, old_iuse;
- tr1::shared_ptr<const VersionMetadata> metadata(environment()->package_database()->
- fetch_repository(pkg.repository)->version_metadata(pkg.name, pkg.version));
-
- if (! metadata->ebuild_interface)
+ if (! pkg.iuse_key())
return;
- std::copy(metadata->ebuild_interface->iuse()->begin(), metadata->ebuild_interface->iuse()->end(),
+ std::copy(pkg.iuse_key()->value()->begin(), pkg.iuse_key()->value()->end(),
transform_inserter(std::inserter(iuse, iuse.begin()), tr1::mem_fn(&IUseFlag::flag)));
- if (old_pkg)
- {
- tr1::shared_ptr<const VersionMetadata> old_metadata(environment()->package_database()->
- fetch_repository(old_pkg->repository)->version_metadata(old_pkg->name, old_pkg->version));
- if (old_metadata->ebuild_interface)
- std::copy(old_metadata->ebuild_interface->iuse()->begin(), old_metadata->ebuild_interface->iuse()->end(),
- transform_inserter(std::inserter(old_iuse, old_iuse.begin()), tr1::mem_fn(&IUseFlag::flag)));
- }
+ if (old_pkg && old_pkg->iuse_key())
+ std::copy(old_pkg->iuse_key()->value()->begin(), old_pkg->iuse_key()->value()->end(),
+ transform_inserter(std::inserter(old_iuse, old_iuse.begin()), tr1::mem_fn(&IUseFlag::flag)));
- const RepositoryUseInterface * const use_interface(environment()->package_database()->
- fetch_repository(pkg.repository)->use_interface);
+ const RepositoryUseInterface * const use_interface(pkg.repository()->use_interface);
/* first pass: only non-expand flags */
for (std::set<UseFlagName>::const_iterator flag(iuse.begin()), flag_end(iuse.end()) ;
diff --git a/src/output/use_flag_pretty_printer.hh b/src/output/use_flag_pretty_printer.hh
index 3b93e06ef..ef07c19f6 100644
--- a/src/output/use_flag_pretty_printer.hh
+++ b/src/output/use_flag_pretty_printer.hh
@@ -20,13 +20,14 @@
#ifndef PALUDIS_GUARD_SRC_USE_FLAG_PRETTY_PRINTER_HH
#define PALUDIS_GUARD_SRC_USE_FLAG_PRETTY_PRINTER_HH 1
-#include <paludis/name.hh>
+#include <paludis/name-fwd.hh>
+#include <paludis/environment-fwd.hh>
+#include <paludis/package_id-fwd.hh>
#include <iosfwd>
namespace paludis
{
class Environment;
- class PackageDatabaseEntry;
class PALUDIS_VISIBLE UseFlagPrettyPrinter
{
@@ -47,8 +48,7 @@ namespace paludis
UseFlagPrettyPrinter(const Environment * const);
virtual ~UseFlagPrettyPrinter();
- virtual void print_package_flags(const PackageDatabaseEntry &,
- const PackageDatabaseEntry * const = 0);
+ virtual void print_package_flags(const PackageID &, const PackageID * const = 0);
virtual void output_flag(const std::string &);
virtual void output_flag_changed_mark();