aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-11 07:36:03 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-11 07:36:03 +0000
commiteaf9262eca8282712dbb90da8d0c0b8d41c5ce11 (patch)
tree22edc780df369fe8b7a6104f47e974fca624d95a
parentef493c9f183464bce7bdb7bcc26b502ce95349e8 (diff)
downloadpaludis-eaf9262eca8282712dbb90da8d0c0b8d41c5ce11.tar.gz
paludis-eaf9262eca8282712dbb90da8d0c0b8d41c5ce11.tar.xz
Start work on the enhanced deplist
-rw-r--r--paludis/dep_list/dep_list.cc120
-rw-r--r--paludis/dep_list/dep_list.hh9
-rw-r--r--paludis/dep_list/dep_list.sr3
-rw-r--r--paludis/dep_list/dep_list_TEST.cc2
-rw-r--r--paludis/dep_list/options.hh17
-rw-r--r--paludis/tasks/install_task.cc13
-rw-r--r--paludis/tasks/install_task.hh2
-rw-r--r--ruby/dep_list.cc22
-rw-r--r--ruby/dep_list_TEST.rb1
-rw-r--r--src/clients/contrarius/install.cc5
-rw-r--r--src/clients/gtkpaludis/install.cc5
-rw-r--r--src/clients/gtkpaludis/install.hh1
-rw-r--r--src/clients/gtkpaludis/queue_list.cc2
-rw-r--r--src/clients/paludis/install.cc5
-rw-r--r--src/output/console_install_task.cc263
-rw-r--r--src/output/console_install_task.hh28
16 files changed, 385 insertions, 113 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 80c3f9b..f778982 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -80,6 +80,8 @@ namespace paludis
DepAtom::ConstPointer current_top_level_target;
+ bool throw_on_blocker;
+
const PackageDatabaseEntry * current_pde() const
{
if (current_merge_list_entry != merge_list.end())
@@ -93,7 +95,8 @@ namespace paludis
current_merge_list_entry(merge_list.end()),
merge_list_insert_position(merge_list.end()),
merge_list_generation(0),
- current_top_level_target(0)
+ current_top_level_target(0),
+ throw_on_blocker(false)
{
}
};
@@ -209,7 +212,24 @@ namespace
bool operator() (const std::pair<const QualifiedPackageName, MergeList::const_iterator> & e)
{
- return match_package(env, a, e.second->package);
+ switch (e.second->kind)
+ {
+ case dlk_virtual:
+ case dlk_package:
+ case dlk_provided:
+ case dlk_already_installed:
+ case dlk_subpackage:
+ return match_package(env, a, e.second->package);
+
+ case dlk_block:
+ case dlk_masked:
+ return false;
+
+ case last_dlk:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad e.second->kind");
}
};
@@ -569,6 +589,7 @@ DepList::AddVisitor::visit(const AnyDepAtom * const a)
{
try
{
+ Save<bool> save_t(&d->_imp->throw_on_blocker, true);
d->add(*c);
return;
}
@@ -624,7 +645,23 @@ DepList::AddVisitor::visit(const BlockDepAtom * const a)
}
}
- throw BlockError(stringify(*a->blocked_atom()));
+ if (d->_imp->throw_on_blocker)
+ throw BlockError(stringify(*a->blocked_atom()));
+ else
+ {
+ PackageDatabaseEntryCollection::ConstPointer m(d->_imp->env->package_database()->query(
+ *a->blocked_atom(), is_installed_only, qo_order_by_version));
+ if (m->empty())
+ {
+ /* this happens if we match an already on the list package, so always
+ * throw */
+ throw BlockError(stringify(*a->blocked_atom()));
+ }
+ else
+ for (PackageDatabaseEntryCollection::Iterator p(m->begin()), p_end(m->end()) ;
+ p != p_end ; ++p)
+ d->add_blocked_package(*p);
+ }
}
void
@@ -691,7 +728,7 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
.state(dle_no_deps)
.tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
.destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
- .skip_install(metadata->get_virtual_interface()))),
+ .kind(metadata->get_virtual_interface() ? dlk_virtual : dlk_package))),
our_merge_entry_post_position(our_merge_entry_position);
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry_position));
@@ -750,7 +787,7 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
.state(dle_has_all_deps)
.tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
.destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
- .skip_install(m->get_virtual_interface())));
+ .kind(dlk_provided)));
_imp->merge_list_index.insert(std::make_pair((*i)->text(), our_merge_entry_post_position));
}
}
@@ -771,6 +808,44 @@ DepList::add_package(const PackageDatabaseEntry & p, DepTag::ConstPointer tag)
}
void
+DepList::add_blocked_package(const PackageDatabaseEntry & p)
+{
+ std::pair<MergeListIndex::iterator, MergeListIndex::const_iterator> pp(
+ _imp->merge_list_index.equal_range(p.name));
+
+ for ( ; pp.first != pp.second ; ++pp.first)
+ {
+ if (pp.first->second->kind == dlk_block && pp.first->second->package == p)
+ {
+ if (_imp->current_pde())
+ pp.first->second->tags->insert(DepTagEntry::create()
+ .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .generation(_imp->merge_list_generation));
+ return;
+ }
+ }
+
+ MergeList::iterator our_merge_entry_position(
+ _imp->merge_list.insert(_imp->merge_list.begin(),
+ DepListEntry::create()
+ .package(p)
+ .metadata(_imp->env->package_database()->fetch_repository(
+ p.repository)->version_metadata(p.name, p.version))
+ .generation(_imp->merge_list_generation)
+ .state(dle_has_all_deps)
+ .tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
+ .destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
+ .kind(dlk_block)));
+
+ if (_imp->current_pde())
+ our_merge_entry_position->tags->insert(DepTagEntry::create()
+ .tag(DepTag::Pointer(new DependencyDepTag(*_imp->current_pde())))
+ .generation(_imp->merge_list_generation));
+
+ _imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry_position));
+}
+
+void
DepList::add_predeps(DepAtom::ConstPointer d, const DepListDepsOption opt, const std::string & s)
{
if (dl_deps_pre == opt || dl_deps_pre_or_post == opt)
@@ -827,7 +902,7 @@ DepList::add_already_installed_package(const PackageDatabaseEntry & p, DepTag::C
.tags(DepListEntryTags::Pointer(new DepListEntryTags::Concrete))
.state(dle_has_pre_deps)
.destinations(RepositoryNameCollection::Pointer(new RepositoryNameCollection::Concrete))
- .skip_install(true)));
+ .kind(dlk_already_installed)));
_imp->merge_list_index.insert(std::make_pair(p.name, our_merge_entry));
if (tag)
@@ -1087,4 +1162,37 @@ DepList::is_top_level_target(const PackageDatabaseEntry & e) const
return t(e);
}
+namespace
+{
+ struct IsError
+ {
+ bool operator() (const DepListEntry & e) const
+ {
+ switch (e.kind)
+ {
+ case dlk_virtual:
+ case dlk_package:
+ case dlk_provided:
+ case dlk_already_installed:
+ case dlk_subpackage:
+ return false;
+
+ case dlk_block:
+ case dlk_masked:
+ return true;
+
+ case last_dlk:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad e.kind");
+ }
+ };
+}
+
+bool
+DepList::has_errors() const
+{
+ return end() != std::find_if(begin(), end(), IsError());
+}
diff --git a/paludis/dep_list/dep_list.hh b/paludis/dep_list/dep_list.hh
index 51de69c..87f17e3 100644
--- a/paludis/dep_list/dep_list.hh
+++ b/paludis/dep_list/dep_list.hh
@@ -59,10 +59,14 @@ namespace paludis
void add_in_role(DepAtom::ConstPointer, const std::string & role);
bool prefer_installed_over_uninstalled(const PackageDatabaseEntry &,
const PackageDatabaseEntry &);
+
void add_package(const PackageDatabaseEntry &, DepTag::ConstPointer);
void add_already_installed_package(const PackageDatabaseEntry &, DepTag::ConstPointer);
+ void add_blocked_package(const PackageDatabaseEntry &);
+
void add_predeps(DepAtom::ConstPointer, const DepListDepsOption, const std::string &);
void add_postdeps(DepAtom::ConstPointer, const DepListDepsOption, const std::string &);
+
bool is_top_level_target(const PackageDatabaseEntry &) const;
public:
@@ -101,6 +105,11 @@ namespace paludis
*/
bool already_installed(const DepAtom * const) const;
+ /**
+ * Whether we have any errors.
+ */
+ bool has_errors() const;
+
///\name Iterate over our dependency list entries.
///\{
diff --git a/paludis/dep_list/dep_list.sr b/paludis/dep_list/dep_list.sr
index 0f55fdd..37264ae 100644
--- a/paludis/dep_list/dep_list.sr
+++ b/paludis/dep_list/dep_list.sr
@@ -41,6 +41,8 @@ END
make_class_DepListEntry()
{
+ key kind DepListEntryKind
+
key package PackageDatabaseEntry
key metadata VersionMetadata::ConstPointer
key tags DepListEntryTags::Pointer
@@ -48,7 +50,6 @@ make_class_DepListEntry()
key generation long
key state DepListEntryState
- key skip_install bool
allow_named_args
diff --git a/paludis/dep_list/dep_list_TEST.cc b/paludis/dep_list/dep_list_TEST.cc
index 75cdf7a..21c19f4 100644
--- a/paludis/dep_list/dep_list_TEST.cc
+++ b/paludis/dep_list/dep_list_TEST.cc
@@ -964,7 +964,7 @@ namespace test_cases
void populate_expected()
{
- merge_target="cat/one";
+ merge_target = "cat/one";
}
void check_lists()
diff --git a/paludis/dep_list/options.hh b/paludis/dep_list/options.hh
index 464caf5..33a925f 100644
--- a/paludis/dep_list/options.hh
+++ b/paludis/dep_list/options.hh
@@ -142,6 +142,23 @@ namespace paludis
};
/**
+ * Kind of a DepListEntry.
+ *
+ * \ingroup grpdepresolver
+ */
+ enum DepListEntryKind
+ {
+ dlk_package, ///< A package to be installed
+ dlk_subpackage, ///< A package to be installed as part of the previous dlk_package
+ dlk_already_installed, ///< An already installed package
+ dlk_virtual, ///< A virtual package
+ dlk_provided, ///< A package provided by the previous dlk_package
+ dlk_block, ///< A blocked package that must be removed
+ dlk_masked, ///< A masked package that must be unmasked
+ last_dlk
+ };
+
+ /**
* Write a DepListTargetType to a stream.
*
* \ingroup grpdepresolver
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index e111dcb..3809c5c 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -202,6 +202,12 @@ InstallTask::execute()
return;
}
+ if (_imp->dep_list.has_errors())
+ {
+ on_not_continuing_due_to_errors();
+ return;
+ }
+
/* we're about to fetch / install the entire list */
if (_imp->install_options.fetch_only)
{
@@ -220,14 +226,15 @@ InstallTask::execute()
int x(0), y(0);
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
- if (! dep->skip_install)
+ if (dlk_package == dep->kind)
++y;
for (DepList::Iterator dep(_imp->dep_list.begin()), dep_end(_imp->dep_list.end()) ;
dep != dep_end ; ++dep)
{
- if (dep->skip_install)
+ if (dlk_package != dep->kind)
continue;
+
++x;
_imp->current_dep_list_entry = dep;
@@ -364,7 +371,7 @@ InstallTask::execute()
if (d == dep_end)
break;
}
- while (d->skip_install);
+ while (dlk_package != d->kind);
if (d != dep_end)
on_installed_paludis();
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index ed446b3..ecceac1 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -119,6 +119,8 @@ namespace paludis
virtual void on_display_merge_list_post() = 0;
virtual void on_display_merge_list_entry(const DepListEntry &) = 0;
+ virtual void on_not_continuing_due_to_errors() = 0;
+
virtual void on_fetch_all_pre() = 0;
virtual void on_fetch_pre(const DepListEntry &) = 0;
virtual void on_fetch_post(const DepListEntry &) = 0;
diff --git a/ruby/dep_list.cc b/ruby/dep_list.cc
index f64f548..8b3ed70 100644
--- a/ruby/dep_list.cc
+++ b/ruby/dep_list.cc
@@ -557,27 +557,6 @@ namespace
}
}
- /*
- * call-seq:
- * skip_install -> true or false
- *
- * Our skip_install.
- */
- VALUE
- dep_list_entry_skip_install(VALUE self)
- {
- try
- {
- DepListEntry * p;
- Data_Get_Struct(self, DepListEntry, p);
- return p->skip_install == true ? Qtrue : Qfalse;
- }
- catch (const std::exception & e)
- {
- exception_to_ruby_exception(e);
- }
- }
-
void do_register_dep_list()
{
/*
@@ -760,7 +739,6 @@ namespace
rb_define_method(c_dep_list_entry, "metadata", RUBY_FUNC_CAST(&dep_list_entry_metadata),0);
rb_define_method(c_dep_list_entry, "destinations", RUBY_FUNC_CAST(&dep_list_entry_destinations),0);
rb_define_method(c_dep_list_entry, "state", RUBY_FUNC_CAST(&dep_list_entry_state),0);
- rb_define_method(c_dep_list_entry, "skip_install", RUBY_FUNC_CAST(&dep_list_entry_skip_install),0);
}
}
diff --git a/ruby/dep_list_TEST.rb b/ruby/dep_list_TEST.rb
index 6ce95d7..12d6da1 100644
--- a/ruby/dep_list_TEST.rb
+++ b/ruby/dep_list_TEST.rb
@@ -178,7 +178,6 @@ module Paludis
assert_respond_to dep_list_entry, method
assert_kind_of returns, dep_list_entry.send(method)
end
- assert_respond_to dep_list_entry, :skip_install
end
end
end
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index 5fb63c0..03b7a65 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -113,7 +113,7 @@ namespace
"--install --preserve-world";
for (DepList::Iterator i(task.current_dep_list_entry()), i_end(task.dep_list().end()) ;
i != i_end ; ++i)
- if (! i->skip_install)
+ if (dlk_package == i->kind)
resume_command = resume_command + " ="
+ stringify(i->package.name) + "-"
+ stringify(i->package.version) + "::"
@@ -220,6 +220,9 @@ do_install(PackageDepAtom::ConstPointer atom)
task.execute();
cout << endl;
+
+ if (task.dep_list().has_errors())
+ return_code |= 1;
}
catch (const AmbiguousPackageNameError & e)
{
diff --git a/src/clients/gtkpaludis/install.cc b/src/clients/gtkpaludis/install.cc
index 4d2d7f0..4c7231f 100644
--- a/src/clients/gtkpaludis/install.cc
+++ b/src/clients/gtkpaludis/install.cc
@@ -55,6 +55,11 @@ OurInstallTask::on_build_deplist_post()
}
void
+OurInstallTask::on_not_continuing_due_to_errors()
+{
+}
+
+void
OurInstallTask::on_build_cleanlist_pre(const DepListEntry &)
{
}
diff --git a/src/clients/gtkpaludis/install.hh b/src/clients/gtkpaludis/install.hh
index 9f080eb..871192d 100644
--- a/src/clients/gtkpaludis/install.hh
+++ b/src/clients/gtkpaludis/install.hh
@@ -39,6 +39,7 @@ namespace gtkpaludis
virtual void on_display_merge_list_pre();
virtual void on_display_merge_list_post();
virtual void on_display_merge_list_entry(const paludis::DepListEntry &);
+ virtual void on_not_continuing_due_to_errors();
virtual void on_fetch_all_pre();
virtual void on_fetch_pre(const paludis::DepListEntry &);
diff --git a/src/clients/gtkpaludis/queue_list.cc b/src/clients/gtkpaludis/queue_list.cc
index 1c9b5b8..768dc98 100644
--- a/src/clients/gtkpaludis/queue_list.cc
+++ b/src/clients/gtkpaludis/queue_list.cc
@@ -318,7 +318,7 @@ QueueList::Populate::operator() ()
void
QueueList::Populate::display_entry(const paludis::DepListEntry & e)
{
- if (e.skip_install)
+ if (e.kind != dlk_package)
return;
Gtk::TreeModel::Row row = *(_model->append());
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index 7167fd1..97079b6 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -69,7 +69,7 @@ namespace
next(task.current_dep_list_entry())) :
task.current_dep_list_entry()), i_end(task.dep_list().end()) ;
i != i_end ; ++i)
- if (! i->skip_install)
+ if (dlk_package == i->kind)
resume_command = resume_command + " '="
+ stringify(i->package.name) + "-"
+ stringify(i->package.version) + "::"
@@ -425,6 +425,9 @@ do_install()
task.execute();
cout << endl;
+
+ if (task.dep_list().has_errors())
+ return_code |= 1;
}
catch (const AmbiguousPackageNameError & e)
{
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 5d36dd3..4750fe5 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -155,10 +155,45 @@ ConsoleInstallTask::on_display_merge_list_post()
}
void
+ConsoleInstallTask::on_not_continuing_due_to_errors()
+{
+ output_endl();
+ output_starred_item(render_as_error("Cannot continue with install due to the errors indicated above"));
+}
+
+void
ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
{
- if (d.skip_install && ! want_full_install_reasons())
- return;
+ DisplayMode m;
+
+ do
+ {
+ switch (d.kind)
+ {
+ case dlk_provided:
+ case dlk_virtual:
+ case dlk_already_installed:
+ if (! want_full_install_reasons())
+ return;
+ m = unimportant_entry;
+ continue;
+
+ case dlk_package:
+ case dlk_subpackage:
+ m = normal_entry;
+ continue;
+
+ case dlk_masked:
+ case dlk_block:
+ m = error_entry;
+ continue;
+
+ case last_dlk:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad d.kind");
+ } while (false);
PackageDatabaseEntryCollection::Pointer existing(environment()->package_database()->
query(PackageDepAtom(d.package.name), is_installed_only, qo_order_by_version));
@@ -167,15 +202,15 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
query(PackageDepAtom(stringify(d.package.name) + ":" + stringify(d.metadata->slot)),
is_installed_only, qo_order_by_version));
- display_merge_list_entry_start(d);
- display_merge_list_entry_package_name(d);
- display_merge_list_entry_version(d);
- display_merge_list_entry_repository(d);
- display_merge_list_entry_slot(d);
- display_merge_list_entry_status_and_update_counts(d, existing, existing_slot);
- display_merge_list_entry_use(d, existing, existing_slot);
- display_merge_list_entry_tags(d);
- display_merge_list_entry_end(d);
+ display_merge_list_entry_start(d, m);
+ display_merge_list_entry_package_name(d, m);
+ display_merge_list_entry_version(d, m);
+ display_merge_list_entry_repository(d, m);
+ display_merge_list_entry_slot(d, m);
+ display_merge_list_entry_status_and_update_counts(d, existing, existing_slot, m);
+ display_merge_list_entry_use(d, existing, existing_slot, m);
+ display_merge_list_entry_tags(d, m);
+ display_merge_list_entry_end(d, m);
}
void
@@ -333,6 +368,14 @@ ConsoleInstallTask::display_merge_list_post_counts()
}
s << ")";
}
+
+ if (count<max_count>() && count<error_count>())
+ s << " and ";
+
+ if (count<error_count>())
+ s << render_as_error(stringify(count<error_count>()) +
+ render_plural(count<error_count>(), " error", " errors"));
+
output_unstarred_item(s.str());
}
@@ -579,21 +622,32 @@ DepTagSummaryDisplayer::visit(const GeneralSetDepTag * const tag)
}
void
-ConsoleInstallTask::display_merge_list_entry_start(const DepListEntry &)
+ConsoleInstallTask::display_merge_list_entry_start(const DepListEntry &, const DisplayMode)
{
output_starred_item_no_endl("");
}
void
-ConsoleInstallTask::display_merge_list_entry_package_name(const DepListEntry & d)
+ConsoleInstallTask::display_merge_list_entry_package_name(const DepListEntry & d, const DisplayMode m)
{
- output_no_endl(d.skip_install ?
- render_as_unimportant(stringify(d.package.name)) :
- render_as_package_name(stringify(d.package.name)));
+ switch (m)
+ {
+ case normal_entry:
+ output_no_endl(render_as_package_name(stringify(d.package.name)));
+ break;
+
+ case unimportant_entry:
+ output_no_endl(render_as_unimportant(stringify(d.package.name)));
+ break;
+
+ case error_entry:
+ output_no_endl(render_as_error(stringify(d.package.name)));
+ break;
+ }
}
void
-ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d)
+ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d, const DisplayMode)
{
if ((VersionSpec("0") != d.package.version) ||
CategoryNamePart("virtual") != d.package.name.category)
@@ -601,60 +655,104 @@ ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d)
}
void
-ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d)
+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));
}
void
-ConsoleInstallTask::display_merge_list_entry_slot(const DepListEntry & d)
+ConsoleInstallTask::display_merge_list_entry_slot(const DepListEntry & d, const DisplayMode m)
{
- if (SlotName("0") != d.metadata->slot)
- output_no_endl(d.skip_install ?
- render_as_unimportant(" {:" + stringify(d.metadata->slot) + "}") :
- render_as_slot_name(" {:" + stringify(d.metadata->slot) + "}"));
+ switch (m)
+ {
+ case normal_entry:
+ output_no_endl(render_as_slot_name(" {:" + stringify(d.metadata->slot) + "}"));
+ break;
+ case unimportant_entry:
+ output_no_endl(render_as_unimportant(" {:" + stringify(d.metadata->slot) + "}"));
+ break;
+
+ case error_entry:
+ output_no_endl(render_as_slot_name(" {:" + stringify(d.metadata->slot) + "}"));
+ break;
+ }
}
void
ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepListEntry & d,
PackageDatabaseEntryCollection::ConstPointer existing,
- PackageDatabaseEntryCollection::ConstPointer existing_slot)
+ PackageDatabaseEntryCollection::ConstPointer existing_slot,
+ const DisplayMode m)
{
- if (d.skip_install)
- output_no_endl(render_as_unimportant(" [-]"));
- else if (existing->empty())
- {
- output_no_endl(render_as_update_mode(" [N]"));
- set_count<new_count>(count<new_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else if (existing_slot->empty())
- {
- output_no_endl(render_as_update_mode(" [S]"));
- set_count<new_slot_count>(count<new_slot_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else if (existing_slot->last()->version < d.package.version)
+ switch (m)
{
- output_no_endl(render_as_update_mode(" [U " +
- stringify(existing_slot->last()->version) + "]"));
- set_count<upgrade_count>(count<upgrade_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else if (existing_slot->last()->version > d.package.version)
- {
- output_no_endl(render_as_update_mode(" [D " +
- stringify(existing_slot->last()->version) + "]"));
- set_count<downgrade_count>(count<downgrade_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
- }
- else
- {
- output_no_endl(render_as_update_mode(" [R]"));
- set_count<rebuild_count>(count<rebuild_count>() + 1);
- set_count<max_count>(count<max_count>() + 1);
+ case unimportant_entry:
+ output_no_endl(render_as_unimportant(" [-]"));
+ break;
+
+ case normal_entry:
+ if (existing->empty())
+ {
+ output_no_endl(render_as_update_mode(" [N]"));
+ set_count<new_count>(count<new_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else if (existing_slot->empty())
+ {
+ output_no_endl(render_as_update_mode(" [S]"));
+ set_count<new_slot_count>(count<new_slot_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else if (existing_slot->last()->version < d.package.version)
+ {
+ output_no_endl(render_as_update_mode(" [U " +
+ stringify(existing_slot->last()->version) + "]"));
+ set_count<upgrade_count>(count<upgrade_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else if (existing_slot->last()->version > d.package.version)
+ {
+ output_no_endl(render_as_update_mode(" [D " +
+ stringify(existing_slot->last()->version) + "]"));
+ set_count<downgrade_count>(count<downgrade_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ else
+ {
+ output_no_endl(render_as_update_mode(" [R]"));
+ set_count<rebuild_count>(count<rebuild_count>() + 1);
+ set_count<max_count>(count<max_count>() + 1);
+ }
+ break;
+
+ case error_entry:
+ set_count<error_count>(count<error_count>() + 1);
+ do
+ {
+ switch (d.kind)
+ {
+ case dlk_masked:
+ output_no_endl(render_as_update_mode(" [! masked]"));
+ continue;
+
+ case dlk_block:
+ output_no_endl(render_as_update_mode(" [! blocking]"));
+ continue;
+
+ case dlk_provided:
+ case dlk_virtual:
+ case dlk_already_installed:
+ case dlk_package:
+ case dlk_subpackage:
+ case last_dlk:
+ ;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Bad d.kind");
+ } while (false);
+ break;
}
}
@@ -683,9 +781,10 @@ ConsoleInstallTask::_add_descriptions(UseFlagNameCollection::ConstPointer c,
void
ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
PackageDatabaseEntryCollection::ConstPointer existing,
- PackageDatabaseEntryCollection::ConstPointer)
+ PackageDatabaseEntryCollection::ConstPointer,
+ const DisplayMode m)
{
- if (d.skip_install)
+ if (normal_entry != m)
return;
output_no_endl(" ");
@@ -700,7 +799,7 @@ ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
}
void
-ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d)
+ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d, const DisplayMode m)
{
if (d.tags->empty())
return;
@@ -728,13 +827,25 @@ ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d)
tag_titles.erase(tag_titles.length() - 2);
if (! tag_titles.empty())
- output_no_endl(" " + (d.skip_install ?
- render_as_unimportant("<" + tag_titles + ">") :
- render_as_tag("<" + tag_titles + ">")));
+ switch (m)
+ {
+ case normal_entry:
+ output_no_endl(" " + render_as_tag("<" + tag_titles + ">"));
+ break;
+
+ case error_entry:
+ output_no_endl(" " + render_as_tag("<" + tag_titles + ">"));
+ break;
+
+ case unimportant_entry:
+ output_no_endl(" " + render_as_unimportant("<" + tag_titles + ">"));
+ break;
+ }
}
if (! want_install_reasons())
- return;
+ if (d.kind != dlk_block)
+ return;
std::string deps;
unsigned c(0), max_c(want_full_install_reasons() ? std::numeric_limits<long>::max() : 3);
@@ -760,15 +871,27 @@ ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d)
deps.append(stringify(c - max_c + 1) + " more, ");
deps.erase(deps.length() - 2);
+
if (! deps.empty())
- output_no_endl(" " + (d.skip_install ?
- render_as_unimportant("<" + deps + ">") :
- render_as_tag("<" + deps + ">")));
+ switch (m)
+ {
+ case normal_entry:
+ output_no_endl(" " + render_as_tag("<" + deps + ">"));
+ break;
+
+ case error_entry:
+ output_no_endl(" " + render_as_tag("<" + deps + ">"));
+ break;
+
+ case unimportant_entry:
+ output_no_endl(" " + render_as_unimportant("<" + deps + ">"));
+ break;
+ }
}
}
void
-ConsoleInstallTask::display_merge_list_entry_end(const DepListEntry &)
+ConsoleInstallTask::display_merge_list_entry_end(const DepListEntry &, const DisplayMode)
{
output_endl();
}
@@ -873,6 +996,12 @@ ConsoleInstallTask::render_as_update_mode(const std::string & s) const
}
std::string
+ConsoleInstallTask::render_as_error(const std::string & s) const
+{
+ return colour(cl_error, s);
+}
+
+std::string
ConsoleInstallTask::render_plural(int c, const std::string & s, const std::string & p) const
{
return 1 == c ? s : p;
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 90a7546..0e72053 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -98,9 +98,17 @@ namespace paludis
downgrade_count,
new_slot_count,
rebuild_count,
+ error_count,
last_count
};
+ enum DisplayMode
+ {
+ normal_entry,
+ unimportant_entry,
+ error_entry
+ };
+
private:
int _counts[last_count];
SortedCollection<DepTagEntry>::Pointer _all_tags;
@@ -122,6 +130,7 @@ namespace paludis
virtual void on_display_merge_list_pre();
virtual void on_display_merge_list_post();
+ virtual void on_not_continuing_due_to_errors();
virtual void on_display_merge_list_entry(const DepListEntry &);
virtual void on_fetch_all_pre();
@@ -174,6 +183,7 @@ namespace paludis
virtual std::string render_as_package_name(const std::string &) const;
virtual std::string render_as_tag(const std::string &) const;
virtual std::string render_as_unimportant(const std::string &) const;
+ virtual std::string render_as_error(const std::string &) const;
virtual std::string render_as_slot_name(const std::string &) const;
virtual std::string render_as_update_mode(const std::string &) const;
virtual std::string render_plural(int count, const std::string &, const std::string &) const;
@@ -193,19 +203,19 @@ namespace paludis
virtual void display_merge_list_post_counts();
virtual void display_merge_list_post_tags();
- virtual void display_merge_list_entry_start(const DepListEntry &);
- virtual void display_merge_list_entry_package_name(const DepListEntry &);
- virtual void display_merge_list_entry_version(const DepListEntry &);
- virtual void display_merge_list_entry_repository(const DepListEntry &);
- virtual void display_merge_list_entry_slot(const DepListEntry &);
+ virtual void display_merge_list_entry_start(const DepListEntry &, const DisplayMode);
+ virtual void display_merge_list_entry_package_name(const DepListEntry &, const DisplayMode);
+ 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_status_and_update_counts(const DepListEntry &,
PackageDatabaseEntryCollection::ConstPointer,
- PackageDatabaseEntryCollection::ConstPointer);
+ PackageDatabaseEntryCollection::ConstPointer, const DisplayMode);
virtual void display_merge_list_entry_use(const DepListEntry &,
PackageDatabaseEntryCollection::ConstPointer,
- PackageDatabaseEntryCollection::ConstPointer);
- virtual void display_merge_list_entry_tags(const DepListEntry &);
- virtual void display_merge_list_entry_end(const DepListEntry &);
+ PackageDatabaseEntryCollection::ConstPointer, const DisplayMode);
+ virtual void display_merge_list_entry_tags(const DepListEntry &, const DisplayMode);
+ virtual void display_merge_list_entry_end(const DepListEntry &, const DisplayMode);
virtual void display_tag_summary_start();
virtual void display_tag_summary_tag_title(const DepTagCategory &);