aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-16 08:23:00 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-16 08:23:00 +0000
commitdc95c2f26ea490fce48575cd19b995d2b34297cf (patch)
treeecf718069b33a1ca5b0ba586ba3bd7f7bdfc09e4 /src
parent7385570bea9b9d1954edf7a824fa61bd42c371e8 (diff)
downloadpaludis-dc95c2f26ea490fce48575cd19b995d2b34297cf.tar.gz
paludis-dc95c2f26ea490fce48575cd19b995d2b34297cf.tar.xz
Replace RepositoryInfo with emtadata keys. Change how we handle ambiguous _imp. Introduce common Literal metadata key classes to reduce duplicated code. Fixes: ticket:438. Fixes: ticket:416
Diffstat (limited to 'src')
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc18
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh12
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/repository_info_model.cc7
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/repository_info_model.hh2
-rw-r--r--src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc5
-rw-r--r--src/clients/importare/importare.cc4
-rw-r--r--src/clients/inquisitio/do_search.cc3
-rw-r--r--src/clients/inquisitio/key_extractor.cc11
-rw-r--r--src/clients/instruo/instruo.cc5
-rw-r--r--src/clients/paludis/applets.cc166
-rw-r--r--src/clients/paludis/info.cc147
-rw-r--r--src/clients/paludis/list.cc22
-rw-r--r--src/clients/paludis/owner.cc3
-rw-r--r--src/clients/qualudis/qualudis.cc10
-rw-r--r--src/output/colour_formatter.cc18
-rw-r--r--src/output/colour_formatter.hh12
-rw-r--r--src/output/console_query_task.cc26
-rw-r--r--src/output/mask_displayer.cc34
18 files changed, 404 insertions, 101 deletions
diff --git a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc
index 1bf6d88..b0ede92 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.cc
@@ -215,21 +215,27 @@ MarkupFormatter::format(const BlockDepSpec & f, const format::Plain &) const
}
std::string
-MarkupFormatter::format(const tr1::shared_ptr<const PackageID> & f, const format::Plain &) const
+MarkupFormatter::format(const FSEntry & f, const format::Plain &) const
{
- return markup_escape(stringify(*f));
+ return markup_escape(stringify(f));
+}
+
+std::string
+MarkupFormatter::format(const PackageID & f, const format::Plain &) const
+{
+ return markup_escape(stringify(f));
}
std::string
-MarkupFormatter::format(const tr1::shared_ptr<const PackageID> & f, const format::Installed &) const
+MarkupFormatter::format(const PackageID & f, const format::Installed &) const
{
- return markup_foreground("blue", markup_escape(stringify(*f)));
+ return markup_foreground("blue", markup_escape(stringify(f)));
}
std::string
-MarkupFormatter::format(const tr1::shared_ptr<const PackageID> & f, const format::Installable &) const
+MarkupFormatter::format(const PackageID & f, const format::Installable &) const
{
- return markup_foreground("darkblue", markup_escape(stringify(*f)));
+ return markup_foreground("darkblue", markup_escape(stringify(f)));
}
std::string
diff --git a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh
index 57cfc6b..d5e0fcc 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/markup_formatter.hh
@@ -6,6 +6,7 @@
#include <paludis/formatter.hh>
#include <paludis/name-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace gtkpaludis
{
@@ -23,7 +24,8 @@ namespace gtkpaludis
public paludis::CanFormat<paludis::FetchableURIDepSpec>,
public paludis::CanFormat<paludis::LicenseDepSpec>,
public paludis::CanFormat<paludis::NamedSetDepSpec>,
- public paludis::CanFormat<paludis::tr1::shared_ptr<const paludis::PackageID> >,
+ public paludis::CanFormat<paludis::PackageID>,
+ public paludis::CanFormat<paludis::FSEntry>,
public paludis::CanFormat<std::string>,
public paludis::CanSpace
{
@@ -76,9 +78,11 @@ namespace gtkpaludis
std::string format(const paludis::BlockDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::tr1::shared_ptr<const paludis::PackageID> &, const paludis::format::Plain &) const;
- std::string format(const paludis::tr1::shared_ptr<const paludis::PackageID> &, const paludis::format::Installed &) const;
- std::string format(const paludis::tr1::shared_ptr<const paludis::PackageID> &, const paludis::format::Installable &) const;
+ std::string format(const paludis::PackageID &, const paludis::format::Plain &) const;
+ std::string format(const paludis::PackageID &, const paludis::format::Installed &) const;
+ std::string format(const paludis::PackageID &, const paludis::format::Installable &) const;
+
+ std::string format(const paludis::FSEntry &, const paludis::format::Plain &) const;
std::string newline() const;
std::string indent(const int) const;
diff --git a/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.cc
index 727a890..3d6a75d 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.cc
@@ -5,7 +5,6 @@
#include <paludis/repository.hh>
#include <paludis/environment.hh>
#include <paludis/package_database.hh>
-#include <paludis/repository_info.hh>
#include <paludis/util/wrapped_forward_iterator.hh>
#include <paludis/util/private_implementation_pattern-impl.hh>
#include <paludis/util/indirect_iterator-impl.hh>
@@ -39,13 +38,16 @@ RepositoryInfoModel::~RepositoryInfoModel()
}
void
-RepositoryInfoModel::set_repository(const RepositoryName & name)
+RepositoryInfoModel::set_repository(const RepositoryName &)
{
+#if 0
_imp->main_window->paludis_thread_action(
sigc::bind(sigc::mem_fun(this, &RepositoryInfoModel::set_repository_in_paludis_thread), name),
"Populating repository information model");
+#endif
}
+#if 0
void
RepositoryInfoModel::set_repository_in_paludis_thread(const RepositoryName & name)
{
@@ -76,6 +78,7 @@ RepositoryInfoModel::set_repository_in_gui_thread(tr1::shared_ptr<const Reposito
}
}
}
+#endif
RepositoryInfoModel::Columns::Columns()
{
diff --git a/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.hh b/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.hh
index 2f77bba..6243503 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.hh
+++ b/src/clients/gtkpaludis/libgtkpaludis/repository_info_model.hh
@@ -22,8 +22,10 @@ namespace gtkpaludis
public Gtk::TreeStore
{
private:
+#if 0
void set_repository_in_paludis_thread(const paludis::RepositoryName &);
void set_repository_in_gui_thread(paludis::tr1::shared_ptr<const paludis::RepositoryInfo>);
+#endif
public:
RepositoryInfoModel(MainWindow * const);
diff --git a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
index 0a08f6c..331f141 100644
--- a/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
+++ b/src/clients/gtkpaludis/libgtkpaludis/version_info_model.cc
@@ -114,6 +114,11 @@ namespace gtkpaludis
got_key(k, k.pretty_print_flat(formatter));
}
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ got_key(k, k.pretty_print_flat(formatter));
+ }
+
void visit(const MetadataSetKey<UseFlagNameSet> & k)
{
got_key(k, k.pretty_print_flat(formatter));
diff --git a/src/clients/importare/importare.cc b/src/clients/importare/importare.cc
index 7125dea..404c181 100644
--- a/src/clients/importare/importare.cc
+++ b/src/clients/importare/importare.cc
@@ -135,7 +135,9 @@ main(int argc, char *argv[])
for (PackageIDSequence::ConstIterator i(old_ids->begin()), i_end(old_ids->end()) ;
i != i_end ; ++i)
{
- if ((*i)->repository()->format() != "installed_unpackaged")
+ if (! (*i)->repository()->format_key())
+ continue;
+ if ((*i)->repository()->format_key()->value() != "installed_unpackaged")
continue;
old_id = *i;
break;
diff --git a/src/clients/inquisitio/do_search.cc b/src/clients/inquisitio/do_search.cc
index 2e6fdb3..aac97c7 100644
--- a/src/clients/inquisitio/do_search.cc
+++ b/src/clients/inquisitio/do_search.cc
@@ -30,6 +30,7 @@
#include <paludis/package_database.hh>
#include <paludis/action.hh>
#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
#include <paludis/util/set.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/make_shared_ptr.hh>
@@ -208,7 +209,7 @@ do_search(const Environment & env)
if (CommandLine::get_instance()->a_repository_format.end_args() ==
std::find_if(CommandLine::get_instance()->a_repository_format.begin_args(),
CommandLine::get_instance()->a_repository_format.end_args(),
- tr1::bind(std::equal_to<std::string>(), _1, stringify((*r)->format()))))
+ tr1::bind(std::equal_to<std::string>(), _1, (*r)->format_key() ? (*r)->format_key()->value() : "?")))
continue;
if (CommandLine::get_instance()->a_kind.argument() == "installable")
diff --git a/src/clients/inquisitio/key_extractor.cc b/src/clients/inquisitio/key_extractor.cc
index 7f384ef..2c7b04c 100644
--- a/src/clients/inquisitio/key_extractor.cc
+++ b/src/clients/inquisitio/key_extractor.cc
@@ -269,6 +269,17 @@ namespace
tr1::bind(&Matcher::operator(), tr1::cref(_m), _1));
}
+ void visit(const MetadataSetKey<FSEntrySequence> & s)
+ {
+ using namespace tr1::placeholders;
+
+ if (_flatten)
+ result = _m(join(s.value()->begin(), s.value()->end(), " "));
+ else
+ result = s.value()->end() != std::find_if(s.value()->begin(), s.value()->end(),
+ tr1::bind(&Matcher::operator(), tr1::cref(_m), tr1::bind(&stringify<FSEntry>, _1)));
+ }
+
void visit(const MetadataSetKey<PackageIDSequence> & s)
{
using namespace tr1::placeholders;
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 015a37b..1baadb8 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -120,6 +120,11 @@ namespace
const tr1::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value());
}
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ const tr1::shared_ptr<const FSEntrySequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
void visit(const MetadataSetKey<KeywordNameSet> & k)
{
const tr1::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
diff --git a/src/clients/paludis/applets.cc b/src/clients/paludis/applets.cc
index de4afa6..d4d4fe1 100644
--- a/src/clients/paludis/applets.cc
+++ b/src/clients/paludis/applets.cc
@@ -40,6 +40,130 @@
using namespace paludis;
+namespace
+{
+ struct ValuePrinter :
+ ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ int return_code;
+
+ ValuePrinter() :
+ return_code(0)
+ {
+ }
+
+ void visit(const MetadataStringKey & k)
+ {
+ std::cout << k.value() << std::endl;
+ }
+
+ void visit(const MetadataFSEntryKey & k)
+ {
+ std::cout << k.value() << std::endl;
+ }
+
+ void visit(const MetadataRepositoryMaskInfoKey &)
+ {
+ std::cout << "(unprintable)" << std::endl;
+ return_code |= 1;
+ }
+
+ void visit(const MetadataSectionKey &)
+ {
+ std::cout << "(unprintable)" << std::endl;
+ return_code |= 1;
+ }
+
+ void visit(const MetadataContentsKey &)
+ {
+ std::cout << "(unprintable)" << std::endl;
+ return_code |= 1;
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSetKey<PackageIDSequence> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataSetKey<Set<std::string> > & k)
+ {
+ StringifyFormatter f;
+ std::cout << k.pretty_print_flat(f) << std::endl;
+ }
+
+ void visit(const MetadataPackageIDKey & k)
+ {
+ std::cout << *k.value() << std::endl;
+ }
+
+ void visit(const MetadataTimeKey & k)
+ {
+ std::cout << k.value() << std::endl;
+ }
+ };
+}
+
int do_has_version(tr1::shared_ptr<Environment> env)
{
int return_code(0);
@@ -174,29 +298,21 @@ int do_environment_variable(tr1::shared_ptr<Environment> env)
int do_configuration_variable(tr1::shared_ptr<Environment> env)
{
- int return_code(0);
-
Context context("When performing configuration-variable action from command line:");
std::string repo_str(*CommandLine::get_instance()->begin_parameters());
std::string var_str(* next(CommandLine::get_instance()->begin_parameters()));
- tr1::shared_ptr<const RepositoryInfo> info(env->package_database()->fetch_repository(
- RepositoryName(repo_str))->info(false));
-
- return_code = 1;
- for (RepositoryInfo::SectionConstIterator s(info->begin_sections()),
- s_end(info->end_sections()) ; s != s_end ; ++s)
- for (RepositoryInfoSection::KeyValueConstIterator k((*s)->begin_kvs()),
- k_end((*s)->end_kvs()) ; k != k_end ; ++k)
- if (var_str == k->first)
- {
- std::cout << k->second << std::endl;
- return_code = 0;
- break;
- }
-
- return return_code;
+ const tr1::shared_ptr<const Repository> repo(env->package_database()->fetch_repository(RepositoryName(repo_str)));
+ Repository::MetadataConstIterator i(repo->find_metadata(var_str));
+ if (i == repo->end_metadata())
+ return 1;
+ else
+ {
+ ValuePrinter v;
+ (*i)->accept(v);
+ return v.return_code;
+ }
}
int do_list_repository_formats()
@@ -303,8 +419,18 @@ int do_regenerate_cache(tr1::shared_ptr<Environment> env, bool installed)
for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (installed != (0 != (*r)->installed_interface))
- continue;
+ if (installed)
+ {
+ SupportsActionTest<InstalledAction> action_test;
+ if (! (*r)->some_ids_might_support_action(action_test))
+ continue;
+ }
+ else
+ {
+ SupportsActionTest<InstallAction> action_test;
+ if (! (*r)->some_ids_might_support_action(action_test))
+ continue;
+ }
std::cout << "Regenerating cache for " << (*r)->name() << "..." << std::endl;
(*r)->regenerate_cache();
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index cd6c8f0..70590c1 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -20,15 +20,16 @@
#include "info.hh"
#include "command_line.hh"
#include "src/output/colour.hh"
+#include "src/output/colour_formatter.hh"
#include <paludis/about.hh>
#include <paludis/util/sequence.hh>
#include <paludis/util/visitor-impl.hh>
#include <paludis/package_database.hh>
#include <paludis/environment.hh>
-#include <paludis/repository_info.hh>
#include <paludis/query.hh>
#include <paludis/package_id.hh>
#include <paludis/action.hh>
+#include <paludis/metadata_key.hh>
#include <iostream>
#include <iomanip>
#include <sys/types.h>
@@ -39,6 +40,135 @@ using namespace paludis;
using std::endl;
using std::cout;
+namespace
+{
+ struct InfoDisplayer :
+ ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ std::string indent;
+
+ InfoDisplayer(const std::string & i) :
+ indent(i)
+ {
+ }
+
+ void visit(const MetadataSectionKey & k)
+ {
+ cout << endl;
+ cout << indent << colour(cl_heading, k.human_name() + ":") << endl;
+ InfoDisplayer i(indent + " ");
+ std::for_each(indirect_iterator(k.begin_metadata()), indirect_iterator(k.end_metadata()), accept_visitor(i));
+ }
+
+ void visit(const MetadataStringKey & k)
+ {
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataFSEntryKey & k)
+ {
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.value() << endl;
+ }
+
+ void visit(const MetadataPackageIDKey & k)
+ {
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << *k.value() << endl;
+ }
+
+ void visit(const MetadataRepositoryMaskInfoKey & k)
+ {
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl;
+ }
+
+ void visit(const MetadataContentsKey & k)
+ {
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << endl;
+ }
+
+ void visit(const MetadataTimeKey & k)
+ {
+ time_t t(k.value());
+ char buf[255];
+ if (! strftime(buf, 254, "%c", gmtime(&t)))
+ buf[0] = '\0';
+
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << stringify(buf) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSetKey<PackageIDSequence> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+
+ void visit(const MetadataSetKey<Set<std::string> > & k)
+ {
+ ColourFormatter f;
+ cout << std::setw(30) << (indent + k.human_name() + ":") << " " << k.pretty_print_flat(f) << endl;
+ }
+ };
+}
+
int do_one_info(
const tr1::shared_ptr<const Environment> & env,
const std::string & q)
@@ -150,18 +280,9 @@ do_info(const tr1::shared_ptr<const Environment> & env)
r != r_end ; ++r)
{
cout << "Repository " << colour(cl_repository_name, r->name()) << ":" << endl;
-
- tr1::shared_ptr<const RepositoryInfo> ii(r->info(true));
- for (RepositoryInfo::SectionConstIterator i(ii->begin_sections()),
- i_end(ii->end_sections()) ; i != i_end ; ++i)
- {
- cout << " " << colour(cl_heading, (*i)->heading() + ":") << endl;
- for (RepositoryInfoSection::KeyValueConstIterator k((*i)->begin_kvs()),
- k_end((*i)->end_kvs()) ; k != k_end ; ++k)
- cout << " " << std::setw(22) << std::left << (stringify(k->first) + ":")
- << std::setw(0) << " " << k->second << endl;
- cout << endl;
- }
+ InfoDisplayer i(" ");
+ std::for_each(indirect_iterator(r->begin_metadata()), indirect_iterator(r->end_metadata()), accept_visitor(i));
+ cout << endl;
}
if (CommandLine::get_instance()->empty())
diff --git a/src/clients/paludis/list.cc b/src/clients/paludis/list.cc
index 3820121..a0a3473 100644
--- a/src/clients/paludis/list.cc
+++ b/src/clients/paludis/list.cc
@@ -22,11 +22,11 @@
#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 <paludis/util/set.hh>
#include <paludis/util/indirect_iterator-impl.hh>
+#include <paludis/metadata_key.hh>
#include <src/output/colour.hh>
#include <paludis/util/tr1_memory.hh>
@@ -59,24 +59,12 @@ do_list_repositories(tr1::shared_ptr<Environment> env)
if (CommandLine::get_instance()->a_repository_format.end_args() == std::find(
CommandLine::get_instance()->a_repository_format.begin_args(),
CommandLine::get_instance()->a_repository_format.end_args(),
- r->format()))
+ r->format_key() ? r->format_key()->value() : "?"))
continue;
ret_code = 0;
std::cout << "* " << colour(cl_repository_name, r->name()) << std::endl;
-
- tr1::shared_ptr<const RepositoryInfo> ii(r->info(false));
- for (RepositoryInfo::SectionConstIterator i(ii->begin_sections()),
- i_end(ii->end_sections()) ; i != i_end ; ++i)
- {
- std::cout << " " << colour(cl_heading, (*i)->heading() + ":") << std::endl;
- for (RepositoryInfoSection::KeyValueConstIterator k((*i)->begin_kvs()),
- k_end((*i)->end_kvs()) ; k != k_end ; ++k)
- std::cout << " " << std::setw(22) << std::left << (stringify(k->first) + ":")
- << std::setw(0) << " " << k->second << std::endl;
- std::cout << std::endl;
- }
}
return ret_code;
@@ -105,7 +93,7 @@ do_list_categories(tr1::shared_ptr<Environment> env)
if (CommandLine::get_instance()->a_repository_format.end_args() == std::find(
CommandLine::get_instance()->a_repository_format.begin_args(),
CommandLine::get_instance()->a_repository_format.end_args(),
- r->format()))
+ r->format_key() ? r->format_key()->value() : "?"))
continue;
tr1::shared_ptr<const CategoryNamePartSet> cat_names(r->category_names());
@@ -158,7 +146,7 @@ do_list_packages(tr1::shared_ptr<Environment> env)
if (CommandLine::get_instance()->a_repository_format.end_args() == std::find(
CommandLine::get_instance()->a_repository_format.begin_args(),
CommandLine::get_instance()->a_repository_format.end_args(),
- r->format()))
+ r->format_key() ? r->format_key()->value() : "?"))
continue;
tr1::shared_ptr<const CategoryNamePartSet> cat_names(r->category_names());
@@ -226,7 +214,7 @@ do_list_sets(tr1::shared_ptr<Environment> env)
if (CommandLine::get_instance()->a_repository_format.end_args() == std::find(
CommandLine::get_instance()->a_repository_format.begin_args(),
CommandLine::get_instance()->a_repository_format.end_args(),
- r->format()))
+ r->format_key() ? r->format_key()->value() : "?"))
continue;
tr1::shared_ptr<const SetNameSet> set_names(r->sets_interface->sets_list());
diff --git a/src/clients/paludis/owner.cc b/src/clients/paludis/owner.cc
index 765fff2..a8c263a 100644
--- a/src/clients/paludis/owner.cc
+++ b/src/clients/paludis/owner.cc
@@ -98,7 +98,8 @@ do_one_owner(
for (PackageDatabase::RepositoryConstIterator r(env->package_database()->begin_repositories()),
r_end(env->package_database()->end_repositories()) ; r != r_end ; ++r)
{
- if (! (*r)->installed_interface)
+ SupportsActionTest<InstalledAction> action_test;
+ if (! (*r)->some_ids_might_support_action(action_test))
continue;
tr1::shared_ptr<const CategoryNamePartSet> cats((*r)->category_names());
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index ab2496b..2691cd7 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -69,6 +69,11 @@ namespace
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
}
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
+ }
+
void visit(const MetadataSetKey<UseFlagNameSet> & k)
{
stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n";
@@ -151,10 +156,7 @@ namespace
void visit(const MetadataSectionKey & k)
{
- if (k.title_key())
- stream << k.raw_name() << ": " << k.title_key()->value() << "\n";
- else
- stream << k.raw_name() << "\n";
+ stream << k.raw_name() << "\n";
}
};
diff --git a/src/output/colour_formatter.cc b/src/output/colour_formatter.cc
index 43de8aa..7e64d52 100644
--- a/src/output/colour_formatter.cc
+++ b/src/output/colour_formatter.cc
@@ -387,21 +387,27 @@ ColourFormatter::format(const BlockDepSpec & f, const format::Plain &) const
}
std::string
-ColourFormatter::format(const tr1::shared_ptr<const PackageID> & f, const format::Plain &) const
+ColourFormatter::format(const PackageID & f, const format::Plain &) const
{
- return stringify(*f);
+ return stringify(f);
+}
+
+std::string
+ColourFormatter::format(const PackageID & f, const format::Installed &) const
+{
+ return colour(cl_package_name, f);
}
std::string
-ColourFormatter::format(const tr1::shared_ptr<const PackageID> & f, const format::Installed &) const
+ColourFormatter::format(const PackageID & f, const format::Installable &) const
{
- return colour(cl_package_name, *f);
+ return colour(cl_installable_package_name, f);
}
std::string
-ColourFormatter::format(const tr1::shared_ptr<const PackageID> & f, const format::Installable &) const
+ColourFormatter::format(const FSEntry & f, const format::Plain &) const
{
- return colour(cl_installable_package_name, *f);
+ return stringify(f);
}
std::string
diff --git a/src/output/colour_formatter.hh b/src/output/colour_formatter.hh
index 74a4465..0f9b9e5 100644
--- a/src/output/colour_formatter.hh
+++ b/src/output/colour_formatter.hh
@@ -24,6 +24,7 @@
#include <paludis/name-fwd.hh>
#include <paludis/dep_spec-fwd.hh>
#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/fs_entry-fwd.hh>
class ColourFormatter :
public paludis::CanFormat<paludis::UseFlagName>,
@@ -39,7 +40,8 @@ class ColourFormatter :
public paludis::CanFormat<paludis::FetchableURIDepSpec>,
public paludis::CanFormat<paludis::LicenseDepSpec>,
public paludis::CanFormat<paludis::NamedSetDepSpec>,
- public paludis::CanFormat<paludis::tr1::shared_ptr<const paludis::PackageID> >,
+ public paludis::CanFormat<paludis::FSEntry>,
+ public paludis::CanFormat<paludis::PackageID>,
public paludis::CanFormat<std::string>,
public paludis::CanSpace,
private paludis::PrivateImplementationPattern<ColourFormatter>
@@ -101,9 +103,11 @@ class ColourFormatter :
std::string format(const paludis::BlockDepSpec &, const paludis::format::Plain &) const;
- std::string format(const paludis::tr1::shared_ptr<const paludis::PackageID> &, const paludis::format::Plain &) const;
- std::string format(const paludis::tr1::shared_ptr<const paludis::PackageID> &, const paludis::format::Installed &) const;
- std::string format(const paludis::tr1::shared_ptr<const paludis::PackageID> &, const paludis::format::Installable &) const;
+ std::string format(const paludis::FSEntry &, const paludis::format::Plain &) const;
+
+ std::string format(const paludis::PackageID &, const paludis::format::Plain &) const;
+ std::string format(const paludis::PackageID &, const paludis::format::Installed &) const;
+ std::string format(const paludis::PackageID &, const paludis::format::Installable &) const;
std::string newline() const;
std::string indent(const int) const;
diff --git a/src/output/console_query_task.cc b/src/output/console_query_task.cc
index f5719a0..6cdef71 100644
--- a/src/output/console_query_task.cc
+++ b/src/output/console_query_task.cc
@@ -274,6 +274,24 @@ namespace
}
}
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ if (k.type() == type)
+ {
+ ColourFormatter formatter;
+ if (task->want_raw())
+ {
+ task->output_left_column(k.raw_name() + ":", in);
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ else
+ {
+ task->output_left_column(k.human_name() + ":", in);
+ task->output_right_column(k.pretty_print_flat(formatter));
+ }
+ }
+ }
+
void visit(const MetadataSetKey<Set<std::string> > & k)
{
if (k.type() == type)
@@ -514,15 +532,13 @@ namespace
}
else
{
- task->output_left_column((k.title_key() ? k.title_key()->value() : k.human_name()) + ":", in);
+ task->output_left_column(k.human_name() + ":", in);
task->output_right_column("");
}
Displayer v(task, env, id, type, in + 4);
- for (MetadataSectionKey::MetadataConstIterator kk(k.begin_metadata()), kk_end(k.end_metadata()) ;
- kk != kk_end ; ++kk)
- if (*kk != k.title_key())
- (*kk)->accept(v);
+ std::for_each(indirect_iterator(k.begin_metadata()), indirect_iterator(k.end_metadata()),
+ accept_visitor(v));
}
}
diff --git a/src/output/mask_displayer.cc b/src/output/mask_displayer.cc
index 5d664e2..ea15114 100644
--- a/src/output/mask_displayer.cc
+++ b/src/output/mask_displayer.cc
@@ -71,29 +71,23 @@ namespace
void visit(const MetadataSectionKey & k)
{
- if (k.title_key())
- s << k.title_key()->value() << ": ";
s << "(";
bool need_comma(false);
for (MetadataSectionKey::MetadataConstIterator m(k.begin_metadata()), m_end(k.end_metadata()) ;
m != m_end ; ++m)
- if ((*m) != k.title_key())
- {
- if (need_comma)
- s << ", ";
- else
- s << " ";
-
- KeyPrettyPrinter p;
- (*m)->accept(p);
- s << p.s.str();
- need_comma = true;
- }
+ {
+ if (need_comma)
+ s << ", ";
+ else
+ s << " ";
+
+ KeyPrettyPrinter p;
+ (*m)->accept(p);
+ s << p.s.str();
+ need_comma = true;
+ }
s << " )";
-
- std::for_each(indirect_iterator(k.begin_metadata()),
- indirect_iterator(k.end_metadata()), accept_visitor(*this));
}
void visit(const MetadataTimeKey & k)
@@ -138,6 +132,12 @@ namespace
s << k.pretty_print_flat(formatter);
}
+ void visit(const MetadataSetKey<FSEntrySequence> & k)
+ {
+ ColourFormatter formatter;
+ s << k.pretty_print_flat(formatter);
+ }
+
void visit(const MetadataSetKey<PackageIDSequence> & k)
{
ColourFormatter formatter;