aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-03 23:12:53 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-01-03 23:12:53 +0000
commit0b5899b2e076bbfa0cbf7103dafd2501ed97c012 (patch)
tree3a67f3ead24944589b8e6d9fd8c6cc48e2f179d2
parent0e3157ee52fed344589f8f28a84e5fbaf31e26f0 (diff)
downloadpaludis-0b5899b2e076bbfa0cbf7103dafd2501ed97c012.tar.gz
paludis-0b5899b2e076bbfa0cbf7103dafd2501ed97c012.tar.xz
Allow --uninstall --all-versions
-rw-r--r--NEWS3
-rw-r--r--paludis/tasks/uninstall_task.cc25
-rw-r--r--paludis/tasks/uninstall_task.hh1
-rw-r--r--src/clients/paludis/command_line.cc9
-rw-r--r--src/clients/paludis/command_line.hh12
-rw-r--r--src/clients/paludis/uninstall.cc1
6 files changed, 47 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 0dff5ef..2354b0b 100644
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,9 @@ of every change, see the ChangeLog.
via --dl-new-slots as-needed. This must be used in conjunction with the
existing --dl-upgrade.
+ * Paludis can now uninstall all versions of a package by --uninstall
+ --all-versions.
+
0.14.0:
* The merge and unmerge utilities are now called with an explicit path.
diff --git a/paludis/tasks/uninstall_task.cc b/paludis/tasks/uninstall_task.cc
index 92378c8..ca834cd 100644
--- a/paludis/tasks/uninstall_task.cc
+++ b/paludis/tasks/uninstall_task.cc
@@ -39,6 +39,7 @@ namespace paludis
bool pretend;
bool preserve_world;
+ bool all_versions;
bool with_unused_dependencies;
bool with_dependencies;
bool unused;
@@ -48,6 +49,7 @@ namespace paludis
install_options(false, false, ido_none),
pretend(false),
preserve_world(false),
+ all_versions(false),
with_unused_dependencies(false),
with_dependencies(false),
unused(false)
@@ -156,7 +158,22 @@ UninstallTask::execute()
if (r->empty())
throw NoSuchPackageError(stringify(**t));
else if (next(r->begin()) != r->end())
- throw AmbiguousUnmergeTargetError(stringify(**t), r);
+ {
+ if (_imp->all_versions)
+ {
+ /* all_versions, not all_packages. */
+ for (PackageDatabaseEntryCollection::Iterator i_start(r->begin()), i(r->begin()),
+ i_end(r->end()) ; i != i_end ; ++i)
+ if (i->name != i_start->name)
+ throw AmbiguousUnmergeTargetError(stringify(**t), r);
+
+ for (PackageDatabaseEntryCollection::Iterator i(r->begin()), i_end(r->end()) ;
+ i != i_end ; ++i)
+ list.add(*i);
+ }
+ else
+ throw AmbiguousUnmergeTargetError(stringify(**t), r);
+ }
else
list.add(*r->begin());
}
@@ -253,3 +270,9 @@ UninstallTask::set_with_dependencies(const bool value)
_imp->with_dependencies = value;
}
+void
+UninstallTask::set_all_versions(const bool value)
+{
+ _imp->all_versions = value;
+}
+
diff --git a/paludis/tasks/uninstall_task.hh b/paludis/tasks/uninstall_task.hh
index 385374d..02e0d7d 100644
--- a/paludis/tasks/uninstall_task.hh
+++ b/paludis/tasks/uninstall_task.hh
@@ -116,6 +116,7 @@ namespace paludis
void set_no_config_protect(const bool value);
void set_pretend(const bool value);
void set_preserve_world(const bool value);
+ void set_all_versions(const bool value);
void set_with_unused_dependencies(const bool value);
void set_with_dependencies(const bool value);
diff --git a/src/clients/paludis/command_line.cc b/src/clients/paludis/command_line.cc
index 5dd28c2..98dcf6d 100644
--- a/src/clients/paludis/command_line.cc
+++ b/src/clients/paludis/command_line.cc
@@ -96,10 +96,15 @@ CommandLine::CommandLine() :
("changed", "Show for new and changed flags")
("all", "Show for all flags"),
"none"),
- a_with_unused_dependencies(&install_args, "with-unused-dependencies", '\0',
+
+ uninstall_args(this, "Uninstall options",
+ "Options which are relevant for --uninstall."),
+ a_with_unused_dependencies(&uninstall_args, "with-unused-dependencies", '\0',
"Also uninstall any dependencies of the target that are no longer used"),
- a_with_dependencies(&install_args, "with-dependencies", '\0',
+ a_with_dependencies(&uninstall_args, "with-dependencies", '\0',
"Also uninstall packages that depend upon the target"),
+ a_all_versions(&uninstall_args, "all-versions", '\0',
+ "Uninstall all versions of a package"),
dl_args(this, "DepList behaviour",
"Modify dependency list generation behaviour. Use with caution."),
diff --git a/src/clients/paludis/command_line.hh b/src/clients/paludis/command_line.hh
index 1ea703b..d70437b 100644
--- a/src/clients/paludis/command_line.hh
+++ b/src/clients/paludis/command_line.hh
@@ -209,13 +209,23 @@ class CommandLine :
/// --show-use-descriptions
paludis::args::EnumArg a_show_use_descriptions;
+ /// }
+
+ /// \name Uninstall arguments
+ ///\{
+
+ paludis::args::ArgsGroup uninstall_args;
+
/// --with-unused-dependencies
paludis::args::SwitchArg a_with_unused_dependencies;
/// --with-dependencies
paludis::args::SwitchArg a_with_dependencies;
- /// }
+ /// --all-versions
+ paludis::args::SwitchArg a_all_versions;
+
+ ///\}
/// \name DepList behaviour arguments
/// {
diff --git a/src/clients/paludis/uninstall.cc b/src/clients/paludis/uninstall.cc
index b1253e4..186d710 100644
--- a/src/clients/paludis/uninstall.cc
+++ b/src/clients/paludis/uninstall.cc
@@ -184,6 +184,7 @@ namespace
task.set_preserve_world(CommandLine::get_instance()->a_preserve_world.specified());
task.set_with_unused_dependencies(CommandLine::get_instance()->a_with_unused_dependencies.specified());
task.set_with_dependencies(CommandLine::get_instance()->a_with_dependencies.specified());
+ task.set_all_versions(CommandLine::get_instance()->a_all_versions.specified());
try
{