aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Mike Kelly <pioto@pioto.org> 2009-02-19 22:20:03 -0500
committerAvatar Mike Kelly <pioto@pioto.org> 2009-02-19 22:21:54 -0500
commit343f010ee63de15d0e81bb0bedd07f0e0038d3e0 (patch)
treec14c78221eb666491241b82347b5c91b39ebba65
parentb23598ff09e9f2eb4f36f1ca4cdc4cef04edf5dd (diff)
downloadpaludis-343f010ee63de15d0e81bb0bedd07f0e0038d3e0.tar.gz
paludis-343f010ee63de15d0e81bb0bedd07f0e0038d3e0.tar.xz
Only uninstallable things are unused.
This will fix the issue where paludis --report / paludis --uninstall-unused were listing ::installed-accounts PackageIDs as unused, since there's nothing that can actually be done about that right now.
-rw-r--r--paludis/uninstall_list.cc3
-rw-r--r--paludis/uninstall_list_TEST.cc40
2 files changed, 43 insertions, 0 deletions
diff --git a/paludis/uninstall_list.cc b/paludis/uninstall_list.cc
index 6fb74af..27ae0fb 100644
--- a/paludis/uninstall_list.cc
+++ b/paludis/uninstall_list.cc
@@ -35,6 +35,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/indirect_iterator-impl.hh>
#include <paludis/util/accept_visitor.hh>
+#include <paludis/action.hh>
#include <paludis/match_package.hh>
#include <paludis/package_database.hh>
#include <paludis/package_id.hh>
@@ -233,6 +234,8 @@ UninstallList::collect_all_installed() const
{
if (! (*i)->installed_root_key())
continue;
+ if (! (*i)->some_ids_might_support_action(SupportsActionTest<UninstallAction>()))
+ continue;
std::tr1::shared_ptr<const CategoryNamePartSet> cats((*i)->category_names());
for (CategoryNamePartSet::ConstIterator c(cats->begin()), c_end(cats->end()) ;
diff --git a/paludis/uninstall_list_TEST.cc b/paludis/uninstall_list_TEST.cc
index 4db6b58..31b4fb9 100644
--- a/paludis/uninstall_list_TEST.cc
+++ b/paludis/uninstall_list_TEST.cc
@@ -499,5 +499,45 @@ namespace test_cases
);
}
} uninstall_list_slots_test;
+
+ struct UninstallListNotUninstallableTest :
+ UninstallListTestCaseBase
+ {
+ std::tr1::shared_ptr<FakeInstalledRepository> installed_not_uninstallable_repo;
+
+ UninstallListNotUninstallableTest() :
+ UninstallListTestCaseBase("not uninstallable"),
+ installed_not_uninstallable_repo(new FakeInstalledRepository(&env, RepositoryName("installed_not_uninstallable"), false))
+ {
+ env.package_database()->add_repository(2, installed_not_uninstallable_repo);
+ std::tr1::shared_ptr<SetSpecTree> world(new SetSpecTree(make_shared_ptr(new AllDepSpec)));
+ installed_repo->add_package_set(SetName("world"), world);
+ }
+
+ void populate_targets()
+ {
+ add_unused_target();
+ }
+
+ void populate_repo()
+ {
+ installed_repo->add_version("cat", "needs-grp", "1")->run_dependencies_key()->set_from_string("group/grp");
+ installed_not_uninstallable_repo->add_version("group", "grp", "0");
+ }
+
+ void populate_expected()
+ {
+ expected.push_back("cat/needs-grp-1:0::installed");
+ }
+
+ UninstallListOptions options()
+ {
+ return make_named_values<UninstallListOptions>(
+ value_for<n::with_dependencies_as_errors>(false),
+ value_for<n::with_dependencies_included>(false),
+ value_for<n::with_unused_dependencies>(false)
+ );
+ }
+ } uninstall_list_not_uninstallable;
}