aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-08 16:13:32 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-11-08 16:13:32 +0000
commit3192b6fdd8dd9c68179c7de8410e2a418e17087a (patch)
tree569401c937334b38c315072591b670bf8e54ad49
parent97530917bd16b2b30a518a0d2dd6a06b3924a32c (diff)
downloadpaludis-3192b6fdd8dd9c68179c7de8410e2a418e17087a.tar.gz
paludis-3192b6fdd8dd9c68179c7de8410e2a418e17087a.tar.xz
paludis, importare, reconcilio --compact, --show-package-descriptions
-rw-r--r--NEWS2
-rw-r--r--paludis/args/install_args_group.cc25
-rw-r--r--paludis/args/install_args_group.hh10
-rw-r--r--src/clients/contrarius/install.cc15
-rw-r--r--src/clients/importare/install.cc15
-rw-r--r--src/clients/paludis/install.cc15
-rw-r--r--src/clients/reconcilio/install.cc15
-rw-r--r--src/output/console_install_task.cc146
-rw-r--r--src/output/console_install_task.hh9
9 files changed, 210 insertions, 42 deletions
diff --git a/NEWS b/NEWS
index 7b04919..10b6efe 100644
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ trunk/:
* inquisitio --all-versions, --not.
+ * paludis, reconcilio, importare --compact, --show-package-descriptions.
+
0.26.0_alpha3:
* STILL BROKEN, wait for 0.26.0 if you use these: CRAN, Ruby bindings for
dep specs.
diff --git a/paludis/args/install_args_group.cc b/paludis/args/install_args_group.cc
index b55a2a0..21bfd08 100644
--- a/paludis/args/install_args_group.cc
+++ b/paludis/args/install_args_group.cc
@@ -53,6 +53,13 @@ InstallArgsGroup::InstallArgsGroup(ArgsHandler * h, const std::string & our_name
("changed", "Show for new and changed flags")
("all", "Show for all flags"),
"none"),
+ a_show_package_descriptions(this, "show-package-descriptions", '\0', "Show package descriptions",
+ args::EnumArg::EnumArgOptions
+ ("none", "Don't show any descriptions")
+ ("new", "Show descriptions for new packages")
+ ("all", "Show descriptions for all packages"),
+ "none"),
+ a_compact(this, "compact", '\0', "Display output using one line per entry"),
a_continue_on_failure(this, "continue-on-failure", '\0', "Whether to continue after a fetch or install error",
args::EnumArg::EnumArgOptions
("if-fetch-only", "If fetching only")
@@ -176,6 +183,24 @@ InstallArgsGroup::want_use_summary() const
return "none" != a_show_use_descriptions.argument();
}
+bool
+InstallArgsGroup::want_new_descriptions() const
+{
+ return "none" != a_show_package_descriptions.argument();
+}
+
+bool
+InstallArgsGroup::want_existing_descriptions() const
+{
+ return "all" == a_show_package_descriptions.argument();
+}
+
+bool
+InstallArgsGroup::want_compact() const
+{
+ return a_compact.specified();
+}
+
std::string
InstallArgsGroup::paludis_command_fragment() const
{
diff --git a/paludis/args/install_args_group.hh b/paludis/args/install_args_group.hh
index 7f6a6f4..236aead 100644
--- a/paludis/args/install_args_group.hh
+++ b/paludis/args/install_args_group.hh
@@ -95,6 +95,12 @@ namespace paludis
/// --show-use-descriptions
paludis::args::EnumArg a_show_use_descriptions;
+ /// --show-package-descriptions
+ paludis::args::EnumArg a_show_package_descriptions;
+
+ /// --compact
+ paludis::args::SwitchArg a_compact;
+
/// --continue-on-failure
paludis::args::EnumArg a_continue_on_failure;
@@ -127,6 +133,10 @@ namespace paludis
bool want_changed_use_flags() const;
bool want_new_use_flags() const;
+ bool want_compact() const;
+ bool want_new_descriptions() const;
+ bool want_existing_descriptions() const;
+
///\}
/**
diff --git a/src/clients/contrarius/install.cc b/src/clients/contrarius/install.cc
index e1e03cd..96f2ccd 100644
--- a/src/clients/contrarius/install.cc
+++ b/src/clients/contrarius/install.cc
@@ -86,6 +86,21 @@ namespace
return false;
}
+ virtual bool want_new_descriptions() const
+ {
+ return false;
+ }
+
+ virtual bool want_existing_descriptions() const
+ {
+ return false;
+ }
+
+ virtual bool want_compact() const
+ {
+ return false;
+ }
+
virtual std::string make_resume_command(const PackageIDSequence &) const
{
return "";
diff --git a/src/clients/importare/install.cc b/src/clients/importare/install.cc
index fad687b..9eb0850 100644
--- a/src/clients/importare/install.cc
+++ b/src/clients/importare/install.cc
@@ -98,6 +98,21 @@ namespace
return CommandLine::get_instance()->install_args.want_use_summary();
}
+ virtual bool want_compact() const
+ {
+ return CommandLine::get_instance()->install_args.want_compact();
+ }
+
+ virtual bool want_new_descriptions() const
+ {
+ return CommandLine::get_instance()->install_args.want_new_descriptions();
+ }
+
+ virtual bool want_existing_descriptions() const
+ {
+ return CommandLine::get_instance()->install_args.want_existing_descriptions();
+ }
+
virtual std::string make_resume_command(const PackageIDSequence &) const
{
return "";
diff --git a/src/clients/paludis/install.cc b/src/clients/paludis/install.cc
index b49e4f8..6034013 100644
--- a/src/clients/paludis/install.cc
+++ b/src/clients/paludis/install.cc
@@ -101,6 +101,21 @@ namespace
return CommandLine::get_instance()->install_args.want_use_summary();
}
+ virtual bool want_compact() const
+ {
+ return CommandLine::get_instance()->install_args.want_compact();
+ }
+
+ virtual bool want_new_descriptions() const
+ {
+ return CommandLine::get_instance()->install_args.want_new_descriptions();
+ }
+
+ virtual bool want_existing_descriptions() const
+ {
+ return CommandLine::get_instance()->install_args.want_existing_descriptions();
+ }
+
virtual std::string make_resume_command(const PackageIDSequence & s) const
{
std::string resume_command = environment()->paludis_command()
diff --git a/src/clients/reconcilio/install.cc b/src/clients/reconcilio/install.cc
index 3748697..b396606 100644
--- a/src/clients/reconcilio/install.cc
+++ b/src/clients/reconcilio/install.cc
@@ -82,6 +82,21 @@ namespace
return CommandLine::get_instance()->install_args.want_use_summary();
}
+ virtual bool want_compact() const
+ {
+ return CommandLine::get_instance()->install_args.want_compact();
+ }
+
+ virtual bool want_new_descriptions() const
+ {
+ return CommandLine::get_instance()->install_args.want_new_descriptions();
+ }
+
+ virtual bool want_existing_descriptions() const
+ {
+ return CommandLine::get_instance()->install_args.want_existing_descriptions();
+ }
+
virtual std::string make_resume_command(const PackageIDSequence & s) const
{
std::string resume_command = environment()->paludis_command() + " --install";
diff --git a/src/output/console_install_task.cc b/src/output/console_install_task.cc
index 36d2f5a..200d01e 100644
--- a/src/output/console_install_task.cc
+++ b/src/output/console_install_task.cc
@@ -360,7 +360,6 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_start(d, m);
display_merge_list_entry_package_name(d, m);
- display_merge_list_entry_version(d, m);
display_merge_list_entry_repository(d, m);
if (d.package_id->virtual_for_key())
@@ -369,8 +368,12 @@ ConsoleInstallTask::on_display_merge_list_entry(const DepListEntry & d)
display_merge_list_entry_slot(d, m);
display_merge_list_entry_status_and_update_counts(d, existing_repo, existing_slot_repo, m);
+ if (! want_compact())
+ display_merge_list_entry_tags(d, m);
+ display_merge_list_entry_description(d, existing_repo, existing_slot_repo, m);
display_merge_list_entry_use(d, existing_repo, existing_slot_repo, m);
- display_merge_list_entry_tags(d, m);
+ if (want_compact())
+ display_merge_list_entry_tags(d, m);
display_merge_list_entry_end(d, m);
if (d.kind == dlk_masked)
@@ -914,14 +917,6 @@ ConsoleInstallTask::display_merge_list_entry_for(const PackageID & d, const Disp
}
void
-ConsoleInstallTask::display_merge_list_entry_version(const DepListEntry & d, const DisplayMode)
-{
- if ((VersionSpec("0") != d.package_id->version()) ||
- CategoryNamePart("virtual") != d.package_id->name().category)
- output_no_endl("-" + stringify(d.package_id->version()));
-}
-
-void
ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d, const DisplayMode)
{
if (environment()->package_database()->favourite_repository() != d.package_id->repository()->name())
@@ -931,19 +926,22 @@ ConsoleInstallTask::display_merge_list_entry_repository(const DepListEntry & d,
void
ConsoleInstallTask::display_merge_list_entry_slot(const DepListEntry & d, const DisplayMode m)
{
+ if (d.package_id->slot() == SlotName("0"))
+ return;
+
switch (m)
{
case normal_entry:
case suggested_entry:
- output_no_endl(render_as_slot_name(" {:" + stringify(d.package_id->slot()) + "}"));
+ output_no_endl(render_as_slot_name(" :" + stringify(d.package_id->slot())));
break;
case unimportant_entry:
- output_no_endl(render_as_unimportant(" {:" + stringify(d.package_id->slot()) + "}"));
+ output_no_endl(render_as_unimportant(" :" + stringify(d.package_id->slot())));
break;
case error_entry:
- output_no_endl(render_as_slot_name(" {:" + stringify(d.package_id->slot()) + "}"));
+ output_no_endl(render_as_slot_name(" :" + stringify(d.package_id->slot())));
break;
}
}
@@ -954,18 +952,20 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
const DisplayMode m)
{
- bool need_comma(false);
switch (m)
{
case unimportant_entry:
if (d.kind == dlk_provided)
- output_no_endl(render_as_unimportant(" [provided]"));
+ output_no_endl(render_as_unimportant(" [provided " +
+ stringify(d.package_id->canonical_form(idcf_version)) + "]"));
else
- output_no_endl(render_as_unimportant(" [-]"));
+ output_no_endl(render_as_unimportant(" [- " +
+ stringify(d.package_id->canonical_form(idcf_version)) + "]"));
break;
case suggested_entry:
- output_no_endl(render_as_update_mode(" [suggestion]"));
+ output_no_endl(render_as_update_mode(" [suggestion " +
+ stringify(d.package_id->canonical_form(idcf_version)) + "]"));
set_count<suggested_count>(count<suggested_count>() + 1);
break;
@@ -973,9 +973,6 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
{
output_no_endl(render_as_update_mode(" ["));
- if (need_comma)
- output_no_endl(render_as_update_mode(", "));
-
std::string destination_str;
tr1::shared_ptr<const DestinationsSet> default_destinations(environment()->default_destinations());
if (default_destinations->end() == default_destinations->find(d.destination))
@@ -983,33 +980,36 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
if (existing_repo->empty())
{
- output_no_endl(render_as_update_mode("N" + destination_str));
+ output_no_endl(render_as_update_mode("N " + stringify(d.package_id->canonical_form(idcf_version) + destination_str)));
set_count<new_count>(count<new_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
else if (existing_slot_repo->empty())
{
- output_no_endl(render_as_update_mode("S" + destination_str));
+ output_no_endl(render_as_update_mode("S " + d.package_id->canonical_form(idcf_version) + destination_str));
set_count<new_slot_count>(count<new_slot_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
else if ((*existing_slot_repo->last())->version() < d.package_id->version())
{
output_no_endl(render_as_update_mode("U " +
- stringify((*existing_slot_repo->last())->canonical_form(idcf_version)) + destination_str));
+ stringify((*existing_slot_repo->last())->canonical_form(idcf_version)) + " -> " +
+ stringify(d.package_id->canonical_form(idcf_version))));
set_count<upgrade_count>(count<upgrade_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
else if ((*existing_slot_repo->last())->version() > d.package_id->version())
{
output_no_endl(render_as_update_mode("D " +
- stringify((*existing_slot_repo->last())->canonical_form(idcf_version)) + destination_str));
+ stringify((*existing_slot_repo->last())->canonical_form(idcf_version)) + " -> " +
+ stringify(d.package_id->canonical_form(idcf_version))));
set_count<downgrade_count>(count<downgrade_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
else
{
- output_no_endl(render_as_update_mode("R" + destination_str));
+ output_no_endl(render_as_update_mode("R " + stringify(d.package_id->canonical_form(idcf_version)) +
+ destination_str));
set_count<rebuild_count>(count<rebuild_count>() + 1);
set_count<max_count>(count<max_count>() + 1);
}
@@ -1049,6 +1049,45 @@ ConsoleInstallTask::display_merge_list_entry_status_and_update_counts(const DepL
}
void
+ConsoleInstallTask::display_merge_list_entry_description(const DepListEntry & d,
+ tr1::shared_ptr<const PackageIDSequence> existing_slot_repo,
+ tr1::shared_ptr<const PackageIDSequence>,
+ const DisplayMode m)
+{
+ if ((! d.package_id->short_description_key()) || d.package_id->short_description_key()->value().empty())
+ return;
+
+ if (existing_slot_repo->empty())
+ {
+ if (! want_new_descriptions())
+ return;
+ }
+ else
+ {
+ if (! want_existing_descriptions())
+ return;
+ }
+
+ switch (m)
+ {
+ case unimportant_entry:
+ case error_entry:
+ break;
+
+ case suggested_entry:
+ case normal_entry:
+ if (want_compact())
+ output_no_endl(" \"" + d.package_id->short_description_key()->value() + "\"");
+ else
+ {
+ output_endl();
+ output_no_endl(" \"" + d.package_id->short_description_key()->value() + "\"");
+ }
+ break;
+ }
+}
+
+void
ConsoleInstallTask::_add_descriptions(tr1::shared_ptr<const UseFlagNameSet> c,
const tr1::shared_ptr<const PackageID> & p, UseDescriptionState s)
{
@@ -1090,7 +1129,16 @@ ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
if (normal_entry != m && suggested_entry != m)
return;
- output_no_endl(" ");
+ if ((! d.package_id->iuse_key()) || d.package_id->iuse_key()->value()->empty())
+ return;
+
+ if (want_compact())
+ output_no_endl(" ");
+ else
+ {
+ output_endl();
+ output_no_endl(" ");
+ }
tr1::shared_ptr<const PackageID> old_id;
if (! existing_slot_repo->empty())
@@ -1099,17 +1147,10 @@ ConsoleInstallTask::display_merge_list_entry_use(const DepListEntry & d,
old_id = *existing_repo->last();
ColourFormatter formatter(old_id ? false : true);
- if (d.package_id->iuse_key())
- {
- if (old_id)
- {
- output_stream() << d.package_id->iuse_key()->pretty_print_flat_with_comparison(environment(), old_id, formatter);
- }
- else
- {
- output_stream() << d.package_id->iuse_key()->pretty_print_flat(formatter);
- }
- }
+ if (old_id)
+ output_stream() << d.package_id->iuse_key()->pretty_print_flat_with_comparison(environment(), old_id, formatter);
+ else
+ output_stream() << d.package_id->iuse_key()->pretty_print_flat(formatter);
_add_descriptions(formatter.seen_new_use_flag_names(), d.package_id, uds_new);
_add_descriptions(formatter.seen_changed_use_flag_names(), d.package_id, uds_changed);
@@ -1125,6 +1166,7 @@ ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d, const
return;
std::string tag_titles;
+ std::stringstream s;
for (Set<DepTagEntry>::ConstIterator
tag(d.tags->begin()),
@@ -1147,18 +1189,20 @@ ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d, const
tag_titles.erase(tag_titles.length() - 2);
if (! tag_titles.empty())
+ {
switch (m)
{
case normal_entry:
case suggested_entry:
case error_entry:
- output_no_endl(" " + render_as_tag("<" + tag_titles + ">"));
+ s << render_as_tag("<" + tag_titles + ">") << " ";
break;
case unimportant_entry:
- output_no_endl(" " + render_as_unimportant("<" + tag_titles + ">"));
+ s << render_as_unimportant("<" + tag_titles + ">") << " ";
break;
}
+ }
}
if (! want_install_reasons())
@@ -1214,18 +1258,38 @@ ConsoleInstallTask::display_merge_list_entry_tags(const DepListEntry & d, const
deps.erase(deps.length() - 2);
if (! deps.empty())
+ {
switch (m)
{
case normal_entry:
case suggested_entry:
case error_entry:
- output_no_endl(" " + render_as_tag("<" + deps + ">"));
+ s << render_as_tag("Reasons: " + deps) << " ";
break;
case unimportant_entry:
- output_no_endl(" " + render_as_unimportant("<" + deps + ">"));
+ s << render_as_unimportant("Reasons: " + deps) << " ";
break;
}
+ }
+ }
+
+ if (! s.str().empty())
+ {
+ std::string t(s.str());
+ t.erase(t.length() - 1);
+ if (want_compact())
+ output_no_endl(" " + t);
+ else
+ {
+ if (std::string::npos != t.find_first_of(" :"))
+ {
+ output_endl();
+ output_no_endl(" " + t);
+ }
+ else
+ output_no_endl(" " + t);
+ }
}
}
diff --git a/src/output/console_install_task.hh b/src/output/console_install_task.hh
index 16e20cc..33e2eeb 100644
--- a/src/output/console_install_task.hh
+++ b/src/output/console_install_task.hh
@@ -214,13 +214,15 @@ namespace paludis
virtual void display_merge_list_entry_start(const DepListEntry &, const DisplayMode);
virtual void display_merge_list_entry_package_name(const DepListEntry &, const DisplayMode);
- 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 PackageID &, const DisplayMode);
virtual void display_merge_list_entry_status_and_update_counts(const DepListEntry &,
tr1::shared_ptr<const PackageIDSequence>,
tr1::shared_ptr<const PackageIDSequence>, const DisplayMode);
+ virtual void display_merge_list_entry_description(const DepListEntry &,
+ tr1::shared_ptr<const PackageIDSequence>,
+ tr1::shared_ptr<const PackageIDSequence>, const DisplayMode);
virtual void display_merge_list_entry_use(const DepListEntry &,
tr1::shared_ptr<const PackageIDSequence>,
tr1::shared_ptr<const PackageIDSequence>, const DisplayMode);
@@ -290,6 +292,11 @@ namespace paludis
virtual bool want_changed_use_flags() const = 0;
virtual bool want_new_use_flags() const = 0;
+ virtual bool want_new_descriptions() const = 0;
+ virtual bool want_existing_descriptions() const = 0;
+
+ virtual bool want_compact() const = 0;
+
///\}
///\name Makers