aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-12-10 21:17:30 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-12-10 21:17:30 +0000
commita577075f7c03397b6cc3d6b8847523568a325a92 (patch)
treea4ea45c61fbf1458d808c9ad418029ea6c8da52c
parent12a065ff94baf61a8d16576e3e76e019013c3d85 (diff)
downloadpaludis-a577075f7c03397b6cc3d6b8847523568a325a92.tar.gz
paludis-a577075f7c03397b6cc3d6b8847523568a325a92.tar.xz
Fix new/changed options display
Prefer to compare against installed package in the same slot, if any, and display flag descriptions for brand new packages.
-rw-r--r--src/output/console_install_task.cc33
-rw-r--r--src/output/console_install_task.hh3
2 files changed, 24 insertions, 12 deletions
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 1ed1ac0..bab568b 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -456,7 +456,7 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_non_package_tags(d, m);
if (! want_compact())
display_merge_list_entry_package_tags(d, m);
- display_merge_list_entry_choices(d, m, existing_repo);
+ display_merge_list_entry_choices(d, m, existing_repo, existing_slot_repo);
display_merge_list_entry_description(d, existing_repo, existing_slot_repo, m);
display_merge_list_entry_distsize(d, m);
if (want_compact())
@@ -1058,7 +1058,8 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
void
ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
const DisplayMode m,
- const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo
+ const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo,
+ const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo
)
{
switch (m)
@@ -1073,10 +1074,14 @@ ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
if (! d.package_id()->choices_key())
break;
+ std::tr1::shared_ptr<const PackageID> old_id;
+ if (existing_slot_repo && ! existing_slot_repo->empty())
+ old_id = *existing_slot_repo->last();
+ else if (existing_repo && ! existing_repo->empty())
+ old_id = *existing_repo->last();
std::tr1::shared_ptr<const Choices> old_choices;
- if (existing_repo && ! existing_repo->empty())
- if ((*existing_repo->last())->choices_key())
- old_choices = (*existing_repo->last())->choices_key()->value();
+ if (old_id && old_id->choices_key())
+ old_choices = old_id->choices_key()->value();
ColourFormatter formatter;
std::string s;
@@ -1126,13 +1131,18 @@ ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
}
bool changed(false), added(false);
- if (old_choices && (*k)->consider_added_or_changed())
+ if ((*k)->consider_added_or_changed())
{
- std::tr1::shared_ptr<const ChoiceValue> old_choice(old_choices->find_by_name_with_prefix((*i)->name_with_prefix()));
- if (! old_choice)
+ if (old_choices)
+ {
+ std::tr1::shared_ptr<const ChoiceValue> old_choice(old_choices->find_by_name_with_prefix((*i)->name_with_prefix()));
+ if (! old_choice)
+ added = true;
+ else if (old_choice->enabled() != (*i)->enabled())
+ changed = true;
+ }
+ else
added = true;
- else if (old_choice->enabled() != (*i)->enabled())
- changed = true;
}
if (changed)
@@ -1143,7 +1153,8 @@ ConsoleInstallTask::display_merge_list_entry_choices(const DepListEntry & d,
}
else if (added)
{
- t = formatter.decorate(**i, t, format::Added());
+ if (old_id)
+ t = formatter.decorate(**i, t, format::Added());
if (want_new_use_flags())
_choice_descriptions[(*k)->human_name()][(*i)->name_with_prefix()].push_back(d.package_id());
}
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 0a85a3b..2fedde5 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -223,7 +223,8 @@ namespace paludis
const std::tr1::shared_ptr<const PackageIDSequence> &,
const std::tr1::shared_ptr<const PackageIDSequence> &, const DisplayMode);
virtual void display_merge_list_entry_choices(const DepListEntry &, const DisplayMode,
- const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo);
+ const std::tr1::shared_ptr<const PackageIDSequence> & existing_repo,
+ const std::tr1::shared_ptr<const PackageIDSequence> & existing_slot_repo);
virtual void display_merge_list_entry_distsize(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_non_package_tags(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_package_tags(const DepListEntry &, const DisplayMode);