aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-13 12:32:57 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-13 12:32:57 +0100
commit87505ec0f78b835b42724d0c585f979834efe6d2 (patch)
tree6dbd3a50c998b5f34fc955f1153bd29870f683de
parent78d256c6387a93aca51e3c9a4e56d0834f1408e7 (diff)
downloadpaludis-87505ec0f78b835b42724d0c585f979834efe6d2.tar.gz
paludis-87505ec0f78b835b42724d0c585f979834efe6d2.tar.xz
uninstall removes from world only once everything's gone
Fixes: ticket:913
-rw-r--r--src/clients/cave/cmd_uninstall.cc21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/clients/cave/cmd_uninstall.cc b/src/clients/cave/cmd_uninstall.cc
index fac1603..6e86f17 100644
--- a/src/clients/cave/cmd_uninstall.cc
+++ b/src/clients/cave/cmd_uninstall.cc
@@ -24,6 +24,7 @@
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/stringify.hh>
+#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/user_dep_spec.hh>
#include <paludis/selection.hh>
#include <paludis/generator.hh>
@@ -134,7 +135,25 @@ UninstallCommand::run(
targets->push_back(std::make_pair(target, ""));
}
- targets_cleaned_up->push_back("!" + stringify((*ids->begin())->name()));
+ bool removing_all_slots(true);
+ const std::tr1::shared_ptr<const PackageIDSequence> all_uninstallable((*env)[selection::AllVersionsSorted(
+ generator::Package(*spec.package_ptr()) | filter::SupportsAction<UninstallAction>())]);
+ for (PackageIDSequence::ConstIterator i(all_uninstallable->begin()), i_end(all_uninstallable->end()) ;
+ i != i_end ; ++i)
+ if (indirect_iterator(ids->end()) == std::find(indirect_iterator(ids->begin()), indirect_iterator(ids->end()), **i))
+ {
+ removing_all_slots = false;
+ break;
+ }
+
+ if (removing_all_slots)
+ targets_cleaned_up->push_back("!" + stringify((*ids->begin())->name()));
+ else
+ {
+ for (Sequence<std::pair<std::string, std::string> >::ConstIterator t(targets->begin()), t_end(targets->end()) ;
+ t != t_end ; ++t)
+ targets_cleaned_up->push_back(t->first);
+ }
}
}