aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-01 20:33:28 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-06-01 20:33:28 +0100
commit0da2430fdd9481bc0dc623547a3897424b934edb (patch)
treef1845a5a80e61fbb6fda9181c4d72cc273ac76b3
parentcea791795b4752c6af18c3b5da0cf3de64035fec (diff)
downloadpaludis-0da2430fdd9481bc0dc623547a3897424b934edb.tar.gz
paludis-0da2430fdd9481bc0dc623547a3897424b934edb.tar.xz
Show mask reasons info
Fixes: ticket:859
-rw-r--r--src/clients/cave/cmd_display_resolution.cc166
-rw-r--r--src/clients/cave/colour_formatter.cc9
-rw-r--r--src/clients/cave/colour_formatter.hh6
-rw-r--r--src/clients/cave/formats.cc6
-rw-r--r--src/clients/cave/formats.hh2
5 files changed, 186 insertions, 3 deletions
diff --git a/src/clients/cave/cmd_display_resolution.cc b/src/clients/cave/cmd_display_resolution.cc
index 37a247b..693d0ed 100644
--- a/src/clients/cave/cmd_display_resolution.cc
+++ b/src/clients/cave/cmd_display_resolution.cc
@@ -39,6 +39,7 @@
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/simple_visitor_cast.hh>
#include <paludis/util/log.hh>
+#include <paludis/util/pretty_print.hh>
#include <paludis/resolver/resolutions.hh>
#include <paludis/resolver/reason.hh>
#include <paludis/resolver/sanitised_dependencies.hh>
@@ -827,6 +828,169 @@ namespace
}
};
+ struct MaskedByKeyVisitor
+ {
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > & k)
+ {
+ cout << " " << k.human_name() << " " << *k.value() << endl;
+ }
+
+ void visit(const MetadataValueKey<std::string> & k)
+ {
+ cout << " " << k.human_name() << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataValueKey<SlotName> & k)
+ {
+ cout << " " << k.human_name() << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataValueKey<long> & k)
+ {
+ cout << " " << k.human_name() << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataValueKey<bool> & k)
+ {
+ cout << " " << k.human_name() << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataSectionKey & k)
+ {
+ cout << " " << k.human_name() << endl;
+ }
+
+ void visit(const MetadataTimeKey & k)
+ {
+ cout << " " << k.human_name() << " " << pretty_print_time(k.value().seconds()) << endl;
+ }
+
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Contents> > & k)
+ {
+ cout << " " << k.human_name() << endl;
+ }
+
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > & k)
+ {
+ cout << " " << k.value()->mask_file() << endl;
+ for (Sequence<std::string>::ConstIterator l(k.value()->comment()->begin()), l_end(k.value()->comment()->end()) ;
+ l != l_end ; ++l)
+ cout << " " << *l << endl;
+ }
+
+ void visit(const MetadataValueKey<FSEntry> & k)
+ {
+ cout << " " << k.human_name() << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataCollectionKey<Set<std::string> > & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataCollectionKey<Sequence<std::string> > & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataCollectionKey<FSEntrySequence> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataCollectionKey<PackageIDSequence> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataCollectionKey<KeywordNameSet> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << " " << k.pretty_print_flat(formatter) << endl;
+ }
+
+ void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k)
+ {
+ ColourFormatter formatter(0);
+ cout << " " << k.human_name() << endl;
+ }
+ };
+
+ struct MaskedByVisitor
+ {
+ void visit(const UserMask & m) const
+ {
+ cout << " Masked by " << m.description() << endl;
+ }
+
+ void visit(const RepositoryMask & m) const
+ {
+ MaskedByKeyVisitor v;
+ cout << " Masked by " << m.description() << endl;
+ if (m.mask_key())
+ m.mask_key()->accept(v);
+ }
+
+ void visit(const UnacceptedMask & m) const
+ {
+ MaskedByKeyVisitor v;
+ cout << " Masked by " << m.description() << endl;
+ if (m.unaccepted_key())
+ m.unaccepted_key()->accept(v);
+ }
+
+ void visit(const UnsupportedMask & m) const
+ {
+ cout << " Masked by " << m.description() << " (" << m.explanation() << ")" << endl;
+ }
+
+ void visit(const AssociationMask & m) const
+ {
+ cout << " Masked by " << m.description() <<
+ " (associated package '" << *m.associated_package() << "*)" << endl;
+ }
+ };
+
void display_unable_to_make_decision(
const std::tr1::shared_ptr<Environment> & env,
const std::tr1::shared_ptr<const Resolution> & resolution,
@@ -867,7 +1031,7 @@ namespace
for (PackageID::MasksConstIterator m(u->package_id()->begin_masks()),
m_end(u->package_id()->end_masks()) ;
m != m_end ; ++m)
- cout << " Masked by " << (*m)->description() << endl;
+ (*m)->accept(MaskedByVisitor());
std::set<std::string> duplicates;
for (Constraints::ConstIterator c(u->unmet_constraints()->begin()),
diff --git a/src/clients/cave/colour_formatter.cc b/src/clients/cave/colour_formatter.cc
index 7ef2e18..d8b74c1 100644
--- a/src/clients/cave/colour_formatter.cc
+++ b/src/clients/cave/colour_formatter.cc
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh
*
* 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
@@ -244,6 +244,13 @@ ColourFormatter::format(const NamedSetDepSpec & s, const format::Plain &) const
return format_general_s(f::colour_formatter_named_set_dep_spec_plain(), stringify(s));
}
+
+std::string
+ColourFormatter::format(const FSEntry & s, const format::Plain &) const
+{
+ return format_general_s(f::colour_formatter_fsentry_plain(), stringify(s));
+}
+
std::string
ColourFormatter::newline() const
{
diff --git a/src/clients/cave/colour_formatter.hh b/src/clients/cave/colour_formatter.hh
index a96b861..aaf7010 100644
--- a/src/clients/cave/colour_formatter.hh
+++ b/src/clients/cave/colour_formatter.hh
@@ -1,7 +1,7 @@
/* vim: set sw=4 sts=4 et foldmethod=syntax : */
/*
- * Copyright (c) 2008, 2009 Ciaran McCreesh
+ * Copyright (c) 2008, 2009, 2010 Ciaran McCreesh
*
* 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
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_SRC_CLIENTS_CAVE_COLOUR_FORMATTER_HH 1
#include <paludis/util/attributes.hh>
+#include <paludis/util/fs_entry-fwd.hh>
#include <paludis/formatter.hh>
namespace paludis
@@ -43,6 +44,7 @@ namespace paludis
public CanFormat<NamedSetDepSpec>,
public CanFormat<PlainTextLabelDepSpec>,
public CanFormat<ChoiceValue>,
+ public CanFormat<paludis::FSEntry>,
public CanSpace
{
private:
@@ -101,6 +103,8 @@ namespace paludis
std::string format(const NamedSetDepSpec &, const format::Plain &) const;
+ std::string format(const FSEntry &, const format::Plain &) const;
+
std::string newline() const;
std::string indent(const int) const;
};
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index 1d305a2..f029318 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -502,6 +502,12 @@ paludis::cave::f::colour_formatter_named_set_dep_spec_plain()
}
const std::string
+paludis::cave::f::colour_formatter_fsentry_plain()
+{
+ return "%s";
+}
+
+const std::string
paludis::cave::f::show_contents_file()
{
return "%{if b}%{column 30}%{endif}%r%{if b}\\n%{else} %{endif}";
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index 97a3f1d..05bd498 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -143,6 +143,8 @@ namespace paludis
const std::string colour_formatter_named_set_dep_spec_plain();
+ const std::string colour_formatter_fsentry_plain();
+
const std::string colour_formatter_indent();
const std::string sync_heading();