aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 20:45:44 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 20:45:44 +0000
commitf105eb7e60880f2d7e5530f37eb984a8a728aa25 (patch)
tree8836f6a3fdd5ae3b433015de885114f8215fe6d4
parent9013518c2e8c391f625dadb6d6852837b7dd8214 (diff)
downloadpaludis-f105eb7e60880f2d7e5530f37eb984a8a728aa25.tar.gz
paludis-f105eb7e60880f2d7e5530f37eb984a8a728aa25.tar.xz
Include FSEntry for QA messages. Improve qualudis output.
-rw-r--r--paludis/qa.hh7
-rw-r--r--paludis/repositories/e/qa/dependency_keys.cc31
-rw-r--r--paludis/repositories/e/qa/dependency_keys.hh2
-rw-r--r--paludis/repositories/e/qa/dependency_keys_TEST.cc18
-rw-r--r--paludis/repositories/e/qa/eapi_supported.cc3
-rw-r--r--paludis/repositories/e/qa/eapi_supported.hh2
-rw-r--r--paludis/repositories/e/qa/homepage_key.cc18
-rw-r--r--paludis/repositories/e/qa/homepage_key.hh2
-rw-r--r--paludis/repositories/e/qa/qa_checks.cc12
-rw-r--r--paludis/repositories/e/qa/qa_checks.hh3
-rw-r--r--paludis/repositories/e/qa/qa_controller.cc29
-rw-r--r--paludis/repositories/e/qa/short_description_key.cc13
-rw-r--r--paludis/repositories/e/qa/short_description_key.hh2
-rw-r--r--paludis/repositories/e/qa/stray_files.cc2
-rw-r--r--python/qa.cc5
-rwxr-xr-xpython/repository_TEST.py2
-rw-r--r--ruby/paludis_ruby.cc5
-rw-r--r--ruby/paludis_ruby.hh2
-rw-r--r--ruby/qa.cc4
-rw-r--r--ruby/repository_TEST.rb2
-rw-r--r--src/clients/qualudis/qualudis.cc6
21 files changed, 106 insertions, 64 deletions
diff --git a/paludis/qa.hh b/paludis/qa.hh
index b5b3460..a1dbeb8 100644
--- a/paludis/qa.hh
+++ b/paludis/qa.hh
@@ -21,6 +21,7 @@
#define PALUDIS_GUARD_PALUDIS_QA_HH 1
#include <paludis/qa-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace paludis
{
@@ -29,7 +30,11 @@ namespace paludis
public:
virtual ~QAReporter() = 0;
- virtual void message(const QAMessageLevel, const std::string &, const std::string &) = 0;
+ virtual void message(
+ const FSEntry & what,
+ const QAMessageLevel,
+ const std::string & name,
+ const std::string & message) = 0;
};
}
diff --git a/paludis/repositories/e/qa/dependency_keys.cc b/paludis/repositories/e/qa/dependency_keys.cc
index fec7ea4..de8e43b 100644
--- a/paludis/repositories/e/qa/dependency_keys.cc
+++ b/paludis/repositories/e/qa/dependency_keys.cc
@@ -27,6 +27,7 @@
#include <paludis/util/stringify.hh>
#include <paludis/util/save.hh>
#include <paludis/util/visitor-impl.hh>
+#include <paludis/util/fs_entry.hh>
using namespace paludis;
using namespace paludis::erepository;
@@ -36,6 +37,7 @@ namespace
struct Checker :
ConstVisitor<DependencySpecTree>
{
+ const FSEntry entry;
QAReporter & reporter;
const tr1::shared_ptr<const PackageID> & id;
const MetadataSpecTreeKey<DependencySpecTree> & key;
@@ -43,10 +45,13 @@ namespace
unsigned level;
bool child_of_any;
- Checker(QAReporter & r,
+ Checker(
+ const FSEntry & f,
+ QAReporter & r,
const tr1::shared_ptr<const PackageID> & i,
const MetadataSpecTreeKey<DependencySpecTree> & k,
const std::string & n) :
+ entry(f),
reporter(r),
id(i),
key(k),
@@ -63,7 +68,7 @@ namespace
void visit_leaf(const BlockDepSpec & b)
{
if (child_of_any)
- reporter.message(qaml_normal, name, "'|| ( )' block with block child '!"
+ reporter.message(entry, qaml_normal, name, "'|| ( )' block with block child '!"
+ stringify(*b.blocked_spec()) + "' in dependency key '" + stringify(key.raw_name())
+ "' for ID '" + stringify(*id) + "'");
}
@@ -73,13 +78,13 @@ namespace
DependencySpecTree::ConstSequenceIterator end)
{
if (child_of_any)
- reporter.message(qaml_normal, name, "'|| ( )' block with use? ( ) child in dependency key '" + stringify(key.raw_name())
+ reporter.message(entry, qaml_normal, name, "'|| ( )' block with use? ( ) child in dependency key '" + stringify(key.raw_name())
+ "' for ID '" + stringify(*id) + "'");
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, false);
if (cur == end)
- reporter.message(qaml_normal, name, "Empty 'use? ( )' block in dependency key '" + stringify(key.raw_name())
+ reporter.message(entry, qaml_normal, name, "Empty 'use? ( )' block in dependency key '" + stringify(key.raw_name())
+ "' for ID '" + stringify(*id) + "'");
else
std::for_each(cur, end, accept_visitor(*this));
@@ -94,7 +99,7 @@ namespace
if (cur == end)
{
if (level > 1)
- reporter.message(qaml_normal, name, "Empty '( )' block in dependency key '" + stringify(key.raw_name())
+ reporter.message(entry, qaml_normal, name, "Empty '( )' block in dependency key '" + stringify(key.raw_name())
+ "' for ID '" + stringify(*id) + "'");
}
else
@@ -108,12 +113,12 @@ namespace
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, true);
if (cur == end)
- reporter.message(qaml_normal, name, "Empty '|| ( )' block in dependency key '" + stringify(key.raw_name())
+ reporter.message(entry, qaml_normal, name, "Empty '|| ( )' block in dependency key '" + stringify(key.raw_name())
+ "' for ID '" + stringify(*id) + "'");
else if (next(cur) == end)
{
cur->accept(*this);
- reporter.message(qaml_normal, name, "'|| ( )' block with only one child in dependency key '" + stringify(key.raw_name())
+ reporter.message(entry, qaml_normal, name, "'|| ( )' block with only one child in dependency key '" + stringify(key.raw_name())
+ "' for ID '" + stringify(*id) + "'");
}
else
@@ -122,6 +127,7 @@ namespace
};
bool dependency_key_check(
+ const FSEntry & entry,
QAReporter & reporter,
const tr1::shared_ptr<const PackageID> & id,
const std::string & name,
@@ -130,7 +136,7 @@ namespace
Context context("When checking dependency key '" + key.raw_name() + "' for check '" + name +
"' using dependency_keys_check on ID '" + stringify(*id) + "':");
- Checker c(reporter, id, key, name);
+ Checker c(entry, reporter, id, key, name);
key.value()->accept(c);
return true;
@@ -139,6 +145,7 @@ namespace
bool
paludis::erepository::dependency_keys_check(
+ const FSEntry & entry,
QAReporter & reporter,
const tr1::shared_ptr<const PackageID> & id,
const std::string & name)
@@ -148,16 +155,16 @@ paludis::erepository::dependency_keys_check(
bool result(true);
if (id->build_dependencies_key())
- result &= dependency_key_check(reporter, id, name, *id->build_dependencies_key());
+ result &= dependency_key_check(entry, reporter, id, name, *id->build_dependencies_key());
if (id->run_dependencies_key())
- result &= dependency_key_check(reporter, id, name, *id->run_dependencies_key());
+ result &= dependency_key_check(entry, reporter, id, name, *id->run_dependencies_key());
if (id->post_dependencies_key())
- result &= dependency_key_check(reporter, id, name, *id->post_dependencies_key());
+ result &= dependency_key_check(entry, reporter, id, name, *id->post_dependencies_key());
if (id->suggested_dependencies_key())
- result &= dependency_key_check(reporter, id, name, *id->suggested_dependencies_key());
+ result &= dependency_key_check(entry, reporter, id, name, *id->suggested_dependencies_key());
return result;
}
diff --git a/paludis/repositories/e/qa/dependency_keys.hh b/paludis/repositories/e/qa/dependency_keys.hh
index c156999..03734b1 100644
--- a/paludis/repositories/e/qa/dependency_keys.hh
+++ b/paludis/repositories/e/qa/dependency_keys.hh
@@ -23,12 +23,14 @@
#include <paludis/qa-fwd.hh>
#include <paludis/package_id-fwd.hh>
#include <paludis/util/attributes.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace paludis
{
namespace erepository
{
bool dependency_keys_check(
+ const FSEntry &,
QAReporter &,
const tr1::shared_ptr<const PackageID> &,
const std::string &) PALUDIS_VISIBLE;
diff --git a/paludis/repositories/e/qa/dependency_keys_TEST.cc b/paludis/repositories/e/qa/dependency_keys_TEST.cc
index e795329..f35bf45 100644
--- a/paludis/repositories/e/qa/dependency_keys_TEST.cc
+++ b/paludis/repositories/e/qa/dependency_keys_TEST.cc
@@ -42,7 +42,7 @@ namespace
{
}
- void message(QAMessageLevel, const std::string &, const std::string &)
+ void message(const FSEntry &, QAMessageLevel, const std::string &, const std::string &)
{
++count;
}
@@ -64,7 +64,7 @@ namespace test_cases
id->build_dependencies_key()->set_from_string("cat/other");
TestReporter r;
- TEST_CHECK(dependency_keys_check(r, id, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r, id, "dependency keys"));
TEST_CHECK_EQUAL(r.count, 0u);
}
} test_good;
@@ -82,25 +82,25 @@ namespace test_cases
tr1::shared_ptr<FakePackageID> id1(repo->add_version("cat", "pkg", "1"));
id1->build_dependencies_key()->set_from_string("( ( ) )");
TestReporter r1;
- TEST_CHECK(dependency_keys_check(r1, id1, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r1, id1, "dependency keys"));
TEST_CHECK_EQUAL(r1.count, 1u);
tr1::shared_ptr<FakePackageID> id2(repo->add_version("cat", "pkg", "2"));
id2->build_dependencies_key()->set_from_string("|| ( )");
TestReporter r2;
- TEST_CHECK(dependency_keys_check(r2, id2, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r2, id2, "dependency keys"));
TEST_CHECK_EQUAL(r2.count, 1u);
tr1::shared_ptr<FakePackageID> id3(repo->add_version("cat", "pkg", "3"));
id3->build_dependencies_key()->set_from_string("x? ( )");
TestReporter r3;
- TEST_CHECK(dependency_keys_check(r3, id3, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r3, id3, "dependency keys"));
TEST_CHECK_EQUAL(r3.count, 1u);
tr1::shared_ptr<FakePackageID> id4(repo->add_version("cat", "pkg", "4"));
id4->build_dependencies_key()->set_from_string("x? ( ) ( y? ( || ( ) ) )");
TestReporter r4;
- TEST_CHECK(dependency_keys_check(r4, id4, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r4, id4, "dependency keys"));
TEST_CHECK_EQUAL(r4.count, 2u);
}
} test_empty_block;
@@ -118,7 +118,7 @@ namespace test_cases
id->build_dependencies_key()->set_from_string("|| ( v/w x? ( x/y ) )");
TestReporter r;
- TEST_CHECK(dependency_keys_check(r, id, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r, id, "dependency keys"));
TEST_CHECK_EQUAL(r.count, 1u);
}
} test_any_use;
@@ -136,7 +136,7 @@ namespace test_cases
id->build_dependencies_key()->set_from_string("|| ( x/x )");
TestReporter r;
- TEST_CHECK(dependency_keys_check(r, id, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r, id, "dependency keys"));
TEST_CHECK_EQUAL(r.count, 1u);
}
} test_any_one;
@@ -154,7 +154,7 @@ namespace test_cases
id->build_dependencies_key()->set_from_string("|| ( x/x !y/y z/z )");
TestReporter r;
- TEST_CHECK(dependency_keys_check(r, id, "dependency keys"));
+ TEST_CHECK(dependency_keys_check(FSEntry("/var/empty"), r, id, "dependency keys"));
TEST_CHECK_EQUAL(r.count, 1u);
}
} test_any_block;
diff --git a/paludis/repositories/e/qa/eapi_supported.cc b/paludis/repositories/e/qa/eapi_supported.cc
index 2e3b236..902b9d2 100644
--- a/paludis/repositories/e/qa/eapi_supported.cc
+++ b/paludis/repositories/e/qa/eapi_supported.cc
@@ -26,6 +26,7 @@
bool
paludis::erepository::eapi_supported_check(
+ const FSEntry & entry,
QAReporter & reporter,
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
@@ -34,7 +35,7 @@ paludis::erepository::eapi_supported_check(
if (! id->eapi()->supported)
{
- reporter.message(qaml_severe, name, "EAPI '" + stringify(id->eapi()->name) + "' not supported");
+ reporter.message(entry, qaml_severe, name, "EAPI '" + stringify(id->eapi()->name) + "' not supported");
return false;
}
diff --git a/paludis/repositories/e/qa/eapi_supported.hh b/paludis/repositories/e/qa/eapi_supported.hh
index 3fc5d7a..865858e 100644
--- a/paludis/repositories/e/qa/eapi_supported.hh
+++ b/paludis/repositories/e/qa/eapi_supported.hh
@@ -22,12 +22,14 @@
#include <paludis/qa-fwd.hh>
#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace paludis
{
namespace erepository
{
bool eapi_supported_check(
+ const FSEntry &,
QAReporter &,
const tr1::shared_ptr<const ERepositoryID> &,
const std::string &);
diff --git a/paludis/repositories/e/qa/homepage_key.cc b/paludis/repositories/e/qa/homepage_key.cc
index c1404f2..52da75f 100644
--- a/paludis/repositories/e/qa/homepage_key.cc
+++ b/paludis/repositories/e/qa/homepage_key.cc
@@ -25,6 +25,7 @@
#include <paludis/name.hh>
#include <paludis/dep_spec.hh>
#include <paludis/package_id.hh>
+#include <paludis/util/fs_entry.hh>
using namespace paludis;
using namespace paludis::erepository;
@@ -39,15 +40,18 @@ namespace
using ConstVisitor<URISpecTree>::VisitConstSequence<HomepageChecker, UseDepSpec>::visit_sequence;
using ConstVisitor<URISpecTree>::VisitConstSequence<HomepageChecker, AllDepSpec>::visit_sequence;
+ const FSEntry entry;
QAReporter & reporter;
const tr1::shared_ptr<const ERepositoryID> id;
const std::string name;
bool found_one;
HomepageChecker(
+ const FSEntry & f,
QAReporter & r,
const tr1::shared_ptr<const ERepositoryID> & i,
const std::string & n) :
+ entry(f),
reporter(r),
id(i),
name(n),
@@ -58,7 +62,7 @@ namespace
~HomepageChecker()
{
if (! found_one)
- reporter.message(qaml_normal, name, "Homepage '" + stringify(*id) + "' specifies no URIs");
+ reporter.message(entry, qaml_normal, name, "Homepage '" + stringify(*id) + "' specifies no URIs");
}
void visit_leaf(const URIDepSpec & u)
@@ -66,23 +70,25 @@ namespace
found_one = true;
if (! u.renamed_url_suffix().empty())
- reporter.message(qaml_normal, name, "Homepage for '" + stringify(*id) + "' uses -> in part '" + u.text() + "'");
+ reporter.message(entry, qaml_normal, name, "Homepage for '" + stringify(*id) + "' uses -> in part '" + u.text() + "'");
if (0 == u.original_url().compare(0, 7, "http://") &&
0 == u.original_url().compare(0, 8, "https://") &&
0 == u.original_url().compare(0, 6, "ftp://"))
- reporter.message(qaml_normal, name, "Homepage for '" + stringify(*id) + "' uses no or unknown protocol in part '" + u.text() + "'");
+ reporter.message(entry, qaml_normal, name, "Homepage for '" + stringify(*id) +
+ "' uses no or unknown protocol in part '" + u.text() + "'");
}
void visit_leaf(const LabelsDepSpec<URILabelVisitorTypes> &)
{
- reporter.message(qaml_normal, name, "Homepage '" + stringify(*id) + "' uses labels");
+ reporter.message(entry, qaml_normal, name, "Homepage '" + stringify(*id) + "' uses labels");
}
};
}
bool
paludis::erepository::homepage_key_check(
+ const FSEntry & entry,
QAReporter & reporter,
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
@@ -90,10 +96,10 @@ paludis::erepository::homepage_key_check(
Context context("When performing check '" + name + "' using homepage_key_check on ID '" + stringify(*id) + "':");
if (! id->homepage_key())
- reporter.message(qaml_normal, name, "No homepage available for '" + stringify(*id) + "'");
+ reporter.message(entry, qaml_normal, name, "No homepage available for '" + stringify(*id) + "'");
else
{
- HomepageChecker h(reporter, id, name);
+ HomepageChecker h(entry, reporter, id, name);
id->homepage_key()->value()->accept(h);
}
diff --git a/paludis/repositories/e/qa/homepage_key.hh b/paludis/repositories/e/qa/homepage_key.hh
index 4f50b59..cb64c77 100644
--- a/paludis/repositories/e/qa/homepage_key.hh
+++ b/paludis/repositories/e/qa/homepage_key.hh
@@ -22,12 +22,14 @@
#include <paludis/qa-fwd.hh>
#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace paludis
{
namespace erepository
{
bool homepage_key_check(
+ const FSEntry &,
QAReporter &,
const tr1::shared_ptr<const ERepositoryID> &,
const std::string &);
diff --git a/paludis/repositories/e/qa/qa_checks.cc b/paludis/repositories/e/qa/qa_checks.cc
index d7e8117..1dd2845 100644
--- a/paludis/repositories/e/qa/qa_checks.cc
+++ b/paludis/repositories/e/qa/qa_checks.cc
@@ -56,24 +56,24 @@ QAChecks::QAChecks() :
using namespace tr1::placeholders;
_imp->tree_checks_group->add_check("stray_tree_files",
- tr1::bind(stray_files_check, _1, _3, _4, is_stray_at_tree_dir, "stray_tree_files"));
+ tr1::bind(stray_files_check, _2, _4, _5, is_stray_at_tree_dir, "stray_tree_files"));
_imp->category_dir_checks_group->add_check("stray_category_dir_files",
- tr1::bind(stray_files_check, _1, _3, _4, is_stray_at_category_dir, "stray_category_dir_files"));
+ tr1::bind(stray_files_check, _2, _4, _5, is_stray_at_category_dir, "stray_category_dir_files"));
_imp->package_id_checks_group->add_check("eapi_supported",
- tr1::bind(eapi_supported_check, _1, _4, "eapi_supported"));
+ tr1::bind(eapi_supported_check, _1, _2, _5, "eapi_supported"));
_imp->package_id_checks_group->add_check("short_description_key",
- tr1::bind(short_description_key_check, _1, _4, "short_description_key"));
+ tr1::bind(short_description_key_check, _1, _2, _5, "short_description_key"));
_imp->package_id_checks_group->add_prerequirement("short_description_key", "eapi_supported");
_imp->package_id_checks_group->add_check("homepage_key",
- tr1::bind(homepage_key_check, _1, _4, "homepage_key"));
+ tr1::bind(homepage_key_check, _1, _2, _5, "homepage_key"));
_imp->package_id_checks_group->add_prerequirement("homepage_key", "eapi_supported");
_imp->package_id_checks_group->add_check("dependency_keys",
- tr1::bind(dependency_keys_check, _1, _4, "dependency_keys"));
+ tr1::bind(dependency_keys_check, _1, _2, _5, "dependency_keys"));
_imp->package_id_checks_group->add_prerequirement("dependency_keys", "eapi_supported");
}
diff --git a/paludis/repositories/e/qa/qa_checks.hh b/paludis/repositories/e/qa/qa_checks.hh
index ae25d5f..b45ca67 100644
--- a/paludis/repositories/e/qa/qa_checks.hh
+++ b/paludis/repositories/e/qa/qa_checks.hh
@@ -41,6 +41,7 @@ namespace paludis
namespace erepository
{
typedef tr1::function<bool (
+ const FSEntry &,
QAReporter &,
const Environment * const,
const tr1::shared_ptr<const ERepository> &,
@@ -48,6 +49,7 @@ namespace paludis
)> TreeCheckFunction;
typedef tr1::function<bool (
+ const FSEntry &,
QAReporter &,
const Environment * const,
const tr1::shared_ptr<const ERepository> &,
@@ -55,6 +57,7 @@ namespace paludis
)> CategoryDirCheckFunction;
typedef tr1::function<bool (
+ const FSEntry &,
QAReporter &,
const Environment * const,
const tr1::shared_ptr<const ERepository> &,
diff --git a/paludis/repositories/e/qa/qa_controller.cc b/paludis/repositories/e/qa/qa_controller.cc
index de10e50..9504614 100644
--- a/paludis/repositories/e/qa/qa_controller.cc
+++ b/paludis/repositories/e/qa/qa_controller.cc
@@ -26,6 +26,7 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/mutex.hh>
#include <paludis/util/parallel_for_each.hh>
+#include <paludis/util/options.hh>
#include <paludis/qa.hh>
#include <libwrapiter/libwrapiter_forward_iterator.hh>
@@ -49,10 +50,10 @@ namespace
{
}
- void message(QAMessageLevel l, const std::string & s, const std::string & t)
+ void message(const FSEntry & f, QAMessageLevel l, const std::string & s, const std::string & t)
{
Lock lock(mutex);
- base.message(l, s, t);
+ base.message(f, l, s, t);
}
};
}
@@ -63,9 +64,9 @@ namespace paludis
struct Implementation<QAController>
{
const Environment * const env;
- const tr1::shared_ptr<const ERepository> & repo;
- const QACheckProperties & ignore_if;
- const QACheckProperties & ignore_unless;
+ const tr1::shared_ptr<const ERepository> repo;
+ const QACheckProperties ignore_if;
+ const QACheckProperties ignore_unless;
const QAMessageLevel minimum_level;
ThreadSafeQAReporter reporter;
@@ -117,11 +118,13 @@ QAController::_run_category(const CategoryNamePart & c)
QAChecks::get_instance()->category_dir_checks_group()->end(),
tr1::bind(std::equal_to<bool>(), false,
tr1::bind<bool>(tr1::mem_fn(&CategoryDirCheckFunction::operator() ),
- _1, tr1::ref(_imp->reporter), _imp->env, _imp->repo, _imp->repo->layout()->category_directory(c))));
+ _1, _imp->repo->layout()->category_directory(c),
+ tr1::ref(_imp->reporter), _imp->env, _imp->repo, _imp->repo->layout()->category_directory(c))));
}
catch (const Exception & e)
{
- _imp->reporter.message(qaml_severe, "category_dir_checks_group", "Caught exception '" + e.message() + "' (" + e.what() + ")");
+ _imp->reporter.message(_imp->repo->layout()->category_directory(c), qaml_severe, "category_dir_checks_group",
+ "Caught exception '" + e.message() + "' (" + e.what() + ")");
}
tr1::shared_ptr<const QualifiedPackageNameSet> packages(_imp->repo->package_names(c));
@@ -147,11 +150,13 @@ QAController::_run_id(const tr1::shared_ptr<const PackageID> & i)
QAChecks::get_instance()->package_id_checks_group()->end(),
tr1::bind(std::equal_to<bool>(), false,
tr1::bind<bool>(tr1::mem_fn(&PackageIDCheckFunction::operator() ),
- _1, tr1::ref(_imp->reporter), _imp->env, _imp->repo, tr1::static_pointer_cast<const ERepositoryID>(i))));
+ _1, _imp->repo->layout()->package_file(*i),
+ tr1::ref(_imp->reporter), _imp->env, _imp->repo, tr1::static_pointer_cast<const ERepositoryID>(i))));
}
catch (const Exception & e)
{
- _imp->reporter.message(qaml_severe, "package_id_checks_group", "Caught exception '" + e.message() + "' (" + e.what() + ")");
+ _imp->reporter.message(_imp->repo->layout()->package_file(*i), qaml_severe, "package_id_checks_group",
+ "Caught exception '" + e.message() + "' (" + e.what() + ")");
}
}
@@ -167,11 +172,13 @@ QAController::run()
QAChecks::get_instance()->tree_checks_group()->end(),
tr1::bind(std::equal_to<bool>(), false,
tr1::bind<bool>(tr1::mem_fn(&TreeCheckFunction::operator() ),
- _1, tr1::ref(_imp->reporter), _imp->env, _imp->repo, _imp->repo->params().location)));
+ _1, _imp->repo->params().location,
+ tr1::ref(_imp->reporter), _imp->env, _imp->repo, _imp->repo->params().location)));
}
catch (const Exception & e)
{
- _imp->reporter.message(qaml_severe, "tree_checks_group", "Caught exception '" + e.message() + "' (" + e.what() + ")");
+ _imp->reporter.message(_imp->repo->params().location, qaml_severe, "tree_checks_group",
+ "Caught exception '" + e.message() + "' (" + e.what() + ")");
}
tr1::shared_ptr<const CategoryNamePartSet> categories(_imp->repo->category_names());
diff --git a/paludis/repositories/e/qa/short_description_key.cc b/paludis/repositories/e/qa/short_description_key.cc
index 40c94b0..9a443df 100644
--- a/paludis/repositories/e/qa/short_description_key.cc
+++ b/paludis/repositories/e/qa/short_description_key.cc
@@ -25,6 +25,7 @@
bool
paludis::erepository::short_description_key_check(
+ const FSEntry & entry,
QAReporter & reporter,
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
@@ -32,18 +33,18 @@ paludis::erepository::short_description_key_check(
Context context("When performing check '" + name + "' using short_description_key_check on ID '" + stringify(*id) + "':");
if (! id->short_description_key())
- reporter.message(qaml_normal, name, "No description available for '" + stringify(*id) + "'");
+ reporter.message(entry, qaml_normal, name, "No description available for '" + stringify(*id) + "'");
else if (id->short_description_key()->value() == stringify(id->name()))
- reporter.message(qaml_normal, name, "Description for '" + stringify(*id) + "' is equal to PN");
+ reporter.message(entry, qaml_normal, name, "Description for '" + stringify(*id) + "' is equal to PN");
else if (std::string::npos != id->short_description_key()->value().find("Based on the")
&& std::string::npos != id->short_description_key()->value().find("eclass"))
- reporter.message(qaml_normal, name, "Description for '" + stringify(*id) + "' is about as useful as a chocolate teapot");
+ reporter.message(entry, qaml_normal, name, "Description for '" + stringify(*id) + "' is about as useful as a chocolate teapot");
else if (id->short_description_key()->value().length() < 10)
- reporter.message(qaml_normal, name, "Description for '" + stringify(*id) + "' is suspiciously short");
+ reporter.message(entry, qaml_normal, name, "Description for '" + stringify(*id) + "' is suspiciously short");
else if (id->short_description_key()->value().length() > 300)
- reporter.message(qaml_normal, name, "Description for '" + stringify(*id) + "' written by Duncan?");
+ reporter.message(entry, qaml_normal, name, "Description for '" + stringify(*id) + "' written by Duncan?");
else if (id->short_description_key()->value().length() > 120)
- reporter.message(qaml_normal, name, "Description for '" + stringify(*id) + "' is too long");
+ reporter.message(entry, qaml_normal, name, "Description for '" + stringify(*id) + "' is too long");
return true;
}
diff --git a/paludis/repositories/e/qa/short_description_key.hh b/paludis/repositories/e/qa/short_description_key.hh
index 9ec1614..f834215 100644
--- a/paludis/repositories/e/qa/short_description_key.hh
+++ b/paludis/repositories/e/qa/short_description_key.hh
@@ -22,12 +22,14 @@
#include <paludis/qa-fwd.hh>
#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/util/fs_entry-fwd.hh>
namespace paludis
{
namespace erepository
{
bool short_description_key_check(
+ const FSEntry &,
QAReporter & reporter,
const tr1::shared_ptr<const ERepositoryID> &,
const std::string & name);
diff --git a/paludis/repositories/e/qa/stray_files.cc b/paludis/repositories/e/qa/stray_files.cc
index 8708a6e..ae3437b 100644
--- a/paludis/repositories/e/qa/stray_files.cc
+++ b/paludis/repositories/e/qa/stray_files.cc
@@ -41,7 +41,7 @@ paludis::erepository::stray_files_check(
if (dir.exists())
for (DirIterator d(dir), d_end ; d != d_end ; ++d)
if (stray(repo, *d))
- reporter.message(qaml_normal, name, "Stray file '" + stringify(*d) + "'");
+ reporter.message(*d, qaml_normal, name, "Stray file '" + stringify(*d) + "'");
return true;
}
diff --git a/python/qa.cc b/python/qa.cc
index 3b8de59..e48040f 100644
--- a/python/qa.cc
+++ b/python/qa.cc
@@ -21,6 +21,7 @@
#include <paludis/qa.hh>
#include <paludis/util/options.hh>
+#include <paludis/util/fs_entry.hh>
using namespace paludis;
using namespace paludis::python;
@@ -30,10 +31,10 @@ struct QAReporterWrapper :
QAReporter,
bp::wrapper<QAReporter>
{
- void message(QAMessageLevel qml, const std::string & s, const std::string & m)
+ void message(const FSEntry & f, QAMessageLevel qml, const std::string & s, const std::string & m)
{
if (get_override("message"))
- get_override("message")(qml, s, m);
+ get_override("message")(f, qml, s, m);
else
throw PythonMethodNotImplemented("QAReporter", "message");
}
diff --git a/python/repository_TEST.py b/python/repository_TEST.py
index 46fe2ba..9caaf04 100755
--- a/python/repository_TEST.py
+++ b/python/repository_TEST.py
@@ -211,7 +211,7 @@ class TestCase_02_RepositoryInterfaces(unittest.TestCase):
QAReporter.__init__(self)
self.messages = 0
- def message(self, l, s, m):
+ def message(self, f, l, s, m):
self.messages += 1
qi = repo.qa_interface
diff --git a/ruby/paludis_ruby.cc b/ruby/paludis_ruby.cc
index b71b380..52882dd 100644
--- a/ruby/paludis_ruby.cc
+++ b/ruby/paludis_ruby.cc
@@ -316,15 +316,16 @@ paludis::ruby::RubyQAReporter::RubyQAReporter(VALUE* ruby_reporter) {
}
void
-paludis::ruby::RubyQAReporter::message(const QAMessageLevel l, const std::string & s, const std::string & m)
+paludis::ruby::RubyQAReporter::message(const FSEntry & f, const QAMessageLevel l, const std::string & s, const std::string & m)
{
try
{
ID message_id = rb_intern("message");
+ VALUE f_val = rb_str_new2(stringify(f).c_str());
VALUE l_val = INT2FIX(l);
VALUE s_val = rb_str_new2(s.c_str());
VALUE m_val = rb_str_new2(m.c_str());
- rb_funcall(*(this->reporter), message_id, 3, l_val, s_val, m_val);
+ rb_funcall(*(this->reporter), message_id, 4, f_val, l_val, s_val, m_val);
}
catch (const std::exception & e)
{
diff --git a/ruby/paludis_ruby.hh b/ruby/paludis_ruby.hh
index fb0cc87..186a516 100644
--- a/ruby/paludis_ruby.hh
+++ b/ruby/paludis_ruby.hh
@@ -56,7 +56,7 @@ namespace paludis
public:
RubyQAReporter(VALUE*);
- void message(const QAMessageLevel, const std::string &, const std::string &);
+ void message(const FSEntry &, const QAMessageLevel, const std::string &, const std::string &);
};
#endif
diff --git a/ruby/qa.cc b/ruby/qa.cc
index 2d73166..2501da8 100644
--- a/ruby/qa.cc
+++ b/ruby/qa.cc
@@ -118,7 +118,7 @@ namespace
/*
* call-seq:
- * message(qa_message_level, source, message)
+ * message(fs_entry, qa_message_level, source, message)
*
* Process a qa error message
*/
@@ -136,7 +136,7 @@ namespace
* Base class for QAReporter, create a new sublclass that implements a message function.
*/
c_qa_reporter = rb_define_class_under(paludis_module(), "QAReporter", rb_cObject);
- rb_define_method(c_qa_reporter, "message", RUBY_FUNC_CAST(&ruby_qa_reporter_message), 3);
+ rb_define_method(c_qa_reporter, "message", RUBY_FUNC_CAST(&ruby_qa_reporter_message), 4);
/*
* Document-class: Paludis::QACheckProperties
diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb
index 30b1908..70c9369 100644
--- a/ruby/repository_TEST.rb
+++ b/ruby/repository_TEST.rb
@@ -201,7 +201,7 @@ module Paludis
class TestQAReporter < QAReporter
@messages
- def message(l, s, m)
+ def message(f, l, s, m)
@messages+=1
end
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 0a8de32..bc74e59 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -57,9 +57,11 @@ namespace
struct QualudisReporter :
QAReporter
{
- void message(const QAMessageLevel l, const std::string & s, const std::string & m)
+ void message(const FSEntry & f, const QAMessageLevel l, const std::string & s, const std::string & m)
{
- std::cout << l << " " << s << ": " << m << std::endl;
+ std::cout << colour(cl_package_name, strip_leading_string(stringify(f.strip_leading(FSEntry::cwd())), "/"))
+ << ": " << s << " [" << colour(cl_error, l) << "] "
+ << std::endl << " " << m << std::endl;
}
};
}