aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-04 03:51:39 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-02-04 03:51:39 +0000
commit52a0625233533cf0de1d284f17dc3f5fe5704401 (patch)
treeb4ffaa3782608a08c5ff8d304b76f57b0b6646a4
parentfbe5f006c51f4e46cb0de92f2848148a4819697d (diff)
downloadpaludis-52a0625233533cf0de1d284f17dc3f5fe5704401.tar.gz
paludis-52a0625233533cf0de1d284f17dc3f5fe5704401.tar.xz
Show virtual_for for virtual packages in places where it might help. Fixes: ticket:69
-rw-r--r--paludis/dep_list/dep_list.cc43
-rw-r--r--src/output/console_install_task.cc29
-rw-r--r--src/output/console_install_task.hh1
3 files changed, 61 insertions, 12 deletions
diff --git a/paludis/dep_list/dep_list.cc b/paludis/dep_list/dep_list.cc
index 0675ca6..45454fe 100644
--- a/paludis/dep_list/dep_list.cc
+++ b/paludis/dep_list/dep_list.cc
@@ -649,8 +649,15 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
}
}
- SlotName slot(d->_imp->env->package_database()->fetch_repository(best_visible_candidate->repository)->
- version_metadata(best_visible_candidate->name, best_visible_candidate->version)->slot);
+ std::tr1::shared_ptr<const VersionMetadata> best_visible_candidate_metadata(
+ d->_imp->env->package_database()->fetch_repository(best_visible_candidate->repository)->
+ version_metadata(best_visible_candidate->name, best_visible_candidate->version));
+ SlotName slot(best_visible_candidate_metadata->slot);
+ std::string best_visible_candidate_as_string(stringify(*best_visible_candidate));
+ if (best_visible_candidate_metadata->virtual_interface)
+ best_visible_candidate_as_string.append(" (for " + stringify(
+ best_visible_candidate_metadata->virtual_interface->virtual_for) + ")");
+
std::tr1::shared_ptr<PackageDatabaseEntryCollection> already_installed_in_same_slot(
new PackageDatabaseEntryCollection::Concrete);
for (PackageDatabaseEntryCollection::Iterator aa(already_installed->begin()),
@@ -667,13 +674,15 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
if (d->prefer_installed_over_uninstalled(*already_installed_in_same_slot->last(), *best_visible_candidate))
{
Log::get_instance()->message(ll_debug, lc_context, "Taking installed package '"
- + stringify(*already_installed_in_same_slot->last()) + "' over '" + stringify(*best_visible_candidate) + "'");
+ + stringify(*already_installed_in_same_slot->last()) + "' over '" +
+ best_visible_candidate_as_string + "'");
d->add_already_installed_package(*already_installed_in_same_slot->last(), a->tag());
return;
}
else
Log::get_instance()->message(ll_debug, lc_context, "Not taking installed package '"
- + stringify(*already_installed_in_same_slot->last()) + "' over '" + stringify(*best_visible_candidate) + "'");
+ + stringify(*already_installed_in_same_slot->last()) + "' over '" +
+ best_visible_candidate_as_string + "'");
}
else if ((! already_installed->empty()) && (dl_new_slots_as_needed == d->_imp->opts->new_slots))
{
@@ -682,19 +691,19 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
if (d->prefer_installed_over_uninstalled(*already_installed->last(), *best_visible_candidate))
{
Log::get_instance()->message(ll_debug, lc_context, "Taking installed package '"
- + stringify(*already_installed->last()) + "' over '" + stringify(*best_visible_candidate)
+ + stringify(*already_installed->last()) + "' over '" + best_visible_candidate_as_string
+ "' (in different slot)");
d->add_already_installed_package(*already_installed->last(), a->tag());
return;
}
else
Log::get_instance()->message(ll_debug, lc_context, "Not taking installed package '"
- + stringify(*already_installed->last()) + "' over '" + stringify(*best_visible_candidate)
- + "' (in different slot)");
+ + stringify(*already_installed->last()) + "' over '" +
+ best_visible_candidate_as_string + "' (in different slot)");
}
else
Log::get_instance()->message(ll_debug, lc_context, "No installed packages in SLOT '"
- + stringify(slot) + "', taking uninstalled package '" + stringify(*best_visible_candidate) + "'");
+ + stringify(slot) + "', taking uninstalled package '" + best_visible_candidate_as_string + "'");
/* if this is a downgrade, make sure that that's ok */
switch (d->_imp->opts->downgrade)
@@ -716,12 +725,22 @@ DepList::AddVisitor::visit(const PackageDepAtom * const a)
if (are_we_downgrading->last()->version <= best_visible_candidate->version)
break;
+ std::tr1::shared_ptr<const VersionMetadata> are_we_downgrading_last_metadata(
+ d->_imp->env->package_database()->fetch_repository(
+ are_we_downgrading->last()->repository)->version_metadata(
+ are_we_downgrading->last()->name, are_we_downgrading->last()->version));
+ std::string are_we_downgrading_last_as_string(stringify(*are_we_downgrading->last()));
+ if (are_we_downgrading_last_metadata->virtual_interface)
+ are_we_downgrading_last_as_string.append(" (for " + stringify(
+ are_we_downgrading_last_metadata->virtual_interface->virtual_for) + ")");
+
if (d->_imp->opts->downgrade == dl_downgrade_error)
- throw DowngradeNotAllowedError(stringify(*best_visible_candidate),
- stringify(*are_we_downgrading->last()));
+ throw DowngradeNotAllowedError(best_visible_candidate_as_string,
+ are_we_downgrading_last_as_string);
- Log::get_instance()->message(ll_warning, lc_context, "Downgrade to '" + stringify(*best_visible_candidate)
- + "' from '" + stringify(*are_we_downgrading->last()) + "' forced");
+ Log::get_instance()->message(ll_warning, lc_context, "Downgrade to '" +
+ best_visible_candidate_as_string
+ + "' from '" + are_we_downgrading_last_as_string + "' forced");
}
break;
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 2fc8d1d..cbd7f52 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -214,7 +214,12 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_package_name(d, m);
display_merge_list_entry_version(d, m);
display_merge_list_entry_repository(d, m);
+
+ if (d.metadata->virtual_interface)
+ display_merge_list_entry_for(d.metadata->virtual_interface->virtual_for, m);
+
display_merge_list_entry_slot(d, m);
+
display_merge_list_entry_status_and_update_counts(d, existing, existing_slot, m);
display_merge_list_entry_use(d, existing, existing_slot, m);
display_merge_list_entry_tags(d, m);
@@ -687,6 +692,30 @@ ConsoleInstallTask::display_merge_list_entry_package_name(const DepListEntry & d
}
void
+ConsoleInstallTask::display_merge_list_entry_for(const PackageDatabaseEntry & d, const DisplayMode m)
+{
+ switch (m)
+ {
+ case normal_entry:
+ case suggested_entry:
+ break;
+
+ case unimportant_entry:
+ output_no_endl(" (for ");
+ output_no_endl(render_as_unimportant(stringify(d)));
+ output_no_endl(")");
+ break;
+
+ case error_entry:
+ output_no_endl(" (for ");
+ output_no_endl(render_as_package_name(stringify(d.name)));
+ output_no_endl("-" + stringify(d.version) + "::" + stringify(d.repository));
+ output_no_endl(")");
+ break;
+ }
+}
+
+void
ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d, const DisplayMode)
{
if ((VersionSpec("0") != d.package.version) ||
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 636aecd..cf9e7fb 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -209,6 +209,7 @@ namespace paludis
virtual void display_merge_list_entry_version(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_repository(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_slot(const DepListEntry &, const DisplayMode);
+ virtual void display_merge_list_entry_for(const PackageDatabaseEntry &, const DisplayMode);
virtual void display_merge_list_entry_status_and_update_counts(const DepListEntry &,
std::tr1::shared_ptr<const PackageDatabaseEntryCollection>,
std::tr1::shared_ptr<const PackageDatabaseEntryCollection>, const DisplayMode);