aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-04 01:37:51 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-12-04 01:37:51 +0000
commit793595baa9eb4691be1e4a5ced0eb407f211a5da (patch)
tree5d6399b4c564a24a94da4724c6957cc2919ee8a2
parent395e0b8828389f8c2ba2338bc114441264d70493 (diff)
downloadpaludis-793595baa9eb4691be1e4a5ced0eb407f211a5da.tar.gz
paludis-793595baa9eb4691be1e4a5ced0eb407f211a5da.tar.xz
Add unused packages to reports
-rw-r--r--paludis/tasks/report_task.cc18
-rw-r--r--paludis/tasks/report_task.hh1
-rw-r--r--src/paludis/report.cc8
3 files changed, 26 insertions, 1 deletions
diff --git a/paludis/tasks/report_task.cc b/paludis/tasks/report_task.cc
index 6250c17..7e2cd8b 100644
--- a/paludis/tasks/report_task.cc
+++ b/paludis/tasks/report_task.cc
@@ -19,7 +19,9 @@
#include "report_task.hh"
#include <paludis/util/log.hh>
+#include <paludis/dep_list/uninstall_list.hh>
#include <paludis/environment.hh>
+#include <set>
using namespace paludis;
@@ -163,6 +165,14 @@ ReportTask::execute()
}
}
+ UninstallList unused_list(e, UninstallListOptions());
+ unused_list.add_unused();
+ std::set<PackageDatabaseEntry> unused;
+ for (UninstallList::Iterator i(unused_list.begin()), i_end(unused_list.end());
+ i != i_end ; ++i)
+ if (! i->skip_uninstall)
+ unused.insert(i->package);
+
for (PackageDatabase::RepositoryIterator r(e->package_database()->begin_repositories()),
r_end(e->package_database()->end_repositories()) ; r != r_end ; ++r)
{
@@ -188,6 +198,7 @@ ReportTask::execute()
bool is_masked(false);
bool is_vulnerable(false);
bool is_missing(false);
+ bool is_unused(false);
MaskReasons mr;
try
@@ -215,7 +226,10 @@ ReportTask::execute()
if (pi.first != pi.second)
is_vulnerable = true;
- if (is_masked || is_vulnerable || is_missing)
+ if (unused.end() != unused.find(pde))
+ is_unused = true;
+
+ if (is_masked || is_vulnerable || is_missing || is_unused)
{
on_report_package_failure_pre(pde);
if (is_masked)
@@ -229,6 +243,8 @@ ReportTask::execute()
}
if (is_missing)
on_report_package_is_missing(pde);
+ if (is_unused)
+ on_report_package_is_unused(pde);
on_report_package_failure_post(pde);
}
else
diff --git a/paludis/tasks/report_task.hh b/paludis/tasks/report_task.hh
index 16a701c..727abb1 100644
--- a/paludis/tasks/report_task.hh
+++ b/paludis/tasks/report_task.hh
@@ -67,6 +67,7 @@ namespace paludis
virtual void on_report_package_is_vulnerable(const PackageDatabaseEntry & pde, const std::string & tag) = 0;
virtual void on_report_package_is_vulnerable_post(const PackageDatabaseEntry & pde) = 0;
virtual void on_report_package_is_missing(const PackageDatabaseEntry & pde) = 0;
+ virtual void on_report_package_is_unused(const PackageDatabaseEntry & pde) = 0;
virtual void on_report_package_failure_post(const PackageDatabaseEntry & pde) = 0;
virtual void on_report_check_package_post(const QualifiedPackageName & p) = 0;
virtual void on_report_all_post() = 0;
diff --git a/src/paludis/report.cc b/src/paludis/report.cc
index 773be79..6b1a272 100644
--- a/src/paludis/report.cc
+++ b/src/paludis/report.cc
@@ -57,6 +57,7 @@ namespace
virtual void on_report_package_is_vulnerable(const PackageDatabaseEntry & pde, const std::string & tag);
virtual void on_report_package_is_vulnerable_post(const PackageDatabaseEntry & pde);
virtual void on_report_package_is_missing(const PackageDatabaseEntry & pde);
+ virtual void on_report_package_is_unused(const PackageDatabaseEntry & pde);
virtual void on_report_package_failure_post(const PackageDatabaseEntry & pde);
virtual void on_report_check_package_post(const QualifiedPackageName & p);
virtual void on_report_all_post();
@@ -132,6 +133,13 @@ namespace
}
void
+ OurReportTask::on_report_package_is_unused(const PackageDatabaseEntry &)
+ {
+ cout << endl << " Not used by any package in world";
+ ++_n_errors;
+ }
+
+ void
OurReportTask::on_report_package_failure_post(const PackageDatabaseEntry &)
{
cout << endl << endl;