aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-17 23:32:56 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-17 23:32:56 +0000
commit6e1c43ab2d842cedc9ed4bf571bd8d31b38f6683 (patch)
tree302c9fbc3f46461e9e34b219f1ae31a7bd23a6a6
parent6b72690a54a282a925cdc92ce235c5079dcdc19e (diff)
downloadpaludis-6e1c43ab2d842cedc9ed4bf571bd8d31b38f6683.tar.gz
paludis-6e1c43ab2d842cedc9ed4bf571bd8d31b38f6683.tar.xz
Re-add ebuild_count check.
-rw-r--r--paludis/repositories/e/qa/Makefile.am2
-rw-r--r--paludis/repositories/e/qa/ebuild_count.cc57
-rw-r--r--paludis/repositories/e/qa/ebuild_count.hh41
-rw-r--r--paludis/repositories/e/qa/qa_checks.cc4
4 files changed, 104 insertions, 0 deletions
diff --git a/paludis/repositories/e/qa/Makefile.am b/paludis/repositories/e/qa/Makefile.am
index e5df07b..91392a5 100644
--- a/paludis/repositories/e/qa/Makefile.am
+++ b/paludis/repositories/e/qa/Makefile.am
@@ -47,6 +47,7 @@ paludis_repositories_e_include_HEADERS = \
header.hh \
variable_assigns.hh \
gpg.hh \
+ ebuild_count.hh \
misc_files.hh \
files_dir_size.hh \
repo_name.hh
@@ -74,6 +75,7 @@ libpaludiserepositoryqa_la_SOURCES = \
header.cc \
variable_assigns.cc \
gpg.cc \
+ ebuild_count.cc \
misc_files.cc \
files_dir_size.cc \
repo_name.cc \
diff --git a/paludis/repositories/e/qa/ebuild_count.cc b/paludis/repositories/e/qa/ebuild_count.cc
new file mode 100644
index 0000000..0a9fe5b
--- /dev/null
+++ b/paludis/repositories/e/qa/ebuild_count.cc
@@ -0,0 +1,57 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006, 2007 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include "ebuild_count.hh"
+#include <paludis/qa.hh>
+#include <paludis/repository.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/sequence.hh>
+#include <paludis/util/wrapped_forward_iterator.hh>
+
+using namespace paludis;
+
+bool
+paludis::erepository::ebuild_count_check(
+ QAReporter & reporter,
+ const FSEntry & dir,
+ const tr1::shared_ptr<const Repository> & repo,
+ const QualifiedPackageName & q,
+ const std::string & name
+ )
+{
+ Context context("When performing check '" + name + "' using ebuild_count_check on directory '" + stringify(dir) + "':");
+ Log::get_instance()->message(ll_debug, lc_context) << "ebuild_count_check '"
+ << dir << "', " << name << "'";
+
+ PackageIDSequence::ConstIterator::difference_type count(
+ std::distance(repo->package_ids(q)->begin(), repo->package_ids(q)->end()));
+
+ if (count > 20)
+ reporter.message(QAMessage(dir, qaml_minor, name, "Found " + stringify(count) +
+ " ebuilds, which is too many to count on both hands and both feet"));
+ else if (count > 15)
+ reporter.message(QAMessage(dir, qaml_minor, name, "Found " + stringify(count) +
+ " ebuilds, which is too many to count on both hands and one foot"));
+ else if (count > 10)
+ reporter.message(QAMessage(dir, qaml_minor, name, "Found " + stringify(count) +
+ " ebuilds, which is too many to count on my fingers"));
+
+ return true;
+}
+
diff --git a/paludis/repositories/e/qa/ebuild_count.hh b/paludis/repositories/e/qa/ebuild_count.hh
new file mode 100644
index 0000000..3d62c22
--- /dev/null
+++ b/paludis/repositories/e/qa/ebuild_count.hh
@@ -0,0 +1,41 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_EBUILD_COUNT_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_EBUILD_COUNT_HH 1
+
+#include <paludis/repositories/e/qa/qa_controller.hh>
+#include <paludis/repository-fwd.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ bool
+ ebuild_count_check(
+ QAReporter &,
+ const FSEntry &,
+ const tr1::shared_ptr<const Repository> &,
+ const QualifiedPackageName &,
+ const std::string &
+ );
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/qa/qa_checks.cc b/paludis/repositories/e/qa/qa_checks.cc
index d592b1a..f7ccce1 100644
--- a/paludis/repositories/e/qa/qa_checks.cc
+++ b/paludis/repositories/e/qa/qa_checks.cc
@@ -23,6 +23,7 @@
#include <paludis/repositories/e/qa/stray_files.hh>
#include <paludis/repositories/e/qa/gpg.hh>
+#include <paludis/repositories/e/qa/ebuild_count.hh>
#include <paludis/repositories/e/qa/misc_files.hh>
#include <paludis/repositories/e/qa/files_dir_size.hh>
#include <paludis/repositories/e/qa/eapi_supported.hh>
@@ -96,6 +97,9 @@ QAChecks::QAChecks() :
_imp->package_dir_checks_group->add_check("gpg",
tr1::bind(gpg_check, _2, _1, "gpg"));
+ _imp->package_dir_checks_group->add_check("ebuild_count",
+ tr1::bind(ebuild_count_check, _2, _1, _4, _5, "ebuild_count"));
+
_imp->package_dir_checks_group->add_check("misc_files",
tr1::bind(misc_files_check, _2, _1, "misc_files"));