aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-09-18 14:40:55 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-09-18 14:40:55 +0000
commit318ea9e78ab6af81d38f4b864b35ffb1f24b4f5b (patch)
treee44c9cd848f2047bf5f8a4b28fd7ed6a38240ddc
parent3c78f63f74004d0338e4ab09f13045ee706670c8 (diff)
downloadpaludis-318ea9e78ab6af81d38f4b864b35ffb1f24b4f5b.tar.gz
paludis-318ea9e78ab6af81d38f4b864b35ffb1f24b4f5b.tar.xz
Fix masked and missing checks in report.
-rw-r--r--paludis/tasks/report_task.cc38
-rw-r--r--paludis/tasks/report_task.hh3
-rw-r--r--src/clients/paludis/report.cc13
3 files changed, 44 insertions, 10 deletions
diff --git a/paludis/tasks/report_task.cc b/paludis/tasks/report_task.cc
index 3d0e877..f7bb13a 100644
--- a/paludis/tasks/report_task.cc
+++ b/paludis/tasks/report_task.cc
@@ -178,7 +178,37 @@ ReportTask::execute()
for (PackageIDSequence::Iterator v(ids->begin()), v_end(ids->end()) ;
v != v_end ; ++v)
{
- bool is_masked((*v)->masked());
+ bool is_missing(false);
+ tr1::shared_ptr<const PackageID> origin;
+ tr1::shared_ptr<RepositoryName> repo_name;
+
+ if ((*v)->source_origin_key())
+ {
+ tr1::shared_ptr<QualifiedPackageName> pkg_name(new QualifiedPackageName((*v)->name()));
+ tr1::shared_ptr<VersionRequirements> ver_reqs(make_equal_to_version_requirements((*v)->version()));
+ repo_name.reset(new RepositoryName((*v)->source_origin_key()->value()));
+
+ tr1::shared_ptr<const PackageIDSequence> installable(
+ e->package_database()->query(
+ query::Matches(
+ PackageDepSpec(
+ pkg_name,
+ tr1::shared_ptr<CategoryNamePart>(),
+ tr1::shared_ptr<PackageNamePart>(),
+ ver_reqs,
+ vr_and,
+ tr1::shared_ptr<SlotName>(),
+ repo_name)) &
+ query::SupportsAction<InstallAction>(),
+ qo_best_version_only));
+
+ if (installable->empty())
+ is_missing = true;
+ else
+ origin = *installable->last();
+ }
+
+ bool is_masked(origin && origin->masked());
bool is_vulnerable(false);
bool is_unused(false);
@@ -189,11 +219,11 @@ ReportTask::execute()
if (unused.end() != unused.find(*v))
is_unused = true;
- if (is_masked || is_vulnerable || is_unused)
+ if (is_masked || is_vulnerable || is_missing || is_unused)
{
on_report_package_failure_pre(**v);
if (is_masked)
- on_report_package_is_masked(**v);
+ on_report_package_is_masked(**v, *origin);
if (is_vulnerable)
{
on_report_package_is_vulnerable_pre(**v);
@@ -201,6 +231,8 @@ ReportTask::execute()
on_report_package_is_vulnerable(**v, itag->second->short_text());
on_report_package_is_vulnerable_post(**v);
}
+ if (is_missing)
+ on_report_package_is_missing(**v, *repo_name);
if (is_unused)
on_report_package_is_unused(**v);
on_report_package_failure_post(**v);
diff --git a/paludis/tasks/report_task.hh b/paludis/tasks/report_task.hh
index 5d7efdb..5be4cec 100644
--- a/paludis/tasks/report_task.hh
+++ b/paludis/tasks/report_task.hh
@@ -61,10 +61,11 @@ namespace paludis
virtual void on_report_check_package_pre(const QualifiedPackageName & p) = 0;
virtual void on_report_package_success(const PackageID & id) = 0;
virtual void on_report_package_failure_pre(const PackageID & id) = 0;
- virtual void on_report_package_is_masked(const PackageID & id) = 0;
+ virtual void on_report_package_is_masked(const PackageID & installed, const PackageID & origin) = 0;
virtual void on_report_package_is_vulnerable_pre(const PackageID & id) = 0;
virtual void on_report_package_is_vulnerable(const PackageID & id, const std::string & tag) = 0;
virtual void on_report_package_is_vulnerable_post(const PackageID & id) = 0;
+ virtual void on_report_package_is_missing(const PackageID & id, const RepositoryName & repo_name) = 0;
virtual void on_report_package_is_unused(const PackageID & id) = 0;
virtual void on_report_package_failure_post(const PackageID & id) = 0;
virtual void on_report_check_package_post(const QualifiedPackageName & p) = 0;
diff --git a/src/clients/paludis/report.cc b/src/clients/paludis/report.cc
index 8c97efc..61b4800 100644
--- a/src/clients/paludis/report.cc
+++ b/src/clients/paludis/report.cc
@@ -53,11 +53,11 @@ namespace
virtual void on_report_check_package_pre(const QualifiedPackageName & p);
virtual void on_report_package_success(const PackageID & id);
virtual void on_report_package_failure_pre(const PackageID & id);
- virtual void on_report_package_is_masked(const PackageID & id);
+ virtual void on_report_package_is_masked(const PackageID & installed, const PackageID & origin);
virtual void on_report_package_is_vulnerable_pre(const PackageID & id);
virtual void on_report_package_is_vulnerable(const PackageID & id, const std::string & tag);
virtual void on_report_package_is_vulnerable_post(const PackageID & id);
- virtual void on_report_package_is_missing(const PackageID & id);
+ virtual void on_report_package_is_missing(const PackageID & id, const RepositoryName & repo_name);
virtual void on_report_package_is_unused(const PackageID & id);
virtual void on_report_package_failure_post(const PackageID & id);
virtual void on_report_check_package_post(const QualifiedPackageName & p);
@@ -92,12 +92,12 @@ namespace
}
void
- OurReportTask::on_report_package_is_masked(const PackageID & id)
+ OurReportTask::on_report_package_is_masked(const PackageID &, const PackageID & origin)
{
cout << endl << " Masked by: ";
bool comma(false);
- for (PackageID::MasksIterator m(id.begin_masks()), m_end(id.end_masks()) ;
+ for (PackageID::MasksIterator m(origin.begin_masks()), m_end(origin.end_masks()) ;
m != m_end ; ++m)
{
if (comma)
@@ -105,6 +105,7 @@ namespace
cout << colour(cl_masked, (*m)->description());
comma = true;
}
+ cout << " in its original repository '" << origin.repository()->name() << "'";
++_n_errors;
}
@@ -127,9 +128,9 @@ namespace
}
void
- OurReportTask::on_report_package_is_missing(const PackageID &)
+ OurReportTask::on_report_package_is_missing(const PackageID &, const RepositoryName & repo_name)
{
- cout << endl << " No longer exists in its original repository";
+ cout << endl << " No longer exists in its original repository '" << repo_name << "'";
++_n_errors;
}