aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-11 18:53:06 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-11 18:53:06 +0000
commit3b611ef07501abcff3ee2d8948dfe737cdfa5fd4 (patch)
treead4a64752e5170954d7dfd560b5b74e6360e2521
parent4972d5f346e9c6a9a20a4b2c2ab5a94b7c96fdcc (diff)
downloadpaludis-3b611ef07501abcff3ee2d8948dfe737cdfa5fd4.tar.gz
paludis-3b611ef07501abcff3ee2d8948dfe737cdfa5fd4.tar.xz
Add PackageDirCheckFunction, remove some redundant parameters and add some useful ones.
-rw-r--r--paludis/repositories/e/qa/qa_checks.cc14
-rw-r--r--paludis/repositories/e/qa/qa_checks.hh16
-rw-r--r--paludis/repositories/e/qa/qa_checks_group.cc4
-rw-r--r--paludis/repositories/e/qa/qa_controller.cc14
4 files changed, 39 insertions, 9 deletions
diff --git a/paludis/repositories/e/qa/qa_checks.cc b/paludis/repositories/e/qa/qa_checks.cc
index d47efaf..0457dba 100644
--- a/paludis/repositories/e/qa/qa_checks.cc
+++ b/paludis/repositories/e/qa/qa_checks.cc
@@ -47,12 +47,14 @@ namespace paludis
{
const tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> > tree_checks_group;
const tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> > category_dir_checks_group;
+ const tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> > package_dir_checks_group;
const tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> > package_id_checks_group;
const tr1::shared_ptr<QAChecksGroup<PackageIDFileContentsCheckFunction> > package_id_file_contents_checks_group;
Implementation() :
tree_checks_group(new QAChecksGroup<TreeCheckFunction>),
category_dir_checks_group(new QAChecksGroup<CategoryDirCheckFunction>),
+ package_dir_checks_group(new QAChecksGroup<PackageDirCheckFunction>),
package_id_checks_group(new QAChecksGroup<PackageIDCheckFunction>),
package_id_file_contents_checks_group(new QAChecksGroup<PackageIDFileContentsCheckFunction>)
{
@@ -66,13 +68,13 @@ QAChecks::QAChecks() :
using namespace tr1::placeholders;
_imp->tree_checks_group->add_check("stray_tree_files",
- tr1::bind(stray_files_check, _2, _4, _5, is_stray_at_tree_dir, "stray_tree_files"));
+ tr1::bind(stray_files_check, _2, _4, _1, is_stray_at_tree_dir, "stray_tree_files"));
_imp->tree_checks_group->add_check("repo_name",
tr1::bind(repo_name_check, _2, _1, "repo_name"));
_imp->category_dir_checks_group->add_check("stray_category_dir_files",
- tr1::bind(stray_files_check, _2, _4, _5, is_stray_at_category_dir, "stray_category_dir_files"));
+ tr1::bind(stray_files_check, _2, _4, _1, is_stray_at_category_dir, "stray_category_dir_files"));
_imp->package_id_checks_group->add_check("eapi_supported",
tr1::bind(eapi_supported_check, _1, _2, _5, "eapi_supported"));
@@ -124,12 +126,18 @@ QAChecks::tree_checks_group()
return _imp->tree_checks_group;
}
-const tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> >
+const tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> >
QAChecks::category_dir_checks_group()
{
return _imp->category_dir_checks_group;
}
+const tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> >
+QAChecks::package_dir_checks_group()
+{
+ return _imp->package_dir_checks_group;
+}
+
const tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> >
QAChecks::package_id_checks_group()
{
diff --git a/paludis/repositories/e/qa/qa_checks.hh b/paludis/repositories/e/qa/qa_checks.hh
index e4ca03a..ed26a6c 100644
--- a/paludis/repositories/e/qa/qa_checks.hh
+++ b/paludis/repositories/e/qa/qa_checks.hh
@@ -43,8 +43,7 @@ namespace paludis
const FSEntry &,
QAReporter &,
const Environment * const,
- const tr1::shared_ptr<const ERepository> &,
- const FSEntry &
+ const tr1::shared_ptr<const ERepository> &
)> TreeCheckFunction;
typedef tr1::function<bool (
@@ -52,7 +51,7 @@ namespace paludis
QAReporter &,
const Environment * const,
const tr1::shared_ptr<const ERepository> &,
- const FSEntry &
+ const CategoryNamePart &
)> CategoryDirCheckFunction;
typedef tr1::function<bool (
@@ -60,6 +59,14 @@ namespace paludis
QAReporter &,
const Environment * const,
const tr1::shared_ptr<const ERepository> &,
+ const QualifiedPackageName &
+ )> PackageDirCheckFunction;
+
+ typedef tr1::function<bool (
+ const FSEntry &,
+ QAReporter &,
+ const Environment * const,
+ const tr1::shared_ptr<const ERepository> &,
const tr1::shared_ptr<const ERepositoryID> &
)> PackageIDCheckFunction;
@@ -89,6 +96,9 @@ namespace paludis
const tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> >
category_dir_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result));
+ const tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> >
+ package_dir_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result));
+
const tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> >
package_id_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/repositories/e/qa/qa_checks_group.cc b/paludis/repositories/e/qa/qa_checks_group.cc
index 0533ac1..9832768 100644
--- a/paludis/repositories/e/qa/qa_checks_group.cc
+++ b/paludis/repositories/e/qa/qa_checks_group.cc
@@ -114,10 +114,14 @@ QAChecksGroup<T_>::need_ordering() const
}
template class QAChecksGroup<TreeCheckFunction>;
+template class QAChecksGroup<CategoryDirCheckFunction>;
+template class QAChecksGroup<PackageDirCheckFunction>;
template class QAChecksGroup<PackageIDCheckFunction>;
template class QAChecksGroup<PackageIDFileContentsCheckFunction>;
template class WrappedForwardIterator<QAChecksGroup<TreeCheckFunction>::ConstIteratorTag, TreeCheckFunction>;
+template class WrappedForwardIterator<QAChecksGroup<CategoryDirCheckFunction>::ConstIteratorTag, CategoryDirCheckFunction>;
+template class WrappedForwardIterator<QAChecksGroup<PackageDirCheckFunction>::ConstIteratorTag, PackageDirCheckFunction>;
template class WrappedForwardIterator<QAChecksGroup<PackageIDCheckFunction>::ConstIteratorTag, PackageIDCheckFunction>;
template class WrappedForwardIterator<QAChecksGroup<PackageIDFileContentsCheckFunction>::ConstIteratorTag, PackageIDFileContentsCheckFunction>;
diff --git a/paludis/repositories/e/qa/qa_controller.cc b/paludis/repositories/e/qa/qa_controller.cc
index 2c8cb44..276a683 100644
--- a/paludis/repositories/e/qa/qa_controller.cc
+++ b/paludis/repositories/e/qa/qa_controller.cc
@@ -226,7 +226,7 @@ QAController::_check_category(const CategoryNamePart c, const tr1::shared_ptr<co
tr1::bind(std::equal_to<bool>(), false,
tr1::bind<bool>(tr1::mem_fn(&CategoryDirCheckFunction::operator() ),
_1, _imp->repo->layout()->category_directory(c), tr1::ref(_imp->reporter),
- _imp->env, _imp->repo, _imp->repo->layout()->category_directory(c))));
+ _imp->env, _imp->repo, c)));
}
bool done(false);
@@ -270,6 +270,14 @@ QAController::_check_package(const QualifiedPackageName p)
if (_above_base_dir(p_dir) || _under_base_dir(p_dir))
{
+ std::find_if(
+ QAChecks::get_instance()->package_dir_checks_group()->begin(),
+ QAChecks::get_instance()->package_dir_checks_group()->end(),
+ tr1::bind(std::equal_to<bool>(), false,
+ tr1::bind<bool>(&PackageDirCheckFunction::operator(),
+ _1, _imp->repo->layout()->package_directory(p),
+ tr1::ref(_imp->reporter), _imp->env, _imp->repo, p)));
+
tr1::shared_ptr<const PackageIDSequence> ids(_imp->repo->package_ids(p));
std::for_each(ids->begin(), ids->end(), tr1::bind(&QAController::_check_id, this, _1));
_imp->reporter.flush(p_dir);
@@ -335,9 +343,9 @@ QAController::run()
QAChecks::get_instance()->tree_checks_group()->begin(),
QAChecks::get_instance()->tree_checks_group()->end(),
tr1::bind(std::equal_to<bool>(), false,
- tr1::bind<bool>(tr1::mem_fn(&CategoryDirCheckFunction::operator() ),
+ tr1::bind<bool>(tr1::mem_fn(&TreeCheckFunction::operator() ),
_1, _imp->repo->params().location, tr1::ref(_imp->reporter),
- _imp->env, _imp->repo, _imp->repo->params().location))))
+ _imp->env, _imp->repo))))
{
QAMessage(_imp->repo->params().location, qaml_severe, "tree_checks_group",
"Tree checks failed. Not continuing.");