aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-25 15:00:10 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-03-25 15:00:10 +0000
commite949dbe8c3d28cfe35ed791c850855b08387cba2 (patch)
treed3f8890156cb739fbfc98672f26c0410310abfb1
parent9871f43a52bc1a3605328433179df9c35b05dc3c (diff)
downloadpaludis-e949dbe8c3d28cfe35ed791c850855b08387cba2.tar.gz
paludis-e949dbe8c3d28cfe35ed791c850855b08387cba2.tar.xz
Show all installed and best installable for paludis --info
-rw-r--r--NEWS3
-rw-r--r--src/clients/paludis/info.cc51
2 files changed, 33 insertions, 21 deletions
diff --git a/NEWS b/NEWS
index 25e2664..14d6470 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ trunk/:
* paludis now has an --executables option, this will show all executables
installed by a package that are in $PATH.
+ * paludis --info pkg now shows information about all installed matches and
+ the best installable match by default.
+
* Installation details for pretend_resume demo hook have changed. Please
remove any old symlinks and see the comments at the start of the file
for new instructions.
diff --git a/src/clients/paludis/info.cc b/src/clients/paludis/info.cc
index 988ae51..baf083c 100644
--- a/src/clients/paludis/info.cc
+++ b/src/clients/paludis/info.cc
@@ -212,33 +212,42 @@ int do_one_info(
tr1::shared_ptr<const PackageIDSequence>
entries(env->package_database()->query(query::Matches(*spec), qo_order_by_version)),
- preferred_entries(env->package_database()->query(
- query::Matches(*spec) & query::InstalledAtRoot(env->root()), qo_order_by_version));
+ installed_entries(env->package_database()->query(
+ query::Matches(*spec) & query::InstalledAtRoot(env->root()), qo_order_by_version)),
+ installable_entries(env->package_database()->query(
+ query::Matches(*spec) & query::SupportsAction<InstallAction>() & query::NotMasked(),
+ qo_order_by_version));
+
+ tr1::shared_ptr<PackageIDSequence> to_show_entries(new PackageIDSequence);
if (entries->empty())
throw NoSuchPackageError(q);
- if (preferred_entries->empty())
- preferred_entries = entries;
- tr1::shared_ptr<const PackageID> display_entry(*preferred_entries->last());
- for (PackageIDSequence::ConstIterator i(preferred_entries->begin()),
- i_end(preferred_entries->end()) ; i != i_end ; ++i)
- if (! (*i)->masked())
- display_entry = *i;
+ if (! installed_entries->empty())
+ std::copy(installed_entries->begin(), installed_entries->end(), to_show_entries->back_inserter());
- InfoAction a;
- try
- {
- cout << "Package " << colour(cl_package_name, *display_entry) << ":" << endl;
- cout << endl;
- display_entry->perform_action(a);
- cout << endl;
- }
- catch (const UnsupportedActionError &)
+ if (! installable_entries->empty())
+ to_show_entries->push_back(*installable_entries->last());
+
+ if (to_show_entries->empty())
+ to_show_entries->push_back(*entries->last());
+
+ for (PackageIDSequence::ConstIterator p(to_show_entries->begin()), p_end(to_show_entries->end()) ;
+ p != p_end ; ++p)
{
- cout << " No extra information available for '" << *display_entry << "'" << endl;
- cout << endl;
- return 1;
+ InfoAction a;
+ try
+ {
+ cout << "Package " << colour(cl_package_name, **p) << ":" << endl;
+ cout << endl;
+ (*p)->perform_action(a);
+ cout << endl;
+ }
+ catch (const UnsupportedActionError &)
+ {
+ cout << " No extra information available for '" << **p << "'" << endl;
+ cout << endl;
+ }
}
return 0;