aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-06 16:39:34 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-06 16:39:34 +0000
commite2871f89e85db27bf875f4b2262a625e57884c0c (patch)
tree55fbc5b11be2be1272f2bbf892cafa9afd6f6fa6
parent8a2b5d82810efce968cc44c8909a2b968aedadc8 (diff)
downloadpaludis-e2871f89e85db27bf875f4b2262a625e57884c0c.tar.gz
paludis-e2871f89e85db27bf875f4b2262a625e57884c0c.tar.xz
More QA work
-rw-r--r--paludis/repositories/e/qa/Makefile.am2
-rw-r--r--paludis/repositories/e/qa/dependency_keys.cc70
-rw-r--r--paludis/repositories/e/qa/dependency_keys.hh37
-rw-r--r--paludis/repositories/e/qa/eapi_supported.cc2
-rw-r--r--paludis/repositories/e/qa/homepage_key.cc2
-rw-r--r--paludis/repositories/e/qa/qa_checks.cc7
-rw-r--r--paludis/repositories/e/qa/short_description_key.cc2
-rw-r--r--paludis/repositories/e/qa/stray_files.cc2
8 files changed, 124 insertions, 0 deletions
diff --git a/paludis/repositories/e/qa/Makefile.am b/paludis/repositories/e/qa/Makefile.am
index b82f002..5a74c33 100644
--- a/paludis/repositories/e/qa/Makefile.am
+++ b/paludis/repositories/e/qa/Makefile.am
@@ -14,6 +14,7 @@ if ENABLE_QA
paludis_repositories_e_includedir = $(includedir)/paludis-$(PALUDIS_PC_SLOT)/paludis/repositories/e/
paludis_repositories_e_include_HEADERS = \
+ dependency_keys.hh \
eapi_supported.hh \
homepage_key.hh \
qa_checks.hh \
@@ -25,6 +26,7 @@ paludis_repositories_e_include_HEADERS = \
noinst_LTLIBRARIES = libpaludiserepositoryqa.la
libpaludiserepositoryqa_la_SOURCES = \
+ dependency_keys.cc \
eapi_supported.cc \
homepage_key.cc \
qa_checks.cc \
diff --git a/paludis/repositories/e/qa/dependency_keys.cc b/paludis/repositories/e/qa/dependency_keys.cc
new file mode 100644
index 0000000..cf7b05f
--- /dev/null
+++ b/paludis/repositories/e/qa/dependency_keys.cc
@@ -0,0 +1,70 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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 "dependency_keys.hh"
+#include <paludis/package_id.hh>
+#include <paludis/metadata_key.hh>
+#include <paludis/qa.hh>
+#include <paludis/repositories/e/eapi.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+#include <paludis/util/stringify.hh>
+
+using namespace paludis;
+using namespace paludis::erepository;
+
+namespace
+{
+ bool dependency_key_check(
+ QAReporter & reporter,
+ const tr1::shared_ptr<const ERepositoryID> & id,
+ const std::string & name,
+ const MetadataSpecTreeKey<DependencySpecTree> & key)
+ {
+ Context context("When checking dependency key '" + key.raw_name() + "' for check '" + name +
+ "' using dependency_keys_check on ID '" + stringify(*id) + "':");
+
+ return true;
+ }
+}
+
+bool
+paludis::erepository::dependency_keys_check(
+ QAReporter & reporter,
+ const tr1::shared_ptr<const ERepositoryID> & id,
+ const std::string & name)
+{
+ Context context("When performing check '" + name + "' using dependency_keys_check on ID '" + stringify(*id) + "':");
+
+ bool result(true);
+
+ if (id->build_dependencies_key())
+ result &= dependency_key_check(reporter, id, name, *id->build_dependencies_key());
+
+ if (id->run_dependencies_key())
+ result &= dependency_key_check(reporter, id, name, *id->run_dependencies_key());
+
+ if (id->post_dependencies_key())
+ result &= dependency_key_check(reporter, id, name, *id->post_dependencies_key());
+
+ if (id->suggested_dependencies_key())
+ result &= dependency_key_check(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
new file mode 100644
index 0000000..fb948e0
--- /dev/null
+++ b/paludis/repositories/e/qa/dependency_keys.hh
@@ -0,0 +1,37 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2007 Ciaran McCreesh <ciaranm@ciaranm.org>
+ *
+ * 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_DEPENDENCIES_HH
+#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_DEPENDENCIES_HH 1
+
+#include <paludis/qa-fwd.hh>
+#include <paludis/repositories/e/e_repository_id.hh>
+
+namespace paludis
+{
+ namespace erepository
+ {
+ bool dependency_keys_check(
+ QAReporter &,
+ const tr1::shared_ptr<const ERepositoryID> &,
+ const std::string &);
+ }
+}
+
+#endif
diff --git a/paludis/repositories/e/qa/eapi_supported.cc b/paludis/repositories/e/qa/eapi_supported.cc
index 12274a2..2e3b236 100644
--- a/paludis/repositories/e/qa/eapi_supported.cc
+++ b/paludis/repositories/e/qa/eapi_supported.cc
@@ -30,6 +30,8 @@ paludis::erepository::eapi_supported_check(
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
{
+ Context context("When performing check '" + name + "' using eapi_supported_check on ID '" + stringify(*id) + "':");
+
if (! id->eapi()->supported)
{
reporter.message(qaml_severe, name, "EAPI '" + stringify(id->eapi()->name) + "' not supported");
diff --git a/paludis/repositories/e/qa/homepage_key.cc b/paludis/repositories/e/qa/homepage_key.cc
index a4da01b..c1404f2 100644
--- a/paludis/repositories/e/qa/homepage_key.cc
+++ b/paludis/repositories/e/qa/homepage_key.cc
@@ -87,6 +87,8 @@ paludis::erepository::homepage_key_check(
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
{
+ 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) + "'");
else
diff --git a/paludis/repositories/e/qa/qa_checks.cc b/paludis/repositories/e/qa/qa_checks.cc
index a59ed34..d7e8117 100644
--- a/paludis/repositories/e/qa/qa_checks.cc
+++ b/paludis/repositories/e/qa/qa_checks.cc
@@ -25,6 +25,7 @@
#include <paludis/repositories/e/qa/eapi_supported.hh>
#include <paludis/repositories/e/qa/short_description_key.hh>
#include <paludis/repositories/e/qa/homepage_key.hh>
+#include <paludis/repositories/e/qa/dependency_keys.hh>
using namespace paludis;
using namespace paludis::erepository;
@@ -62,12 +63,18 @@ QAChecks::QAChecks() :
_imp->package_id_checks_group->add_check("eapi_supported",
tr1::bind(eapi_supported_check, _1, _4, "eapi_supported"));
+
_imp->package_id_checks_group->add_check("short_description_key",
tr1::bind(short_description_key_check, _1, _4, "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"));
_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"));
+ _imp->package_id_checks_group->add_prerequirement("dependency_keys", "eapi_supported");
}
QAChecks::~QAChecks()
diff --git a/paludis/repositories/e/qa/short_description_key.cc b/paludis/repositories/e/qa/short_description_key.cc
index cb4c010..40c94b0 100644
--- a/paludis/repositories/e/qa/short_description_key.cc
+++ b/paludis/repositories/e/qa/short_description_key.cc
@@ -29,6 +29,8 @@ paludis::erepository::short_description_key_check(
const tr1::shared_ptr<const ERepositoryID> & id,
const std::string & name)
{
+ 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) + "'");
else if (id->short_description_key()->value() == stringify(id->name()))
diff --git a/paludis/repositories/e/qa/stray_files.cc b/paludis/repositories/e/qa/stray_files.cc
index 81a5b67..8708a6e 100644
--- a/paludis/repositories/e/qa/stray_files.cc
+++ b/paludis/repositories/e/qa/stray_files.cc
@@ -36,6 +36,8 @@ paludis::erepository::stray_files_check(
const std::string & name
)
{
+ Context context("When performing check '" + name + "' using stray_files_check on directory '" + stringify(dir) + "':");
+
if (dir.exists())
for (DirIterator d(dir), d_end ; d != d_end ; ++d)
if (stray(repo, *d))