aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-17 14:23:55 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-17 14:23:55 +0000
commitb5570654f83853cea8b57721cf32c04087a2b4c1 (patch)
tree9e4bbfd833c12ac5f3844d0e7209c1dd5ec9c119
parent5bcdc196a0d053ebae82b6d91b3d525e8b63e7b5 (diff)
downloadpaludis-b5570654f83853cea8b57721cf32c04087a2b4c1.tar.gz
paludis-b5570654f83853cea8b57721cf32c04087a2b4c1.tar.xz
Show why masked packages are masked
-rw-r--r--src/output/console_install_task.cc66
-rw-r--r--src/output/console_install_task.hh3
2 files changed, 69 insertions, 0 deletions
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 1dd0865..4584afe 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -20,12 +20,16 @@
#include "console_install_task.hh"
#include "colour.hh"
#include "use_flag_pretty_printer.hh"
+#include "licence.hh"
#include <paludis/util/log.hh>
#include <paludis/util/collection_concrete.hh>
#include <paludis/util/compare.hh>
#include <paludis/util/sr.hh>
#include <paludis/util/strip.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/iterator.hh>
#include <algorithm>
#include <set>
@@ -215,6 +219,9 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_use(d, existing, existing_slot, m);
display_merge_list_entry_tags(d, m);
display_merge_list_entry_end(d, m);
+
+ if (d.kind == dlk_masked)
+ display_merge_list_entry_mask_reasons(d);
}
void
@@ -1041,6 +1048,12 @@ ConsoleInstallTask::render_as_error(const std::string & s) const
}
std::string
+ConsoleInstallTask::render_as_masked(const std::string & s) const
+{
+ return colour(cl_masked, s);
+}
+
+std::string
ConsoleInstallTask::render_plural(int c, const std::string & s, const std::string & p) const
{
return 1 == c ? s : p;
@@ -1089,3 +1102,56 @@ EntryDepTagDisplayer::visit(const GeneralSetDepTag * const tag)
text() = tag->short_text(); // + "<" + tag->source() + ">";
}
+void
+ConsoleInstallTask::display_merge_list_entry_mask_reasons(const DepListEntry & e)
+{
+ MaskReasons r(environment()->mask_reasons(e.package));
+ bool need_comma(false);
+
+ output_no_endl(" Masked by: ");
+
+ for (unsigned mm = 0 ; mm < r.size() ; ++mm)
+ if (r[mm])
+ {
+ if (need_comma)
+ output_no_endl(", ");
+ output_no_endl(stringify(MaskReason(mm)));
+
+ 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);
+
+ if (eapi_str == "UNKNOWN")
+ output_no_endl(" ( " + render_as_masked(eapi_str) + " ) (probably a broken ebuild)");
+ else
+ output_no_endl(" ( " + render_as_masked(eapi_str) + " )");
+ }
+ else if (mr_license == mm)
+ {
+ output_no_endl(" ");
+
+ LicenceDisplayer ld(output_stream(), environment(), &e.package);
+ environment()->package_database()->fetch_repository(
+ e.package.repository)->version_metadata(e.package.name, e.package.version)->license()->accept(&ld);
+ }
+ else if (mr_keyword == mm)
+ {
+ VersionMetadata::ConstPointer meta(environment()->package_database()->fetch_repository(
+ e.package.repository)->version_metadata(e.package.name, e.package.version));
+ if (meta->get_ebuild_interface())
+ {
+ std::set<KeywordName> keywords;
+ WhitespaceTokeniser::get_instance()->tokenise(meta->get_ebuild_interface()->keywords,
+ create_inserter<KeywordName>(std::inserter(keywords, keywords.end())));
+
+ output_no_endl(" ( " + render_as_masked(join(keywords.begin(), keywords.end(), " ")) + " )");
+ }
+ }
+
+ need_comma = true;
+ }
+
+ output_endl();
+}
+
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 0108557..667b933 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -186,6 +186,7 @@ namespace paludis
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_masked(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;
@@ -219,6 +220,8 @@ namespace paludis
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_merge_list_entry_mask_reasons(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 &);