aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-18 14:22:56 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-18 14:22:56 +0000
commit5e76134e3d4ef0cb7ad82f3f66185e1902ab8480 (patch)
treebd5802463ee27c436e10eea6f6a5db18dc2ba735
parent86ec4c1d61197ed2a7d8c918027dd7ad6c7cb4e5 (diff)
downloadpaludis-5e76134e3d4ef0cb7ad82f3f66185e1902ab8480.tar.gz
paludis-5e76134e3d4ef0cb7ad82f3f66185e1902ab8480.tar.xz
Abstract out output functionality into a ConsoleInstallTask
-rw-r--r--paludis/tasks/install_task.cc12
-rw-r--r--paludis/tasks/install_task.hh10
-rw-r--r--src/Makefile.am8
-rw-r--r--src/adjutrix/Makefile.am4
-rw-r--r--src/console_install_task.cc718
-rw-r--r--src/console_install_task.hh240
-rw-r--r--src/paludis/Makefile.am7
-rw-r--r--src/paludis/do_contents.cc (renamed from src/paludis/contents.cc)2
-rw-r--r--src/paludis/do_contents.hh (renamed from src/paludis/contents.hh)0
-rw-r--r--src/paludis/install.cc453
-rw-r--r--src/paludis/paludis.cc2
-rw-r--r--src/qualudis/Makefile.am4
-rw-r--r--src/use.cc (renamed from src/paludis/use.cc)0
-rw-r--r--src/use.hh (renamed from src/paludis/use.hh)0
14 files changed, 1005 insertions, 455 deletions
diff --git a/paludis/tasks/install_task.cc b/paludis/tasks/install_task.cc
index 2f0c33e..c6edd9a 100644
--- a/paludis/tasks/install_task.cc
+++ b/paludis/tasks/install_task.cc
@@ -432,3 +432,15 @@ InstallTask::end_targets() const
return TargetsIterator(_imp->raw_targets.end());
}
+Environment *
+InstallTask::environment()
+{
+ return _imp->env;
+}
+
+const Environment *
+InstallTask::environment() const
+{
+ return _imp->env;
+}
+
diff --git a/paludis/tasks/install_task.hh b/paludis/tasks/install_task.hh
index fdb253d..3adb895 100644
--- a/paludis/tasks/install_task.hh
+++ b/paludis/tasks/install_task.hh
@@ -157,6 +157,16 @@ namespace paludis
* Fetch our current deplist entry.
*/
DepList::Iterator current_dep_list_entry() const;
+
+ /**
+ * Fetch our environment.
+ */
+ Environment * environment();
+
+ /**
+ * Fetch our environment.
+ */
+ const Environment * environment() const;
};
}
diff --git a/src/Makefile.am b/src/Makefile.am
index 2f442d6..c8a7911 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -3,8 +3,12 @@ SUBDIRS = . paludis gtkpaludis qualudis adjutrix
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
MAINTAINERCLEANFILES = Makefile.in
-noinst_LIBRARIES = libcolour.a
-libcolour_a_SOURCES = colour.cc colour.hh
+noinst_LIBRARIES = liboutput.a
+liboutput_a_SOURCES = \
+ colour.cc colour.hh \
+ use.cc use.hh \
+ console_install_task.cc console_install_task.hh
+
AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@
built-sources : $(BUILT_SOURCES)
diff --git a/src/adjutrix/Makefile.am b/src/adjutrix/Makefile.am
index db96a3b..73a9037 100644
--- a/src/adjutrix/Makefile.am
+++ b/src/adjutrix/Makefile.am
@@ -23,7 +23,7 @@ man_adjutrix_SOURCES = \
man_adjutrix_LDADD = \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/src/libcolour.a \
+ $(top_builddir)/src/liboutput.a \
$(DYNAMIC_LD_LIBS)
adjutrix_SOURCES = \
@@ -45,7 +45,7 @@ adjutrix_LDADD = \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(top_builddir)/paludis/dep_list/libpaludisdeplist.la \
- $(top_builddir)/src/libcolour.a \
+ $(top_builddir)/src/liboutput.a \
$(DYNAMIC_LD_LIBS)
TESTS_ENVIRONMENT = env \
diff --git a/src/console_install_task.cc b/src/console_install_task.cc
new file mode 100644
index 0000000..a577042
--- /dev/null
+++ b/src/console_install_task.cc
@@ -0,0 +1,718 @@
+/* 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
+ */
+
+#include "console_install_task.hh"
+#include "colour.hh"
+#include "use.hh"
+
+#include <paludis/util/log.hh>
+#include <paludis/util/collection_concrete.hh>
+
+#include <algorithm>
+#include <set>
+#include <iostream>
+
+using namespace paludis;
+
+ConsoleInstallTask::ConsoleInstallTask(Environment * const env,
+ const DepListOptions & options) :
+ InstallTask(env, options),
+ _all_tags(new SortedCollection<DepTagEntry>::Concrete)
+{
+ std::fill_n(_counts, static_cast<int>(last_count), 0);
+}
+
+void
+ConsoleInstallTask::on_build_deplist_pre()
+{
+ output_activity_start_message("Building dependency list");
+}
+
+void
+ConsoleInstallTask::on_build_deplist_post()
+{
+ output_activity_end_message();
+}
+
+void
+ConsoleInstallTask::on_build_cleanlist_pre(const DepListEntry & d)
+{
+ output_heading("Cleaning stale versions after installing " +
+ stringify(d.package));
+}
+
+void
+ConsoleInstallTask::on_build_cleanlist_post(const DepListEntry &)
+{
+}
+
+void
+ConsoleInstallTask::on_clean_all_pre(const DepListEntry & d,
+ const PackageDatabaseEntryCollection & 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);
+
+ display_clean_all_pre_list_end(d, c);
+}
+
+void
+ConsoleInstallTask::on_no_clean_needed(const DepListEntry &)
+{
+ output_starred_item("No cleaning required");
+}
+
+void
+ConsoleInstallTask::on_clean_pre(const DepListEntry &,
+ const PackageDatabaseEntry & c)
+{
+ output_heading("Cleaning " + stringify(c));
+ output_xterm_title("(" + stringify(count<current_count>()) + " of "
+ + stringify(count<max_count>()) + ") Cleaning " + stringify(c));
+}
+
+void
+ConsoleInstallTask::on_clean_post(const DepListEntry &,
+ const PackageDatabaseEntry &)
+{
+}
+
+void
+ConsoleInstallTask::on_clean_all_post(const DepListEntry &,
+ const PackageDatabaseEntryCollection &)
+{
+}
+
+void
+ConsoleInstallTask::on_display_merge_list_pre()
+{
+ output_heading("These packages will be installed:");
+}
+
+void
+ConsoleInstallTask::on_display_merge_list_post()
+{
+ output_endl();
+ display_merge_list_post_counts();
+ display_merge_list_post_tags();
+}
+
+void
+ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
+{
+ if (d.skip_install && ! want_full_install_reasons())
+ return;
+
+ PackageDatabaseEntryCollection::Pointer existing(environment()->package_database()->
+ query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
+ d.package.name))), is_installed_only));
+
+ PackageDatabaseEntryCollection::Pointer existing_slot(environment()->package_database()->
+ query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
+ d.package.name) + ":" + stringify(d.metadata->slot))), is_installed_only));
+
+ 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);
+}
+
+void
+ConsoleInstallTask::on_fetch_all_pre()
+{
+}
+
+void
+ConsoleInstallTask::on_fetch_pre(const DepListEntry & d)
+{
+ set_count<current_count>(count<current_count>() + 1);
+
+ output_heading("Fetching " + stringify(d.package));
+ output_xterm_title("(" + stringify(count<current_count>()) + " of "
+ + stringify(count<max_count>()) + ") Fetching " + stringify(d.package));
+}
+
+void
+ConsoleInstallTask::on_fetch_post(const DepListEntry &)
+{
+}
+
+void
+ConsoleInstallTask::on_fetch_all_post()
+{
+}
+
+void
+ConsoleInstallTask::on_install_all_pre()
+{
+}
+
+void
+ConsoleInstallTask::on_install_pre(const DepListEntry & d)
+{
+ set_count<current_count>(count<current_count>() + 1);
+
+ output_heading("Installing " + stringify(d.package));
+ output_xterm_title("(" + stringify(count<current_count>()) + " of "
+ + stringify(count<max_count>()) + ") Installing " + stringify(d.package));
+}
+
+void
+ConsoleInstallTask::on_install_post(const DepListEntry &)
+{
+}
+
+void
+ConsoleInstallTask::on_install_all_post()
+{
+}
+
+void
+ConsoleInstallTask::on_update_world_pre()
+{
+ output_heading("Updating world file");
+}
+
+void
+ConsoleInstallTask::on_update_world(const PackageDepAtom & a)
+{
+ output_starred_item("adding " + render_as_package_name(stringify(a)));
+}
+
+void
+ConsoleInstallTask::on_update_world_skip(const PackageDepAtom & a, const std::string & s)
+{
+ output_starred_item("skipping " + render_as_package_name(stringify(a)) + " ("
+ + s + ")");
+}
+
+void
+ConsoleInstallTask::on_update_world_post()
+{
+}
+
+void
+ConsoleInstallTask::on_preserve_world()
+{
+ output_heading("Updating world file");
+ output_starred_item("--preserve-world was specified, skipping world changes");
+}
+
+void
+ConsoleInstallTask::display_clean_all_pre_list_start(const DepListEntry &,
+ const PackageDatabaseEntryCollection &)
+{
+}
+
+void
+ConsoleInstallTask::display_one_clean_all_pre_list_entry(
+ const PackageDatabaseEntry & c)
+{
+ output_starred_item(render_as_package_name(stringify(c)));
+}
+
+void
+ConsoleInstallTask::display_clean_all_pre_list_end(const DepListEntry &,
+ const PackageDatabaseEntryCollection &)
+{
+}
+
+void
+ConsoleInstallTask::display_merge_list_post_counts()
+{
+ if (count<max_count>() != count<new_count>() + count<upgrade_count>()
+ + count<downgrade_count>() + count<new_slot_count>() + count<rebuild_count>())
+ Log::get_instance()->message(ll_warning, lc_no_context,
+ "Max count doesn't add up. This is a bug!");
+
+ std::ostringstream s;
+ s << "Total: " << count<max_count>() << render_plural(count<max_count>(), " package",
+ " packages");
+
+ if (count<max_count>())
+ {
+ bool need_comma(false);
+ s << " (";
+ if (count<new_count>())
+ {
+ s << count<new_count>() << " new";
+ need_comma = true;
+ }
+ if (count<upgrade_count>())
+ {
+ if (need_comma)
+ s << ", ";
+ s << count<upgrade_count>() << render_plural(count<upgrade_count>(),
+ " upgrade", " upgrades");
+ need_comma = true;
+ }
+ if (count<downgrade_count>())
+ {
+ if (need_comma)
+ s << ", ";
+ s << count<downgrade_count>() << render_plural(count<downgrade_count>(),
+ " downgrade", " downgrades");
+ need_comma = true;
+ }
+ if (count<new_slot_count>())
+ {
+ if (need_comma)
+ s << ", ";
+ s << count<new_slot_count>() << render_plural(count<new_slot_count>(),
+ " in new slot", " in new slots");
+ need_comma = true;
+ }
+ if (count<rebuild_count>())
+ {
+ if (need_comma)
+ s << ", ";
+ s << count<rebuild_count>() << render_plural(count<rebuild_count>(),
+ " rebuild", " rebuilds");
+ need_comma = true;
+ }
+ s << ")";
+ }
+ output_unstarred_item(s.str());
+}
+
+void
+ConsoleInstallTask::display_merge_list_post_tags()
+{
+ if (! want_tags_summary())
+ return;
+
+ std::set<std::string> tag_categories;
+ for (SortedCollection<DepTagEntry>::Iterator a(all_tags()->begin()),
+ a_end(all_tags()->end()) ; a != a_end ; ++a)
+ tag_categories.insert(a->tag->category());
+
+ display_tag_summary_start();
+
+ for (std::set<std::string>::iterator cat(tag_categories.begin()),
+ cat_end(tag_categories.end()) ; cat != cat_end ; ++cat)
+ {
+ DepTagCategory::ConstPointer c(DepTagCategoryMaker::get_instance()->
+ find_maker(*cat)());
+
+ if (! c->visible())
+ continue;
+
+ display_tag_summary_tag_title(*c);
+ display_tag_summary_tag_pre_text(*c);
+
+ for (SortedCollection<DepTagEntry>::Iterator t(all_tags()->begin()),
+ t_end(all_tags()->end()) ; t != t_end ; ++t)
+ {
+ if (t->tag->category() != *cat)
+ continue;
+ display_tag_summary_tag(t->tag);
+ }
+
+ display_tag_summary_tag_post_text(*c);
+ }
+
+ display_tag_summary_end();
+}
+
+void
+ConsoleInstallTask::display_tag_summary_start()
+{
+}
+
+void
+ConsoleInstallTask::display_tag_summary_tag_title(const DepTagCategory & c)
+{
+ if (! c.title().empty())
+ output_heading(c.title() + ":");
+}
+
+void
+ConsoleInstallTask::display_tag_summary_tag_pre_text(const DepTagCategory & c)
+{
+ if (! c.pre_text().empty())
+ output_unstarred_item(c.pre_text());
+}
+
+void
+ConsoleInstallTask::display_tag_summary_tag(DepTag::ConstPointer t)
+{
+ DepTagSummaryDisplayer::Pointer displayer(make_dep_tag_summary_displayer());
+ t->accept(displayer.raw_pointer());
+}
+
+void
+ConsoleInstallTask::display_tag_summary_tag_post_text(const DepTagCategory & c)
+{
+ if (! c.post_text().empty())
+ output_unstarred_item(c.post_text());
+}
+
+void
+ConsoleInstallTask::display_tag_summary_end()
+{
+}
+
+DepTagSummaryDisplayer::DepTagSummaryDisplayer(ConsoleInstallTask * t) :
+ _task(t)
+{
+}
+
+DepTagSummaryDisplayer::~DepTagSummaryDisplayer()
+{
+}
+
+void
+DepTagSummaryDisplayer::visit(const GLSADepTag * const tag)
+{
+ task()->output_starred_item(task()->render_as_tag(tag->short_text()) + ": "
+ + tag->glsa_title());
+}
+
+void
+DepTagSummaryDisplayer::visit(const DependencyDepTag * const)
+{
+}
+
+void
+DepTagSummaryDisplayer::visit(const GeneralSetDepTag * const tag)
+{
+ std::string desc;
+ if (tag->short_text() == "world")
+ desc = ": Packages that have been explicitly installed";
+ else if (tag->short_text() == "everything")
+ desc = ": All installed packages";
+ else if (tag->short_text() == "system")
+ desc = ": Packages that are part of the base system";
+
+ task()->output_starred_item(task()->render_as_tag(tag->short_text()) + desc);
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_start(const DepListEntry &)
+{
+ output_starred_item_no_endl("");
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_package_name(const DepListEntry & d)
+{
+ output_no_endl(d.skip_install ?
+ render_as_unimportant(stringify(d.package.name)) :
+ render_as_package_name(stringify(d.package.name)));
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d)
+{
+ if ((VersionSpec("0") != d.package.version) ||
+ CategoryNamePart("virtual") != d.package.name.category)
+ output_no_endl("-" + stringify(d.package.version));
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d)
+{
+ 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)
+{
+ 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) + "}"));
+
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepListEntry & d,
+ PackageDatabaseEntryCollection::ConstPointer existing,
+ PackageDatabaseEntryCollection::ConstPointer existing_slot)
+{
+ 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)
+ {
+ output_no_endl(render_as_update_mode(" [U " +
+ stringify(existing->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->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);
+ }
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
+ PackageDatabaseEntryCollection::ConstPointer existing,
+ PackageDatabaseEntryCollection::ConstPointer)
+{
+ if (d.skip_install)
+ return;
+
+ output_no_endl(make_pretty_use_flags_string(environment(), d.package,
+ d.metadata, existing->empty() ? 0 : &*existing->last()));
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d)
+{
+ if (d.tags->empty())
+ return;
+
+ std::string tag_titles;
+
+ for (SortedCollection<DepTagEntry>::Iterator
+ tag(d.tags->begin()),
+ tag_end(d.tags->end()) ;
+ tag != tag_end ; ++tag)
+ {
+ if (tag->tag->category() == "dependency")
+ continue;
+
+ all_tags()->insert(*tag);
+
+ EntryDepTagDisplayer::Pointer displayer(make_entry_dep_tag_displayer());
+ tag->tag->accept(displayer.raw_pointer());
+ tag_titles.append(displayer->text());
+ tag_titles.append(", ");
+ }
+
+ if (! tag_titles.empty())
+ {
+ 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 + ">")));
+ }
+
+ if (! want_install_reasons())
+ return;
+
+ std::string deps;
+ unsigned c(0), max_c(want_full_install_reasons() ? std::numeric_limits<long>::max() : 3);
+
+ for (SortedCollection<DepTagEntry>::Iterator
+ tag(d.tags->begin()),
+ tag_end(d.tags->end()) ;
+ tag != tag_end ; ++tag)
+ {
+ if (tag->tag->category() != "dependency")
+ continue;
+
+ if (++c < max_c)
+ {
+ deps.append(tag->tag->short_text());
+ deps.append(", ");
+ }
+ }
+
+ if (! deps.empty())
+ {
+ if (c >= max_c)
+ 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 + ">")));
+ }
+}
+
+void
+ConsoleInstallTask::display_merge_list_entry_end(const DepListEntry &)
+{
+ output_endl();
+}
+
+void
+ConsoleInstallTask::output_activity_start_message(const std::string & s) const
+{
+ output_stream() << s << "..." << std::flush;
+}
+
+void
+ConsoleInstallTask::output_activity_end_message() const
+{
+ output_stream() << std::endl;
+}
+
+void
+ConsoleInstallTask::output_heading(const std::string & s) const
+{
+ output_stream() << std::endl << colour(cl_heading, s) << std::endl << std::endl;
+}
+
+void
+ConsoleInstallTask::output_xterm_title(const std::string & s) const
+{
+ output_xterm_stream() << xterm_title(s);
+}
+
+void
+ConsoleInstallTask::output_starred_item(const std::string & s) const
+{
+ output_stream() << "* " << s << std::endl;
+}
+
+void
+ConsoleInstallTask::output_starred_item_no_endl(const std::string & s) const
+{
+ output_stream() << "* " << s;
+}
+
+void
+ConsoleInstallTask::output_unstarred_item(const std::string & s) const
+{
+ output_stream() << s << std::endl;
+}
+
+void
+ConsoleInstallTask::output_no_endl(const std::string & s) const
+{
+ output_stream() << s;
+}
+
+void
+ConsoleInstallTask::output_endl() const
+{
+ output_stream() << std::endl;
+}
+
+std::ostream &
+ConsoleInstallTask::output_stream() const
+{
+ return std::cout;
+}
+
+std::ostream &
+ConsoleInstallTask::output_xterm_stream() const
+{
+ return std::cerr;
+}
+
+std::string
+ConsoleInstallTask::render_as_package_name(const std::string & s) const
+{
+ return colour(cl_package_name, s);
+}
+
+std::string
+ConsoleInstallTask::render_as_tag(const std::string & s) const
+{
+ return colour(cl_tag, s);
+}
+
+std::string
+ConsoleInstallTask::render_as_unimportant(const std::string & s) const
+{
+ return colour(cl_unimportant, s);
+}
+
+std::string
+ConsoleInstallTask::render_as_slot_name(const std::string & s) const
+{
+ return colour(cl_slot, s);
+}
+
+std::string
+ConsoleInstallTask::render_as_update_mode(const std::string & s) const
+{
+ return colour(cl_updatemode, s);
+}
+
+std::string
+ConsoleInstallTask::render_plural(int c, const std::string & s, const std::string & p) const
+{
+ return 1 == c ? s : p;
+}
+
+DepTagSummaryDisplayer::Pointer
+ConsoleInstallTask::make_dep_tag_summary_displayer()
+{
+ return DepTagSummaryDisplayer::Pointer(new DepTagSummaryDisplayer(this));
+}
+
+EntryDepTagDisplayer::Pointer
+ConsoleInstallTask::make_entry_dep_tag_displayer()
+{
+ return EntryDepTagDisplayer::Pointer(new EntryDepTagDisplayer());
+}
+
+EntryDepTagDisplayer::EntryDepTagDisplayer()
+{
+}
+
+EntryDepTagDisplayer::~EntryDepTagDisplayer()
+{
+}
+
+void
+EntryDepTagDisplayer::visit(const GLSADepTag * const tag)
+{
+ text() = tag->short_text();
+}
+
+void
+EntryDepTagDisplayer::visit(const DependencyDepTag * const)
+{
+}
+
+void
+EntryDepTagDisplayer::visit(const GeneralSetDepTag * const tag)
+{
+ text() = tag->short_text(); // + "<" + tag->source() + ">";
+}
+
diff --git a/src/console_install_task.hh b/src/console_install_task.hh
new file mode 100644
index 0000000..0457b2c
--- /dev/null
+++ b/src/console_install_task.hh
@@ -0,0 +1,240 @@
+/* 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_CONSOLE_INSTALL_TASK_HH
+#define PALUDIS_GUARD_SRC_CONSOLE_INSTALL_TASK_HH 1
+
+#include <paludis/tasks/install_task.hh>
+#include <paludis/package_database_entry.hh>
+#include <iosfwd>
+
+namespace paludis
+{
+ class ConsoleInstallTask;
+
+ class PALUDIS_VISIBLE DepTagSummaryDisplayer :
+ public DepTagVisitorTypes::ConstVisitor,
+ public InternalCounted<DepTagSummaryDisplayer>
+ {
+ private:
+ ConsoleInstallTask * _task;
+
+ public:
+ DepTagSummaryDisplayer(ConsoleInstallTask *) PALUDIS_ATTRIBUTE((nonnull(1)));
+ virtual ~DepTagSummaryDisplayer();
+
+ void visit(const GLSADepTag * const tag);
+ void visit(const DependencyDepTag * const);
+ void visit(const GeneralSetDepTag * const tag);
+
+ ConsoleInstallTask * task()
+ {
+ return _task;
+ }
+ };
+
+ class PALUDIS_VISIBLE EntryDepTagDisplayer :
+ public DepTagVisitorTypes::ConstVisitor,
+ public InternalCounted<EntryDepTagDisplayer>
+ {
+ private:
+ std::string _text;
+
+ public:
+ EntryDepTagDisplayer();
+ virtual ~EntryDepTagDisplayer();
+
+ void visit(const GLSADepTag * const tag);
+ void visit(const DependencyDepTag * const);
+ void visit(const GeneralSetDepTag * const tag);
+
+ std::string & text()
+ {
+ return _text;
+ }
+ };
+
+ class PALUDIS_VISIBLE ConsoleInstallTask :
+ public InstallTask
+ {
+ public:
+ enum Count
+ {
+ current_count,
+ max_count,
+ new_count,
+ upgrade_count,
+ downgrade_count,
+ new_slot_count,
+ rebuild_count,
+ last_count
+ };
+
+ private:
+ int _counts[last_count];
+ SortedCollection<DepTagEntry>::Pointer _all_tags;
+
+ protected:
+ ConsoleInstallTask(Environment * const env, const DepListOptions & options);
+
+ public:
+ virtual void on_build_deplist_pre();
+ virtual void on_build_deplist_post();
+
+ virtual void on_build_cleanlist_pre(const DepListEntry &);
+ virtual void on_build_cleanlist_post(const DepListEntry &);
+
+ virtual void on_display_merge_list_pre();
+ virtual void on_display_merge_list_post();
+ virtual void on_display_merge_list_entry(const DepListEntry &);
+
+ virtual void on_fetch_all_pre();
+ virtual void on_fetch_pre(const DepListEntry &);
+ virtual void on_fetch_post(const DepListEntry &);
+ virtual void on_fetch_all_post();
+
+ virtual void on_install_all_pre();
+ virtual void on_install_pre(const DepListEntry &);
+ virtual void on_install_post(const DepListEntry &);
+ virtual void on_install_all_post();
+
+ virtual void on_no_clean_needed(const DepListEntry &);
+ virtual void on_clean_all_pre(const DepListEntry &,
+ const PackageDatabaseEntryCollection &);
+ virtual void on_clean_pre(const DepListEntry &,
+ const PackageDatabaseEntry &);
+ virtual void on_clean_post(const DepListEntry &,
+ const PackageDatabaseEntry &);
+ virtual void on_clean_all_post(const DepListEntry &,
+ const PackageDatabaseEntryCollection &);
+
+ virtual void on_update_world_pre();
+ virtual void on_update_world(const PackageDepAtom &);
+ virtual void on_update_world_skip(const PackageDepAtom &, const std::string &);
+ virtual void on_update_world_post();
+ virtual void on_preserve_world();
+
+ ///\name Output routines
+ ///\{
+
+ std::ostream & output_stream() const;
+ std::ostream & output_xterm_stream() const;
+
+ virtual void output_activity_start_message(const std::string &) const;
+ virtual void output_activity_end_message() const;
+ virtual void output_heading(const std::string &) const;
+ virtual void output_xterm_title(const std::string &) const;
+ virtual void output_starred_item(const std::string &) const;
+ virtual void output_starred_item_no_endl(const std::string &) const;
+ virtual void output_unstarred_item(const std::string &) const;
+ virtual void output_no_endl(const std::string &) const;
+ virtual void output_endl() const;
+
+ ///\}
+
+ ///\name Render routines
+ ///\{
+
+ 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_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;
+
+ ///\}
+
+ ///\name More granular display routines
+ ///\{
+
+ virtual void display_clean_all_pre_list_start(const DepListEntry &,
+ const PackageDatabaseEntryCollection &);
+ virtual void display_one_clean_all_pre_list_entry(
+ const PackageDatabaseEntry &);
+ virtual void display_clean_all_pre_list_end(const DepListEntry &,
+ const PackageDatabaseEntryCollection &);
+
+ 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_status_and_update_counts(const DepListEntry &,
+ PackageDatabaseEntryCollection::ConstPointer,
+ PackageDatabaseEntryCollection::ConstPointer);
+ 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 &);
+
+ virtual void display_tag_summary_start();
+ virtual void display_tag_summary_tag_title(const DepTagCategory &);
+ virtual void display_tag_summary_tag_pre_text(const DepTagCategory &);
+ virtual void display_tag_summary_tag(DepTag::ConstPointer);
+ virtual void display_tag_summary_tag_post_text(const DepTagCategory &);
+ virtual void display_tag_summary_end();
+
+ ///\}
+
+ ///\name Data
+ ///\{
+
+ template <Count count_>
+ int count() const
+ {
+ return _counts[count_];
+ }
+
+ template <Count count_>
+ void set_count(const int value)
+ {
+ _counts[count_] = value;
+ }
+
+ SortedCollection<DepTagEntry>::Pointer all_tags()
+ {
+ return _all_tags;
+ }
+
+ ///\}
+
+ ///\name Options
+ ///\{
+
+ virtual bool want_full_install_reasons() const = 0;
+ virtual bool want_install_reasons() const = 0;
+ virtual bool want_tags_summary() const = 0;
+
+ ///\}
+
+ ///\name Makers
+ ///\{
+
+ DepTagSummaryDisplayer::Pointer make_dep_tag_summary_displayer();
+ EntryDepTagDisplayer::Pointer make_entry_dep_tag_displayer();
+
+ ///\}
+ };
+}
+
+#endif
diff --git a/src/paludis/Makefile.am b/src/paludis/Makefile.am
index 3b1f37c..22467a6 100644
--- a/src/paludis/Makefile.am
+++ b/src/paludis/Makefile.am
@@ -23,7 +23,7 @@ man_paludis_SOURCES = \
man_paludis_LDADD = \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/src/libcolour.a \
+ $(top_builddir)/src/liboutput.a \
$(DYNAMIC_LD_LIBS)
paludis_SOURCES = \
@@ -35,8 +35,7 @@ paludis_SOURCES = \
query.hh query.cc \
sync.hh sync.cc \
licence.hh licence.cc \
- use.hh use.cc \
- contents.hh contents.cc \
+ do_contents.hh do_contents.cc \
owner.hh owner.cc \
news.hh news.cc \
report.hh report.cc \
@@ -49,7 +48,7 @@ paludis_LDADD = \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(top_builddir)/paludis/environment/default/libpaludisdefaultenvironment.la \
$(top_builddir)/paludis/dep_list/libpaludisdeplist.la \
- $(top_builddir)/src/libcolour.a \
+ $(top_builddir)/src/liboutput.a \
$(DYNAMIC_LD_LIBS)
TESTS_ENVIRONMENT = env \
diff --git a/src/paludis/contents.cc b/src/paludis/do_contents.cc
index ca9efc0..becb63a 100644
--- a/src/paludis/contents.cc
+++ b/src/paludis/do_contents.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "contents.hh"
+#include "do_contents.hh"
#include "colour.hh"
#include "command_line.hh"
#include <paludis/paludis.hh>
diff --git a/src/paludis/contents.hh b/src/paludis/do_contents.hh
index 5cf38e3..5cf38e3 100644
--- a/src/paludis/contents.hh
+++ b/src/paludis/do_contents.hh
diff --git a/src/paludis/install.cc b/src/paludis/install.cc
index 59559de..c75d45d 100644
--- a/src/paludis/install.cc
+++ b/src/paludis/install.cc
@@ -21,6 +21,7 @@
#include "install.hh"
#include "licence.hh"
#include "use.hh"
+#include "console_install_task.hh"
#include <iostream>
#include <limits>
@@ -50,466 +51,32 @@ using std::endl;
namespace
{
- struct ShortTagDisplayer :
- DepTagVisitorTypes::ConstVisitor
- {
- std::string text;
-
- void visit(const GLSADepTag * const tag)
- {
- text = tag->short_text();
- }
-
- void visit(const DependencyDepTag * const)
- {
- }
-
- void visit(const GeneralSetDepTag * const tag)
- {
- text = tag->short_text() + "<" + tag->source() + ">";
- }
- };
-
- struct TagDisplayer :
- DepTagVisitorTypes::ConstVisitor
- {
- void visit(const GLSADepTag * const tag)
- {
- cout << "* " << colour(cl_tag, tag->short_text()) << ": "
- << tag->glsa_title() << endl;
- }
-
- void visit(const DependencyDepTag * const)
- {
- }
-
- void visit(const GeneralSetDepTag * const tag)
- {
- cout << "* " << colour(cl_tag, tag->short_text());
- if (tag->short_text() == "world")
- cout << ": " << "Packages that have been explicitly installed";
- else if (tag->short_text() == "everything")
- cout << ": " << "All installed packages";
- else if (tag->short_text() == "system")
- cout << ": " << "Packages that are part of the base system";
- cout << endl;
- }
- };
-
class OurInstallTask :
- public InstallTask
+ public ConsoleInstallTask
{
- private:
- int _current_count, _max_count, _new_count, _upgrade_count,
- _downgrade_count, _new_slot_count, _rebuild_count;
-
- std::set<DepTagEntry> _all_tags;
-
public:
OurInstallTask(const DepListOptions & options) :
- InstallTask(DefaultEnvironment::get_instance(), options),
- _current_count(0),
- _max_count(0),
- _new_count(0),
- _upgrade_count(0),
- _downgrade_count(0),
- _new_slot_count(0),
- _rebuild_count(0)
- {
- }
-
- void on_build_deplist_pre()
- {
- cout << "Building dependency list... " << std::flush;
- }
-
- virtual void on_build_deplist_post()
- {
- cout << "done" << endl;
- }
-
- virtual void on_build_cleanlist_pre(const DepListEntry & d)
- {
- cout << endl << colour(cl_heading, "Cleaning stale versions after installing " +
- stringify(d.package.name) + "-" + stringify(d.package.version) +
- "::" + stringify(d.package.repository)) << endl << endl;
- }
-
- virtual void on_build_cleanlist_post(const DepListEntry &)
- {
- }
-
- virtual void on_clean_all_pre(const DepListEntry &,
- const PackageDatabaseEntryCollection & c)
- {
- for (PackageDatabaseEntryCollection::Iterator cc(c.begin()),
- cc_end(c.end()) ; cc != cc_end ; ++cc)
- cout << "* " << colour(cl_package_name, *cc) << endl;
- cout << endl;
- }
-
- virtual void on_no_clean_needed(const DepListEntry &)
+ ConsoleInstallTask(DefaultEnvironment::get_instance(), options)
{
- cout << "* No cleaning required" << endl;
}
- virtual void on_clean_pre(const DepListEntry &,
- const PackageDatabaseEntry & c)
- {
- cout << colour(cl_heading, "Cleaning " + stringify(c)) << endl << endl;
-
- cerr << xterm_title("(" + stringify(_current_count) + " of " +
- stringify(_max_count) + ") Cleaning " + stringify(c));
- }
-
- virtual void on_clean_post(const DepListEntry &,
- const PackageDatabaseEntry &)
- {
- }
-
- virtual void on_clean_all_post(const DepListEntry &,
- const PackageDatabaseEntryCollection &)
- {
- }
-
- virtual void on_display_merge_list_pre()
- {
- cout << endl << colour(cl_heading, "These packages will be installed:")
- << endl << endl;
- }
-
- virtual void on_display_merge_list_post();
- virtual void on_display_merge_list_entry(const DepListEntry &);
-
- virtual void on_fetch_all_pre()
- {
- }
-
- virtual void on_fetch_pre(const DepListEntry & d)
- {
- cout << colour(cl_heading, "Fetching " +
- stringify(d.package.name) + "-" + stringify(d.package.version) +
- "::" + stringify(d.package.repository)) << endl << endl;
-
- cerr << xterm_title("(" + stringify(++_current_count) + " of " +
- stringify(_max_count) + ") Fetching " +
- stringify(d.package.name) + "-" + stringify(d.package.version) +
- "::" + stringify(d.package.repository));
- }
-
- virtual void on_fetch_post(const DepListEntry &)
- {
- }
-
- virtual void on_fetch_all_post()
+ virtual bool want_full_install_reasons() const
{
+ return "full" == CommandLine::get_instance()->a_show_install_reasons.argument();
}
- virtual void on_install_all_pre()
+ virtual bool want_tags_summary() const
{
+ return CommandLine::get_instance()->a_pretend.specified();
}
- virtual void on_install_pre(const DepListEntry & d)
+ virtual bool want_install_reasons() const
{
- cout << endl << colour(cl_heading, "Installing " +
- stringify(d.package.name) + "-" + stringify(d.package.version) +
- "::" + stringify(d.package.repository)) << endl << endl;
-
- cerr << xterm_title("(" + stringify(++_current_count) + " of " +
- stringify(_max_count) + ") Installing " +
- stringify(d.package.name) + "-" + stringify(d.package.version) +
- "::" + stringify(d.package.repository));
- }
-
- virtual void on_install_post(const DepListEntry &)
- {
- }
-
- virtual void on_install_all_post()
- {
- }
-
- virtual void on_update_world_pre()
- {
- cout << endl << colour(cl_heading, "Updating world file") << endl << endl;
- }
-
- virtual void on_update_world(const PackageDepAtom & a)
- {
- cout << "* adding " << colour(cl_package_name, a.package()) << endl;
- }
-
- virtual void on_update_world_skip(const PackageDepAtom & a, const std::string & s)
- {
- cout << "* skipping " << colour(cl_package_name, a.package()) << " ("
- << s << ")" << endl;
- }
-
- virtual void on_update_world_post()
- {
- cout << endl;
- }
-
- virtual void on_preserve_world()
- {
- cout << endl << colour(cl_heading, "Updating world file") << endl << endl;
- cout << "* --preserve-world was specified, skipping world changes" << endl;
- cout << endl;
+ return "full" == CommandLine::get_instance()->a_show_install_reasons.argument() ||
+ "summary" == CommandLine::get_instance()->a_show_install_reasons.argument();
}
};
- void
- OurInstallTask::on_display_merge_list_post()
- {
- if (_max_count != _new_count + _upgrade_count + _downgrade_count + _new_slot_count +
- _rebuild_count)
- Log::get_instance()->message(ll_warning, lc_no_context,
- "Max count doesn't add up. This is a bug!");
-
- cout << endl << "Total: " << _max_count << (_max_count == 1 ? " package" : " packages");
- if (_max_count)
- {
- bool need_comma(false);
- cout << " (";
- if (_new_count)
- {
- cout << _new_count << " new";
- need_comma = true;
- }
- if (_upgrade_count)
- {
- if (need_comma)
- cout << ", ";
- cout << _upgrade_count << (_upgrade_count == 1 ? " upgrade" : " upgrades");
- need_comma = true;
- }
- if (_downgrade_count)
- {
- if (need_comma)
- cout << ", ";
- cout << _downgrade_count << (_downgrade_count == 1 ? " downgrade" : " downgrades");
- need_comma = true;
- }
- if (_new_slot_count)
- {
- if (need_comma)
- cout << ", ";
- cout << _new_slot_count << (_new_slot_count == 1 ? " in new slot" : " in new slots");
- need_comma = true;
- }
- if (_rebuild_count)
- {
- if (need_comma)
- cout << ", ";
- cout << _rebuild_count << (_rebuild_count == 1 ? " rebuild" : " rebuilds");
- need_comma = true;
- }
- cout << ")";
- }
-
- cout << endl << endl;
-
- if (CommandLine::get_instance()->a_pretend.specified() && ! _all_tags.empty())
- {
- TagDisplayer tag_displayer;
-
- std::set<std::string> tag_categories;
- for (std::set<DepTagEntry>::const_iterator a(_all_tags.begin()),
- a_end(_all_tags.end()) ; a != a_end ; ++a)
- tag_categories.insert(a->tag->category());
-
- for (std::set<std::string>::iterator cat(tag_categories.begin()),
- cat_end(tag_categories.end()) ; cat != cat_end ; ++cat)
- {
- DepTagCategory::ConstPointer c(DepTagCategoryMaker::get_instance()->
- find_maker(*cat)());
-
- if (! c->visible())
- continue;
-
- if (! c->title().empty())
- cout << colour(cl_heading, c->title()) << ":" << endl << endl;
- if (! c->pre_text().empty())
- cout << c->pre_text() << endl << endl;
-
- for (std::set<DepTagEntry>::const_iterator t(_all_tags.begin()), t_end(_all_tags.end()) ;
- t != t_end ; ++t)
- {
- if (t->tag->category() != *cat)
- continue;
- t->tag->accept(&tag_displayer);
- }
- cout << endl;
-
- if (! c->post_text().empty())
- cout << c->post_text() << endl << endl;
- }
- }
- }
-
- void
- OurInstallTask::on_display_merge_list_entry(const DepListEntry & d)
- {
- if (d.skip_install && CommandLine::get_instance()->a_show_install_reasons.argument() != "full")
- return;
-
- Context context("When displaying entry '" + stringify(d.package) + "':");
-
- cout << "* " << colour(d.skip_install ? cl_unimportant : cl_package_name,
- d.package.name);
-
- /* display version, unless it's 0 and our category is "virtual" */
- if ((VersionSpec("0") != d.package.version) ||
- CategoryNamePart("virtual") != d.package.name.category)
- cout << "-" << d.package.version;
-
- /* display repository, unless it's our main repository */
- if (DefaultEnvironment::get_instance()->package_database()->favourite_repository() !=
- d.package.repository)
- cout << "::" << d.package.repository;
-
- /* display slot name, unless it's 0 */
- if (SlotName("0") != d.metadata->slot)
- cout << colour(d.skip_install ? cl_unimportant : cl_slot,
- " {:" + stringify(d.metadata->slot) + "}");
-
- /* indicate [U], [S], [N] or [-]. display existing version, if we're
- * already installed */
- PackageDatabaseEntryCollection::Pointer existing(DefaultEnvironment::get_instance()->package_database()->
- query(PackageDepAtom::Pointer(new PackageDepAtom(stringify(
- d.package.name))), is_installed_only));
-
- if (d.skip_install)
- cout << colour(cl_unimportant, " [-]");
- else if (existing->empty())
- {
- cout << colour(cl_updatemode, " [N]");
- if (! d.metadata->get_virtual_interface())
- {
- ++_new_count;
- ++_max_count;
- }
- }
- else
- {
- existing = DefaultEnvironment::get_instance()->package_database()->query(PackageDepAtom::Pointer(
- new PackageDepAtom(stringify(d.package.name) + ":" +
- stringify(d.metadata->slot))),
- is_installed_only);
- if (existing->empty())
- {
- cout << colour(cl_updatemode, " [S]");
- if (! d.metadata->get_virtual_interface())
- {
- ++_new_slot_count;
- ++_max_count;
- }
- }
- else if (existing->last()->version < d.package.version)
- {
- cout << colour(cl_updatemode, " [U " + stringify(
- existing->last()->version) + "]");
- if (! d.metadata->get_virtual_interface())
- {
- ++_upgrade_count;
- ++_max_count;
- }
- }
- else if (existing->last()->version > d.package.version)
- {
- cout << colour(cl_updatemode, " [D " + stringify(
- existing->last()->version) + "]");
- if (! d.metadata->get_virtual_interface())
- {
- ++_downgrade_count;
- ++_max_count;
- }
-
- }
- else
- {
- cout << colour(cl_updatemode, " [R]");
- if (! d.metadata->get_virtual_interface())
- {
- ++_rebuild_count;
- ++_max_count;
- }
- }
- }
-
- /* fetch db entry */
- PackageDatabaseEntry p(d.package);
-
- /* display USE flags */
- if (! d.skip_install)
- std::cout << make_pretty_use_flags_string(DefaultEnvironment::get_instance(), p, d.metadata,
- (existing->empty() ? 0 : &*existing->last()));
-
- /* display tag, add tag to our post display list */
- if (! d.tags->empty())
- {
- std::string tag_titles;
- for (SortedCollection<DepTagEntry>::Iterator
- tag(d.tags->begin()),
- tag_end(d.tags->end()) ;
- tag != tag_end ; ++tag)
- {
- if (tag->tag->category() == "dependency")
- continue;
-
- _all_tags.insert(*tag);
- ShortTagDisplayer t;
- tag->tag->accept(&t);
- tag_titles.append(t.text);
- tag_titles.append(", ");
- }
- if (! tag_titles.empty())
- {
- tag_titles.erase(tag_titles.length() - 2);
- cout << " " << colour(d.skip_install ? cl_unimportant : cl_tag,
- "<" + tag_titles + ">");
- }
-
- /* display dependency tags */
- if ((CommandLine::get_instance()->a_show_install_reasons.argument() == "summary") ||
- (CommandLine::get_instance()->a_show_install_reasons.argument() == "full"))
- {
- std::string deps;
- unsigned count(0), max_count;
- if (CommandLine::get_instance()->a_show_install_reasons.argument() == "summary")
- max_count = 3;
- else
- max_count = std::numeric_limits<long>::max();
-
- for (SortedCollection<DepTagEntry>::Iterator
- tag(d.tags->begin()),
- tag_end(d.tags->end()) ;
- tag != tag_end ; ++tag)
- {
- if (tag->tag->category() != "dependency")
- continue;
-
- if (++count < max_count)
- {
- deps.append(tag->tag->short_text());
- deps.append(", ");
- }
- }
- if (! deps.empty())
- {
- if (count >= max_count)
- deps.append(stringify(count - max_count + 1) + " more, ");
-
- deps.erase(deps.length() - 2);
- cout << " " << colour(d.skip_install ? cl_unimportant : cl_tag,
- "<" + deps + ">");
- }
- }
- }
-
- cout << endl;
- }
-
void show_resume_command(const InstallTask & task)
{
if (CommandLine::get_instance()->a_fetch.specified() ||
diff --git a/src/paludis/paludis.cc b/src/paludis/paludis.cc
index c9f8178..42c8c85 100644
--- a/src/paludis/paludis.cc
+++ b/src/paludis/paludis.cc
@@ -20,7 +20,7 @@
#include "applets.hh"
#include "colour.hh"
#include "command_line.hh"
-#include "contents.hh"
+#include "do_contents.hh"
#include "install.hh"
#include "list.hh"
#include "news.hh"
diff --git a/src/qualudis/Makefile.am b/src/qualudis/Makefile.am
index 70db0bc..68f238e 100644
--- a/src/qualudis/Makefile.am
+++ b/src/qualudis/Makefile.am
@@ -22,7 +22,7 @@ qualudis_LDADD = \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/src/libcolour.a \
+ $(top_builddir)/src/liboutput.a \
$(PCREPLUSPLUS_LIBS) \
$(LIBXML2DEPS_LIBS) \
$(DYNAMIC_LD_LIBS)
@@ -53,7 +53,7 @@ man_qualudis_SOURCES = \
man_qualudis_LDADD = \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(top_builddir)/src/libcolour.a \
+ $(top_builddir)/src/liboutput.a \
$(DYNAMIC_LD_LIBS)
CLEANFILES = *~ version_TEST gmon.out *.gcov *.gcno *.gcda
diff --git a/src/paludis/use.cc b/src/use.cc
index f598e48..f598e48 100644
--- a/src/paludis/use.cc
+++ b/src/use.cc
diff --git a/src/paludis/use.hh b/src/use.hh
index ed7e846..ed7e846 100644
--- a/src/paludis/use.hh
+++ b/src/use.hh