aboutsummaryrefslogtreecommitdiff
path: root/0.8.0/paludis/qa
diff options
context:
space:
mode:
Diffstat (limited to '0.8.0/paludis/qa')
-rw-r--r--0.8.0/paludis/qa/Makefile.am.m4100
-rw-r--r--0.8.0/paludis/qa/changelog_check.cc75
-rw-r--r--0.8.0/paludis/qa/changelog_check.hh51
-rw-r--r--0.8.0/paludis/qa/check.cc32
-rw-r--r--0.8.0/paludis/qa/check.hh60
-rw-r--r--0.8.0/paludis/qa/check_result.cc44
-rw-r--r--0.8.0/paludis/qa/check_result.hh93
-rw-r--r--0.8.0/paludis/qa/check_result_TEST.cc52
-rw-r--r--0.8.0/paludis/qa/create_metadata_check.cc67
-rw-r--r--0.8.0/paludis/qa/create_metadata_check.hh56
-rw-r--r--0.8.0/paludis/qa/defaults_check.cc154
-rw-r--r--0.8.0/paludis/qa/defaults_check.hh53
-rw-r--r--0.8.0/paludis/qa/defaults_check_TEST.cc60
-rwxr-xr-x0.8.0/paludis/qa/defaults_check_TEST_cleanup.sh12
-rwxr-xr-x0.8.0/paludis/qa/defaults_check_TEST_setup.sh43
-rw-r--r--0.8.0/paludis/qa/dep_any_check.cc143
-rw-r--r--0.8.0/paludis/qa/dep_any_check.hh51
-rw-r--r--0.8.0/paludis/qa/dep_flags_check.cc174
-rw-r--r--0.8.0/paludis/qa/dep_flags_check.hh51
-rw-r--r--0.8.0/paludis/qa/dep_packages_check.cc149
-rw-r--r--0.8.0/paludis/qa/dep_packages_check.hh51
-rw-r--r--0.8.0/paludis/qa/deprecated_functions_check.cc82
-rw-r--r--0.8.0/paludis/qa/deprecated_functions_check.hh51
-rw-r--r--0.8.0/paludis/qa/deps_exist_check.cc139
-rw-r--r--0.8.0/paludis/qa/deps_exist_check.hh51
-rw-r--r--0.8.0/paludis/qa/deps_visible_check.cc142
-rw-r--r--0.8.0/paludis/qa/deps_visible_check.hh51
-rw-r--r--0.8.0/paludis/qa/description_check.cc81
-rw-r--r--0.8.0/paludis/qa/description_check.hh51
-rw-r--r--0.8.0/paludis/qa/digest_collisions_check.cc88
-rw-r--r--0.8.0/paludis/qa/digest_collisions_check.hh51
-rw-r--r--0.8.0/paludis/qa/ebuild_check.cc35
-rw-r--r--0.8.0/paludis/qa/ebuild_check.hh75
-rw-r--r--0.8.0/paludis/qa/ebuild_check.sr10
-rw-r--r--0.8.0/paludis/qa/ebuild_count_check.cc58
-rw-r--r--0.8.0/paludis/qa/ebuild_count_check.hh51
-rw-r--r--0.8.0/paludis/qa/extract_check.cc128
-rw-r--r--0.8.0/paludis/qa/extract_check.hh51
-rw-r--r--0.8.0/paludis/qa/file_check.cc33
-rw-r--r--0.8.0/paludis/qa/file_check.hh86
-rw-r--r--0.8.0/paludis/qa/file_permissions_check.cc60
-rw-r--r--0.8.0/paludis/qa/file_permissions_check.hh51
-rw-r--r--0.8.0/paludis/qa/file_permissions_check_TEST.cc90
-rwxr-xr-x0.8.0/paludis/qa/file_permissions_check_TEST_cleanup.sh11
-rwxr-xr-x0.8.0/paludis/qa/file_permissions_check_TEST_setup.sh14
-rw-r--r--0.8.0/paludis/qa/filename_check.cc52
-rw-r--r--0.8.0/paludis/qa/filename_check.hh56
-rw-r--r--0.8.0/paludis/qa/files.m452
-rw-r--r--0.8.0/paludis/qa/files_dir_size_check.cc87
-rw-r--r--0.8.0/paludis/qa/files_dir_size_check.hh51
-rw-r--r--0.8.0/paludis/qa/glep_31_check.cc126
-rw-r--r--0.8.0/paludis/qa/glep_31_check.hh55
-rw-r--r--0.8.0/paludis/qa/glep_31_check_TEST.cc77
-rw-r--r--0.8.0/paludis/qa/gpg_check.cc62
-rw-r--r--0.8.0/paludis/qa/gpg_check.hh51
-rw-r--r--0.8.0/paludis/qa/gpg_check_TEST.cc65
-rwxr-xr-x0.8.0/paludis/qa/gpg_check_TEST_cleanup.sh8
-rwxr-xr-x0.8.0/paludis/qa/gpg_check_TEST_setup.sh9
-rw-r--r--0.8.0/paludis/qa/has_ebuilds_check.cc50
-rw-r--r--0.8.0/paludis/qa/has_ebuilds_check.hh51
-rw-r--r--0.8.0/paludis/qa/has_ebuilds_check_TEST.cc66
-rwxr-xr-x0.8.0/paludis/qa/has_ebuilds_check_TEST_cleanup.sh11
-rwxr-xr-x0.8.0/paludis/qa/has_ebuilds_check_TEST_setup.sh12
-rw-r--r--0.8.0/paludis/qa/has_misc_files_check.cc54
-rw-r--r--0.8.0/paludis/qa/has_misc_files_check.hh51
-rw-r--r--0.8.0/paludis/qa/has_misc_files_check_TEST.cc102
-rwxr-xr-x0.8.0/paludis/qa/has_misc_files_check_TEST_cleanup.sh12
-rwxr-xr-x0.8.0/paludis/qa/has_misc_files_check_TEST_setup.sh23
-rw-r--r--0.8.0/paludis/qa/homepage_check.cc73
-rw-r--r--0.8.0/paludis/qa/homepage_check.hh51
-rw-r--r--0.8.0/paludis/qa/inherits_check.cc91
-rw-r--r--0.8.0/paludis/qa/inherits_check.hh51
-rw-r--r--0.8.0/paludis/qa/iuse_check.cc98
-rw-r--r--0.8.0/paludis/qa/iuse_check.hh56
-rw-r--r--0.8.0/paludis/qa/keywords_check.cc88
-rw-r--r--0.8.0/paludis/qa/keywords_check.hh51
-rw-r--r--0.8.0/paludis/qa/license_check.cc141
-rw-r--r--0.8.0/paludis/qa/license_check.hh51
-rw-r--r--0.8.0/paludis/qa/message.cc34
-rw-r--r--0.8.0/paludis/qa/message.hh52
-rw-r--r--0.8.0/paludis/qa/message.sr9
-rw-r--r--0.8.0/paludis/qa/message_TEST.cc42
-rw-r--r--0.8.0/paludis/qa/metadata_check.cc116
-rw-r--r--0.8.0/paludis/qa/metadata_check.hh51
-rw-r--r--0.8.0/paludis/qa/metadata_file.cc136
-rw-r--r--0.8.0/paludis/qa/metadata_file.hh51
-rw-r--r--0.8.0/paludis/qa/metadata_file_TEST.cc72
-rw-r--r--0.8.0/paludis/qa/package_dir_check.cc33
-rw-r--r--0.8.0/paludis/qa/package_dir_check.hh80
-rw-r--r--0.8.0/paludis/qa/package_name_check.cc62
-rw-r--r--0.8.0/paludis/qa/package_name_check.hh56
-rw-r--r--0.8.0/paludis/qa/package_name_check_TEST.cc104
-rwxr-xr-x0.8.0/paludis/qa/package_name_check_TEST_cleanup.sh11
-rwxr-xr-x0.8.0/paludis/qa/package_name_check_TEST_setup.sh14
-rw-r--r--0.8.0/paludis/qa/parse_deps_check.cc97
-rw-r--r--0.8.0/paludis/qa/parse_deps_check.hh56
-rw-r--r--0.8.0/paludis/qa/pdepend_overlap_check.cc144
-rw-r--r--0.8.0/paludis/qa/pdepend_overlap_check.hh51
-rw-r--r--0.8.0/paludis/qa/qa.cc21
-rw-r--r--0.8.0/paludis/qa/qa.hh.m438
-rw-r--r--0.8.0/paludis/qa/qa_environment.cc128
-rw-r--r--0.8.0/paludis/qa/qa_environment.hh76
-rw-r--r--0.8.0/paludis/qa/qa_environment.sr14
-rw-r--r--0.8.0/paludis/qa/qa_environment_TEST.cc60
-rwxr-xr-x0.8.0/paludis/qa/qa_environment_TEST_cleanup.sh11
-rwxr-xr-x0.8.0/paludis/qa/qa_environment_TEST_setup.sh36
-rw-r--r--0.8.0/paludis/qa/restrict_check.cc97
-rw-r--r--0.8.0/paludis/qa/restrict_check.hh51
-rw-r--r--0.8.0/paludis/qa/slot_check.cc73
-rw-r--r--0.8.0/paludis/qa/slot_check.hh51
-rw-r--r--0.8.0/paludis/qa/src_uri_check.cc193
-rw-r--r--0.8.0/paludis/qa/src_uri_check.hh51
-rw-r--r--0.8.0/paludis/qa/whitespace_check.cc123
-rw-r--r--0.8.0/paludis/qa/whitespace_check.hh51
114 files changed, 7390 insertions, 0 deletions
diff --git a/0.8.0/paludis/qa/Makefile.am.m4 b/0.8.0/paludis/qa/Makefile.am.m4
new file mode 100644
index 0000000..705a268
--- /dev/null
+++ b/0.8.0/paludis/qa/Makefile.am.m4
@@ -0,0 +1,100 @@
+ifdef(`__gnu__',`',`errprint(`This is not GNU m4...
+')m4exit(1)') include(`misc/generated-file.txt')
+
+dnl vim: set ft=m4 noet :
+
+define(`filelist', `')dnl
+define(`testlist', `')dnl
+define(`headerlist', `')dnl
+define(`srlist', `')dnl
+define(`srcleanlist', `')dnl
+define(`srheaderlist', `')dnl
+define(`testscriptlist', `')dnl
+define(`addtest', `define(`testlist', testlist `$1_TEST')dnl
+$1_TEST_SOURCES = $1_TEST.cc
+$1_TEST_LDADD = \
+ $(top_builddir)/paludis/util/test_extras.o \
+ $(top_builddir)/test/libtest.a \
+ libpaludisqa.la \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/libxml/libpaludislibxml.la \
+ $(top_builddir)/paludis/repositories/portage/libpaludisportagerepository.la \
+ $(top_builddir)/paludis/repositories/virtuals/libpaludisvirtualsrepository.la \
+ $(DYNAMIC_LD_LIBS) \
+ $(PCREPLUSPLUS_LIBS) \
+ $(LIBXML2DEPS_LIBS)
+$1_TEST_CXXFLAGS = -I$(top_srcdir)
+')dnl
+define(`addtestscript', `define(`testscriptlist', testscriptlist `$1_TEST_setup.sh $1_TEST_cleanup.sh')')dnl
+define(`addhh', `define(`filelist', filelist `$1.hh')define(`headerlist', headerlist `$1.hh')')dnl
+define(`addcc', `define(`filelist', filelist `$1.cc')')dnl
+define(`addimpl', `define(`filelist', filelist `$1-impl.hh')')dnl
+define(`addsr', `define(`srlist', srlist `$1.sr')dnl
+define(`srcleanlist', srcleanlist `$1-sr.hh $1-sr.cc')dnl
+define(`srheaderlist', srheaderlist `$1-sr.hh')dnl
+$1-sr.hh : $1.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --header $`'(srcdir)/$1.sr > $`'@
+
+$1-sr.cc : $1.sr $(top_srcdir)/misc/make_sr.bash
+ $(top_srcdir)/misc/make_sr.bash --source $`'(srcdir)/$1.sr > $`'@
+
+')dnl
+define(`addthis', `dnl
+ifelse(`$2', `hh', `addhh(`$1')', `')dnl
+ifelse(`$2', `cc', `addcc(`$1')', `')dnl
+ifelse(`$2', `sr', `addsr(`$1')', `')dnl
+ifelse(`$2', `impl', `addimpl(`$1')', `')dnl
+ifelse(`$2', `test', `addtest(`$1')', `')dnl
+ifelse(`$2', `testscript', `addtestscript(`$1')', `')')dnl
+define(`add', `addthis(`$1',`$2')addthis(`$1',`$3')addthis(`$1',`$4')dnl
+addthis(`$1',`$5')addthis(`$1',`$6')')dnl
+
+include(`paludis/qa/files.m4')
+
+if ENABLE_QA
+
+INCLUDES = $(PCREPLUSPLUS_CFLAGS) $(LIBXML2DEPS_CFLAGS)
+
+libpaludisqa_la_SOURCES = filelist
+libpaludisqa_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
+libpaludisqa_la_LIBADD = \
+ $(top_builddir)/paludis/libpaludis.la \
+ $(top_builddir)/paludis/util/libpaludisutil.la \
+ $(top_builddir)/paludis/libxml/libpaludislibxml.la \
+ @LIBXML2DEPS_LIBS@
+
+TESTS = testlist
+
+TESTS_ENVIRONMENT = env \
+ PALUDIS_EBUILD_DIR="$(top_srcdir)/ebuild/" \
+ PALUDIS_SKIP_CONFIG="yes" \
+ PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ bash $(top_srcdir)/test/run_test.sh
+
+check_PROGRAMS = $(TESTS)
+check_SCRIPTS = testscriptlist
+noinst_LTLIBRARIES = libpaludisqa.la
+paludis_qaincludedir = $(includedir)/paludis/qa/
+paludis_qainclude_HEADERS = headerlist srheaderlist
+
+endif
+
+Makefile.am : Makefile.am.m4 files.m4
+ $(top_srcdir)/misc/do_m4.bash Makefile.am
+
+qa.hh : qa.hh.m4 files.m4
+ $(top_srcdir)/misc/do_m4.bash qa.hh
+
+CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda
+MAINTAINERCLEANFILES = Makefile.in Makefile.am qa.hh
+DISTCLEANFILES = srcleanlist
+BUILT_SOURCES = srcleanlist qa.hh
+AM_CXXFLAGS = -I$(top_srcdir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@
+DEFS= \
+ -DSYSCONFDIR=\"$(sysconfdir)\" \
+ -DLIBEXECDIR=\"$(libexecdir)\" \
+ -DBIGTEMPDIR=\"/var/tmp\"
+EXTRA_DIST = Makefile.am.m4 files.m4 qa.hh.m4 testscriptlist srlist srcleanlist
+
diff --git a/0.8.0/paludis/qa/changelog_check.cc b/0.8.0/paludis/qa/changelog_check.cc
new file mode 100644
index 0000000..5aeb7ce
--- /dev/null
+++ b/0.8.0/paludis/qa/changelog_check.cc
@@ -0,0 +1,75 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <fstream>
+#include <paludis/qa/changelog_check.hh>
+#include <paludis/util/pstream.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+ChangeLogCheck::ChangeLogCheck()
+{
+}
+
+CheckResult
+ChangeLogCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ if (f.basename() != "ChangeLog")
+ result << Message(qal_skip, "Not a ChangeLog");
+ else if (! f.is_regular_file())
+ result << Message(qal_major, "Not a regular file");
+ else
+ {
+ std::ifstream ff(stringify(f).c_str());
+ do
+ {
+ if (! ff)
+ {
+ result << Message(qal_major, "Can't read ChangeLog");
+ continue;
+ }
+
+ std::string s;
+ if (! std::getline(ff, s))
+ {
+ result << Message(qal_major, "Can't read ChangeLog header");
+ continue;
+ }
+
+ if (s != "# ChangeLog for " + stringify(f.dirname().dirname().basename())
+ + "/" + stringify(f.dirname().basename()))
+ result << Message(qal_minor, "ChangeLog header is incorrect");
+ }
+ while (false);
+ }
+
+ return result;
+}
+
+const std::string &
+ChangeLogCheck::identifier()
+{
+ static const std::string id("changelog");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/changelog_check.hh b/0.8.0/paludis/qa/changelog_check.hh
new file mode 100644
index 0000000..72fade5
--- /dev/null
+++ b/0.8.0/paludis/qa/changelog_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_CHANGELOG_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_CHANGELOG_CHECK_HH 1
+
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class ChangeLogCheck :
+ public FileCheck
+ {
+ public:
+ ChangeLogCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that the ChangeLog is a regular file";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_changelog_check(
+ ChangeLogCheck::identifier(), &MakeFileCheck<ChangeLogCheck>::make_file_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/check.cc b/0.8.0/paludis/qa/check.cc
new file mode 100644
index 0000000..0d9c467
--- /dev/null
+++ b/0.8.0/paludis/qa/check.cc
@@ -0,0 +1,32 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+Check::Check()
+{
+}
+
+Check::~Check()
+{
+}
+
diff --git a/0.8.0/paludis/qa/check.hh b/0.8.0/paludis/qa/check.hh
new file mode 100644
index 0000000..82a9c47
--- /dev/null
+++ b/0.8.0/paludis/qa/check.hh
@@ -0,0 +1,60 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_CHECK_HH 1
+
+#include <paludis/util/instantiation_policy.hh>
+#include <string>
+
+/** \file
+ * Declarations for the paludis::qa::Check class.
+ *
+ * \ingroup QA
+ */
+
+namespace paludis
+{
+ namespace qa
+ {
+ /**
+ * Base class for a QA check.
+ *
+ * \ingroup QA
+ */
+ class PALUDIS_VISIBLE Check :
+ private InstantiationPolicy<Check, instantiation_method::NonCopyableTag>
+ {
+ protected:
+ Check();
+
+ virtual ~Check();
+
+ public:
+ virtual std::string describe() const = 0;
+
+ virtual bool is_important() const
+ {
+ return false;
+ }
+ };
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/check_result.cc b/0.8.0/paludis/qa/check_result.cc
new file mode 100644
index 0000000..0be8257
--- /dev/null
+++ b/0.8.0/paludis/qa/check_result.cc
@@ -0,0 +1,44 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/check_result.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+CheckResult::CheckResult(const FSEntry & f, const std::string & r) :
+ _item(stringify(f)),
+ _rule(r)
+{
+}
+
+CheckResult::CheckResult(const std::string & f, const std::string & r) :
+ _item(f),
+ _rule(r)
+{
+}
+
+QALevel
+CheckResult::most_severe_level() const
+{
+ QALevel result(static_cast<QALevel>(0));
+ for (Iterator i(begin()), i_end(end()) ; i != i_end ; ++i)
+ result = std::max(result, i->level);
+ return result;
+}
diff --git a/0.8.0/paludis/qa/check_result.hh b/0.8.0/paludis/qa/check_result.hh
new file mode 100644
index 0000000..c7f2717
--- /dev/null
+++ b/0.8.0/paludis/qa/check_result.hh
@@ -0,0 +1,93 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_CHECK_RESULT_HH
+#define PALUDIS_GUARD_PALUDIS_QA_CHECK_RESULT_HH 1
+
+#include <list>
+#include <paludis/qa/message.hh>
+#include <paludis/util/fs_entry.hh>
+
+/** \file
+ * Declarations for the CheckResult class.
+ *
+ * \ingroup QA
+ */
+
+namespace paludis
+{
+ namespace qa
+ {
+ /**
+ * The result of a QA check.
+ *
+ * \ingroup QA
+ */
+ class PALUDIS_VISIBLE CheckResult
+ {
+ private:
+ std::list<Message> _messages;
+
+ const std::string _item;
+ const std::string _rule;
+
+ public:
+ CheckResult(const FSEntry &, const std::string &);
+
+ CheckResult(const std::string &, const std::string &);
+
+ bool empty() const
+ {
+ return _messages.empty();
+ }
+
+ CheckResult & operator<< (const Message & m)
+ {
+ _messages.push_back(m);
+ return *this;
+ }
+
+ typedef std::list<Message>::const_iterator Iterator;
+
+ Iterator begin() const
+ {
+ return _messages.begin();
+ }
+
+ Iterator end() const
+ {
+ return _messages.end();
+ }
+
+ const std::string & item() const
+ {
+ return _item;
+ }
+
+ const std::string & rule() const
+ {
+ return _rule;
+ }
+
+ QALevel most_severe_level() const;
+ };
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/check_result_TEST.cc b/0.8.0/paludis/qa/check_result_TEST.cc
new file mode 100644
index 0000000..c8d0786
--- /dev/null
+++ b/0.8.0/paludis/qa/check_result_TEST.cc
@@ -0,0 +1,52 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/check_result.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct CheckResultTest : TestCase
+ {
+ CheckResultTest() : TestCase("check result") { }
+
+ void run()
+ {
+ CheckResult r(FSEntry("/"), "blah");
+ TEST_CHECK_EQUAL(r.item(), "/");
+ TEST_CHECK_EQUAL(r.rule(), "blah");
+ TEST_CHECK(r.empty());
+ TEST_CHECK_EQUAL(r.most_severe_level(), qal_info);
+ r << Message(qal_info, "moo");
+ TEST_CHECK(! r.empty());
+ TEST_CHECK_EQUAL(r.most_severe_level(), qal_info);
+ r << Message(qal_minor, "moo");
+ TEST_CHECK_EQUAL(r.most_severe_level(), qal_minor);
+ r << Message(qal_major, "moo");
+ TEST_CHECK_EQUAL(r.most_severe_level(), qal_major);
+ TEST_CHECK_EQUAL(std::distance(r.begin(), r.end()), 3);
+ }
+ } test_check_result;
+}
+
diff --git a/0.8.0/paludis/qa/create_metadata_check.cc b/0.8.0/paludis/qa/create_metadata_check.cc
new file mode 100644
index 0000000..4bd5627
--- /dev/null
+++ b/0.8.0/paludis/qa/create_metadata_check.cc
@@ -0,0 +1,67 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/create_metadata_check.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+CreateMetadataCheck::CreateMetadataCheck()
+{
+}
+
+CheckResult
+CreateMetadataCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ if ("UNKNOWN" == metadata->eapi)
+ result << Message(qal_fatal, "Couldn't generate metadata");
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+CreateMetadataCheck::identifier()
+{
+ static const std::string id("create_metadata");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/create_metadata_check.hh b/0.8.0/paludis/qa/create_metadata_check.hh
new file mode 100644
index 0000000..1460582
--- /dev/null
+++ b/0.8.0/paludis/qa/create_metadata_check.hh
@@ -0,0 +1,56 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_CREATE_METADATA_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_CREATE_METADATA_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class CreateMetadataCheck :
+ public EbuildCheck
+ {
+ public:
+ CreateMetadataCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that the metadata can be generated";
+ }
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_create_metadata_check(
+ CreateMetadataCheck::identifier(), &MakeEbuildCheck<CreateMetadataCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/defaults_check.cc b/0.8.0/paludis/qa/defaults_check.cc
new file mode 100644
index 0000000..052301c
--- /dev/null
+++ b/0.8.0/paludis/qa/defaults_check.cc
@@ -0,0 +1,154 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <fstream>
+#include <paludis/qa/defaults_check.hh>
+#include <paludis/util/is_file_with_extension.hh>
+#include <pcre++.h>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ enum State
+ {
+ st_default,
+ st_src_compile,
+ st_src_unpack
+ };
+}
+
+DefaultsCheck::DefaultsCheck()
+{
+}
+
+CheckResult
+DefaultsCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ static pcrepp::Pcre::Pcre r_echo("^\\s*(echo|einfo|ewarn)");
+ static pcrepp::Pcre::Pcre r_colon("^\\s*:");
+ static pcrepp::Pcre::Pcre r_true("^\\s*true");
+ static pcrepp::Pcre::Pcre r_comment("^\\s*#");
+ static pcrepp::Pcre::Pcre r_econf("^\\s*econf( *\\|\\| *die.*)?$");
+ static pcrepp::Pcre::Pcre r_emake("^\\s*emake( *\\|\\| *die.*)?$");
+ static pcrepp::Pcre::Pcre r_unpack("^\\s*unpack *([$]A|[$][{]A[}]|\"[$][{]A[}]\"|[$][{]A[}])( *\\|\\| *die.*)?$");
+ static pcrepp::Pcre::Pcre r_cd_s("^\\s*cd *([$]S|[$][{]S[}]|\"[$][{]S[}]\"|[$][{]S[}])( *\\|\\| *die.*)?$");
+
+ if (! f.is_regular_file())
+ result << Message(qal_skip, "Not a regular file");
+ else if (! IsFileWithExtension(".ebuild")(f))
+ result << Message(qal_skip, "Not an ebuild file");
+ else
+ {
+ std::ifstream ff(stringify(f).c_str());
+ if (! ff)
+ result << Message(qal_major, "Can't read file");
+ else
+ {
+ State state(st_default);
+ std::string line;
+ bool src_compile_changed(false), src_unpack_changed(false);
+
+ while (std::getline(ff, line))
+ {
+ switch (state)
+ {
+ case st_default:
+ {
+ if (line == "src_compile() {")
+ state = st_src_compile;
+ else if (line == "src_unpack() {")
+ state = st_src_unpack;
+ }
+ continue;
+
+ case st_src_compile:
+ {
+ if (line == "}")
+ {
+ state = st_default;
+ if (! src_compile_changed)
+ result << Message(qal_minor, "src_compile is redundant");
+ }
+ else if (line.empty())
+ ;
+ else if (r_econf.search(line))
+ ;
+ else if (r_emake.search(line))
+ ;
+ else if (r_echo.search(line))
+ ;
+ else if (r_colon.search(line))
+ ;
+ else if (r_true.search(line))
+ ;
+ else if (r_comment.search(line))
+ ;
+ else
+ src_compile_changed = true;
+ }
+ continue;
+
+ case st_src_unpack:
+ {
+ if (line == "}")
+ {
+ state = st_default;
+ if (! src_unpack_changed)
+ result << Message(qal_minor, "src_unpack is redundant");
+ }
+ else if (line.empty())
+ ;
+ else if (r_unpack.search(line))
+ ;
+ else if (r_cd_s.search(line))
+ ;
+ else if (r_echo.search(line))
+ ;
+ else if (r_colon.search(line))
+ ;
+ else if (r_true.search(line))
+ ;
+ else if (r_comment.search(line))
+ ;
+ else
+ src_unpack_changed = true;
+ }
+ continue;
+ }
+
+ throw InternalError(PALUDIS_HERE, "bad state");
+ }
+ }
+ }
+
+ return result;
+}
+
+const std::string &
+DefaultsCheck::identifier()
+{
+ static const std::string id("defaults");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/defaults_check.hh b/0.8.0/paludis/qa/defaults_check.hh
new file mode 100644
index 0000000..de1042e
--- /dev/null
+++ b/0.8.0/paludis/qa/defaults_check.hh
@@ -0,0 +1,53 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEFAULTS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEFAULTS_CHECK_HH 1
+
+#include <istream>
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DefaultsCheck :
+ public FileCheck
+ {
+ public:
+ DefaultsCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks for default function reimplementations";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_defaults_check(
+ DefaultsCheck::identifier(), &MakeFileCheck<DefaultsCheck>::make_file_check);
+ }
+}
+
+
+#endif
diff --git a/0.8.0/paludis/qa/defaults_check_TEST.cc b/0.8.0/paludis/qa/defaults_check_TEST.cc
new file mode 100644
index 0000000..c220889
--- /dev/null
+++ b/0.8.0/paludis/qa/defaults_check_TEST.cc
@@ -0,0 +1,60 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "check_result.hh"
+#include "defaults_check.hh"
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/join.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct DefaultsCheckSrcUnpackTest : TestCase
+ {
+ DefaultsCheckSrcUnpackTest() : TestCase("src_unpack") { }
+
+ void run()
+ {
+ FSEntry f1(FSEntry::cwd() / "defaults_check_TEST_dir/repo1/cat-one/pkg-one/pkg-one-1.ebuild");
+ TEST_CHECK(f1.is_regular_file());
+ CheckResult r1((*(*FileCheckMaker::get_instance()->find_maker(
+ DefaultsCheck::identifier()))())(f1));
+ {
+ TestMessageSuffix suffix("r1=" + r1.item() + ": " + join(r1.begin(), r1.end(), "; "), false);
+ TEST_CHECK(r1.empty());
+ }
+
+ FSEntry f2(FSEntry::cwd() / "defaults_check_TEST_dir/repo1/cat-one/pkg-one/pkg-one-2.ebuild");
+ TEST_CHECK(f2.is_regular_file());
+ CheckResult r2((*(*FileCheckMaker::get_instance()->find_maker(
+ DefaultsCheck::identifier()))())(f2));
+ {
+ TestMessageSuffix suffix("r2=" + r2.item() + ": " + join(r2.begin(), r2.end(), "; "), false);
+ TEST_CHECK(! r2.empty());
+ }
+ }
+ } qa_environment_defaults_check_src_unpack_test;
+}
+
+
diff --git a/0.8.0/paludis/qa/defaults_check_TEST_cleanup.sh b/0.8.0/paludis/qa/defaults_check_TEST_cleanup.sh
new file mode 100755
index 0000000..225d6fe
--- /dev/null
+++ b/0.8.0/paludis/qa/defaults_check_TEST_cleanup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d defaults_check_TEST_dir ] ; then
+ rm -fr defaults_check_TEST_dir
+else
+ true
+fi
+
+
+
+
diff --git a/0.8.0/paludis/qa/defaults_check_TEST_setup.sh b/0.8.0/paludis/qa/defaults_check_TEST_setup.sh
new file mode 100755
index 0000000..98d7cb9
--- /dev/null
+++ b/0.8.0/paludis/qa/defaults_check_TEST_setup.sh
@@ -0,0 +1,43 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir defaults_check_TEST_dir || exit 1
+cd defaults_check_TEST_dir || exit 1
+
+mkdir -p repo1/{eclass,distfiles,profiles/profile} || exit 1
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+cat-one
+cat-two
+cat-three
+END
+cat <<END > profiles/profile/make.defaults
+ARCH=test
+END
+cat <<END > profiles/profiles.desc
+test profile/ stable
+END
+mkdir -p cat-one/pkg-one
+cat <<"END" > cat-one/pkg-one/pkg-one-1.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+
+src_unpack() {
+ unpack "${A}"
+ cd "${S}"
+ epatch "${FILESDIR}"/${PN}-cookie.patch
+}
+END
+cat <<"END" > cat-one/pkg-one/pkg-one-2.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+
+src_unpack() {
+ :
+}
+END
+
+cd ..
+
+
diff --git a/0.8.0/paludis/qa/dep_any_check.cc b/0.8.0/paludis/qa/dep_any_check.cc
new file mode 100644
index 0000000..fc49cf4
--- /dev/null
+++ b/0.8.0/paludis/qa/dep_any_check.cc
@@ -0,0 +1,143 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/dep_any_check.hh>
+
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/dep_atom.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/util/iterator.hh>
+#include <paludis/util/save.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ const std::string role;
+ bool in_any;
+
+ Checker(CheckResult & rr, const std::string & r) :
+ result(rr),
+ role(r),
+ in_any(false)
+ {
+ }
+
+ void visit(const PackageDepAtom * const)
+ {
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ /* yes, the following line is correct. */
+ Save<bool> in_any_save(&in_any, false);
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ Save<bool> in_any_save(&in_any, true);
+ if (a->begin() == a->end())
+ result << Message(qal_minor, "Empty || ( ) block in " + role);
+ else
+ {
+ if (a->end() == next(a->begin()))
+ result << Message(qal_minor, "One item in || ( ) block in " + role);
+
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ if (in_any)
+ result << Message(qal_maybe, "Conditional on '" + stringify(u->flag()) +
+ "' inside || ( ) block in " + role);
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const PlainTextDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+ };
+
+ void Checker::visit(const PlainTextDepAtom * const t)
+ {
+ throw InternalError(PALUDIS_HERE, "Found unexpected PlainTextDepAtom '"
+ + t->text() + "'");
+ }
+}
+
+DepAnyCheck::DepAnyCheck()
+{
+}
+
+CheckResult
+DepAnyCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ Checker depend_checker(result, "DEPEND");
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_checker);
+
+ Checker rdepend_checker(result, "RDEPEND");
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
+
+ Checker pdepend_checker(result, "PDEPEND");
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+DepAnyCheck::identifier()
+{
+ static const std::string id("any_deps");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/dep_any_check.hh b/0.8.0/paludis/qa/dep_any_check.hh
new file mode 100644
index 0000000..e37df03
--- /dev/null
+++ b/0.8.0/paludis/qa/dep_any_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEP_ANY_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEP_ANY_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DepAnyCheck :
+ public EbuildCheck
+ {
+ public:
+ DepAnyCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks || ( ) block sanity in *DEPEND";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_dep_any_check(
+ DepAnyCheck::identifier(), &MakeEbuildCheck<DepAnyCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/dep_flags_check.cc b/0.8.0/paludis/qa/dep_flags_check.cc
new file mode 100644
index 0000000..04a34de
--- /dev/null
+++ b/0.8.0/paludis/qa/dep_flags_check.cc
@@ -0,0 +1,174 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/qa/dep_flags_check.hh>
+#include <paludis/util/tokeniser.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ const std::string role;
+ const Environment * const env;
+ const std::set<UseFlagName> & iuse;
+
+ Checker(CheckResult & rr, const std::string & r,
+ const Environment * const e, const std::set<UseFlagName> & i) :
+ result(rr),
+ role(r),
+ env(e),
+ iuse(i)
+ {
+ }
+
+ void visit(const PackageDepAtom * const)
+ {
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ Repository::ConstPointer r(env->package_database()->fetch_repository(env->package_database()->
+ favourite_repository()));
+
+ if (! r->use_interface)
+ throw InternalError(PALUDIS_HERE, "Confused: Repository does not have a UseInterface.");
+
+ if (r->use_interface->arch_flags()->count(u->flag()))
+ {
+ if (role == "DEPEND" || role == "RDEPEND" || role == "PDEPEND")
+ {
+ if (u->inverse())
+ result << Message(qal_maybe, "Inverse arch flag '" + stringify(u->flag()) +
+ "' in " + role);
+ }
+ else if (role != "SRC_URI")
+ result << Message(qal_major, "Arch flag '" + stringify(u->flag()) +
+ "' in " + role);
+ }
+ else if (r->use_interface->use_expand_flags()->count(u->flag()))
+ {
+ }
+ else if (iuse.end() == iuse.find(u->flag()))
+ result << Message(qal_major, "Conditional flag '" + stringify(u->flag()) +
+ "' in " + role + " not in IUSE");
+
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+ };
+}
+
+DepFlagsCheck::DepFlagsCheck()
+{
+}
+
+CheckResult
+DepFlagsCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ std::set<UseFlagName> iuse;
+ WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
+ iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+ iuse.insert(UseFlagName("bootstrap"));
+ iuse.insert(UseFlagName("build"));
+
+ Checker depend_checker(result, "DEPEND", e.environment, iuse);
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_checker);
+
+ Checker rdepend_checker(result, "RDEPEND", e.environment, iuse);
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
+
+ Checker pdepend_checker(result, "PDEPEND", e.environment, iuse);
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
+
+ Checker provide_checker(result, "PROVIDE", e.environment, iuse);
+ std::string provide(metadata->get_ebuild_interface()->provide_string);
+ PortageDepParser::parse(provide, PortageDepParserPolicy<PackageDepAtom, false>::get_instance())->accept(&provide_checker);
+
+ Checker license_checker(result, "LICENSE", e.environment, iuse);
+ std::string license(metadata->license_string);
+ PortageDepParser::parse(license, PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&license_checker);
+
+ Checker src_uri_checker(result, "SRC_URI", e.environment, iuse);
+ if (metadata->get_ebuild_interface() == 0)
+ result << Message(qal_fatal, "Not an ebuild");
+
+ std::string src_uri(metadata->get_ebuild_interface()->src_uri);
+
+ PortageDepParser::parse(src_uri, PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&src_uri_checker);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+DepFlagsCheck::identifier()
+{
+ static const std::string id("dep_flags");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/dep_flags_check.hh b/0.8.0/paludis/qa/dep_flags_check.hh
new file mode 100644
index 0000000..f8dbaaa
--- /dev/null
+++ b/0.8.0/paludis/qa/dep_flags_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEP_FLAGS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEP_FLAGS_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DepFlagsCheck :
+ public EbuildCheck
+ {
+ public:
+ DepFlagsCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks use? flags in metadata";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_dep_flags_check(
+ DepFlagsCheck::identifier(), &MakeEbuildCheck<DepFlagsCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/dep_packages_check.cc b/0.8.0/paludis/qa/dep_packages_check.cc
new file mode 100644
index 0000000..c629470
--- /dev/null
+++ b/0.8.0/paludis/qa/dep_packages_check.cc
@@ -0,0 +1,149 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/qa/dep_packages_check.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ const std::string role;
+ const std::set<QualifiedPackageName> & suspicious;
+
+ Checker(CheckResult & rr, const std::string & r, const std::set<QualifiedPackageName> & s) :
+ result(rr),
+ role(r),
+ suspicious(s)
+ {
+ }
+
+ void visit(const PackageDepAtom * const p)
+ {
+ if (suspicious.end() != suspicious.find(p->package()))
+ result << Message(qal_maybe, "Suspicious " + role + " entry '"
+ + stringify(p->package()) + "'");
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+ };
+}
+
+DepPackagesCheck::DepPackagesCheck()
+{
+}
+
+CheckResult
+DepPackagesCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ static std::set<QualifiedPackageName> suspicious_depend;
+ if (suspicious_depend.empty())
+ {
+ suspicious_depend.insert(QualifiedPackageName("virtual/libc"));
+ }
+
+ Checker depend_checker(result, "DEPEND", suspicious_depend);
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_checker);
+
+ static std::set<QualifiedPackageName> suspicious_rdepend;
+ if (suspicious_rdepend.empty())
+ {
+ suspicious_rdepend.insert(QualifiedPackageName("app-arch/rpm2targz"));
+ suspicious_rdepend.insert(QualifiedPackageName("app-arch/unzip"));
+ suspicious_rdepend.insert(QualifiedPackageName("dev-util/pkgconfig"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/autoconf"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/automake"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/flex"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/bison"));
+ suspicious_rdepend.insert(QualifiedPackageName("dev-util/yacc"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/gettext"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/libtool"));
+ suspicious_rdepend.insert(QualifiedPackageName("sys-devel/patch"));
+ suspicious_rdepend.insert(QualifiedPackageName("app-doc/doxygen"));
+ suspicious_rdepend.insert(QualifiedPackageName("x11-misc/imake"));
+ suspicious_rdepend.insert(QualifiedPackageName("media-gfx/ebdftopcf"));
+ suspicious_rdepend.insert(QualifiedPackageName("x11-apps/bdftopcf"));
+ suspicious_rdepend.insert(QualifiedPackageName("app-arch/cabextract"));
+ }
+
+ Checker rdepend_checker(result, "RDEPEND", suspicious_rdepend);
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+DepPackagesCheck::identifier()
+{
+ static const std::string id("depend_packages");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/dep_packages_check.hh b/0.8.0/paludis/qa/dep_packages_check.hh
new file mode 100644
index 0000000..577fda8
--- /dev/null
+++ b/0.8.0/paludis/qa/dep_packages_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEP_PACKAGES_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEP_PACKAGES_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DepPackagesCheck :
+ public EbuildCheck
+ {
+ public:
+ DepPackagesCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks for packages that usually should not be in *DEPEND";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_dep_packages_check(
+ DepPackagesCheck::identifier(), &MakeEbuildCheck<DepPackagesCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/deprecated_functions_check.cc b/0.8.0/paludis/qa/deprecated_functions_check.cc
new file mode 100644
index 0000000..3556820
--- /dev/null
+++ b/0.8.0/paludis/qa/deprecated_functions_check.cc
@@ -0,0 +1,82 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <fstream>
+#include <paludis/qa/deprecated_functions_check.hh>
+#include <paludis/util/is_file_with_extension.hh>
+#include <pcre++.h>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+DeprecatedFunctionsCheck::DeprecatedFunctionsCheck()
+{
+}
+
+CheckResult
+DeprecatedFunctionsCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ static pcrepp::Pcre::Pcre r_comment("^\\s*#");
+ static pcrepp::Pcre::Pcre r_check_kv("\\bcheck_KV\\b");
+
+ if (! f.is_regular_file())
+ result << Message(qal_skip, "Not a regular file");
+ else if (! IsFileWithExtension(".ebuild")(f) &&
+ ! IsFileWithExtension(".eclass")(f))
+ result << Message(qal_skip, "Not an ebuild or eclass file");
+ else
+ {
+ std::ifstream ff(stringify(f).c_str());
+ if (! ff)
+ result << Message(qal_major, "Can't read file");
+ else
+ {
+ std::string s;
+ unsigned line_number(0);
+ while (std::getline(ff, s))
+ {
+ ++line_number;
+
+ if (s.empty() || r_comment.search(s))
+ continue;
+
+ if (r_check_kv.search(s))
+ {
+ result << Message(qal_major, "Deprecated call to check_KV on line "
+ + stringify(line_number));
+ continue;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+const std::string &
+DeprecatedFunctionsCheck::identifier()
+{
+ static const std::string id("deprecated_functions");
+ return id;
+}
+
+
+
diff --git a/0.8.0/paludis/qa/deprecated_functions_check.hh b/0.8.0/paludis/qa/deprecated_functions_check.hh
new file mode 100644
index 0000000..042faa9
--- /dev/null
+++ b/0.8.0/paludis/qa/deprecated_functions_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEPRECATED_FUNCTIONS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEPRECATED_FUNCTIONS_CHECK_HH 1
+
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DeprecatedFunctionsCheck :
+ public FileCheck
+ {
+ public:
+ DeprecatedFunctionsCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks for deprecated functions";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_deprecated_functions_check(
+ DeprecatedFunctionsCheck::identifier(), &MakeFileCheck<DeprecatedFunctionsCheck>::make_file_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/deps_exist_check.cc b/0.8.0/paludis/qa/deps_exist_check.cc
new file mode 100644
index 0000000..cfb8aa7
--- /dev/null
+++ b/0.8.0/paludis/qa/deps_exist_check.cc
@@ -0,0 +1,139 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/qa/deps_exist_check.hh>
+#include <paludis/util/save.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ const std::string role;
+ const Environment * env;
+ bool in_any;
+
+ Checker(CheckResult & rr, const std::string & r, const Environment * e) :
+ result(rr),
+ role(r),
+ env(e),
+ in_any(false)
+ {
+ }
+
+ void visit(const PackageDepAtom * const p)
+ {
+ if (env->package_database()->query(PackageDepAtom::Pointer(new PackageDepAtom(p->package())), is_either)->empty())
+ {
+ if (in_any)
+ result << Message(qal_maybe, "No match for " + role + " entry '"
+ + stringify(*p) + "' inside || ( ) block");
+ else
+ result << Message(qal_major, "No match for " + role + " entry '"
+ + stringify(*p) + "'");
+ }
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ /// \todo VV make this smarter
+ Save<bool> save_in_any(&in_any, true);
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const b)
+ {
+ if (env->package_database()->query(b->blocked_atom(), is_either)->empty())
+ result << Message(qal_maybe, "No match for " + role + " block '!"
+ + stringify(*b->blocked_atom()) + "'");
+ }
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
+ };
+}
+
+DepsExistCheck::DepsExistCheck()
+{
+}
+
+CheckResult
+DepsExistCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ Checker depend_checker(result, "DEPEND", e.environment);
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_checker);
+
+ Checker rdepend_checker(result, "RDEPEND", e.environment);
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
+
+ Checker pdepend_checker(result, "PDEPEND", e.environment);
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+DepsExistCheck::identifier()
+{
+ static const std::string id("deps_exist");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/deps_exist_check.hh b/0.8.0/paludis/qa/deps_exist_check.hh
new file mode 100644
index 0000000..a860c2f
--- /dev/null
+++ b/0.8.0/paludis/qa/deps_exist_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEPS_EXIST_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEPS_EXIST_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DepsExistCheck :
+ public EbuildCheck
+ {
+ public:
+ DepsExistCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that packages in *DEPEND exist";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_deps_exist_check(
+ DepsExistCheck::identifier(), &MakeEbuildCheck<DepsExistCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/deps_visible_check.cc b/0.8.0/paludis/qa/deps_visible_check.cc
new file mode 100644
index 0000000..6869cef
--- /dev/null
+++ b/0.8.0/paludis/qa/deps_visible_check.cc
@@ -0,0 +1,142 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/deps_visible_check.hh>
+
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/dep_atom.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ const std::string role;
+ const Environment * env;
+
+ Checker(CheckResult & rr, const std::string & r, const Environment * e) :
+ result(rr),
+ role(r),
+ env(e)
+ {
+ }
+
+ void visit(const PackageDepAtom * const p)
+ {
+ bool found(false);
+ PackageDatabaseEntryCollection::Pointer matches(env->package_database()->query(PackageDepAtom::Pointer(new PackageDepAtom(p->package())),
+ is_either));
+ for (PackageDatabaseEntryCollection::ReverseIterator m(matches->rbegin()),
+ m_end(matches->rend()) ; m != m_end ; ++m)
+ {
+ if (env->mask_reasons(*m).any())
+ continue;
+
+ found = true;
+ break;
+ }
+
+ if (! found)
+ result << Message(qal_major, "No visible provider for " + role + " entry '"
+ + stringify(*p) + "'");
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const)
+ {
+ }
+
+ void visit(const UseDepAtom * const)
+ {
+ }
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
+ };
+}
+
+DepsVisibleCheck::DepsVisibleCheck()
+{
+}
+
+CheckResult
+DepsVisibleCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ if (e.environment->mask_reasons(ee).any())
+ result << Message(qal_skip, "Masked, so skipping checks");
+ else
+ {
+ Checker depend_checker(result, "DEPEND", e.environment);
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_checker);
+
+ Checker rdepend_checker(result, "RDEPEND", e.environment);
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_checker);
+
+ Checker pdepend_checker(result, "PDEPEND", e.environment);
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend)->accept(&pdepend_checker);
+ }
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+DepsVisibleCheck::identifier()
+{
+ static const std::string id("deps_visible");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/deps_visible_check.hh b/0.8.0/paludis/qa/deps_visible_check.hh
new file mode 100644
index 0000000..f85f7f3
--- /dev/null
+++ b/0.8.0/paludis/qa/deps_visible_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DEPS_VISIBLE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DEPS_VISIBLE_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DepsVisibleCheck :
+ public EbuildCheck
+ {
+ public:
+ DepsVisibleCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that packages in *DEPEND are visible";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_deps_visible_check(
+ DepsVisibleCheck::identifier(), &MakeEbuildCheck<DepsVisibleCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/description_check.cc b/0.8.0/paludis/qa/description_check.cc
new file mode 100644
index 0000000..74b311d
--- /dev/null
+++ b/0.8.0/paludis/qa/description_check.cc
@@ -0,0 +1,81 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/description_check.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <strings.h>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+DescriptionCheck::DescriptionCheck()
+{
+}
+
+CheckResult
+DescriptionCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ const std::string::size_type length(metadata->description.length());
+ if (0 == length)
+ result << Message(qal_major, "DESCRIPTION unset or empty");
+ else if (0 == strcasecmp(e.name.package.data().c_str(),
+ metadata->description.c_str()))
+ result << Message(qal_major, "DESCRIPTION equal to $PN? You can do better than that.");
+ else if (std::string::npos != metadata->description.find("Based on the") &&
+ std::string::npos != metadata->description.find("eclass"))
+ result << Message(qal_major, "DESCRIPTION is about as useful as a chocolate teapot");
+ else if (length < 10)
+ result << Message(qal_minor, "DESCRIPTION suspiciously short (" + stringify(length) + ")");
+ else if (length > 300)
+ result << Message(qal_minor, "DESCRIPTION written by Duncan? (" + stringify(length) + ")");
+ else if (length > 120)
+ result << Message(qal_minor, "DESCRIPTION too long (" + stringify(length) + ")");
+
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+DescriptionCheck::identifier()
+{
+ static const std::string id("description");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/description_check.hh b/0.8.0/paludis/qa/description_check.hh
new file mode 100644
index 0000000..58a0700
--- /dev/null
+++ b/0.8.0/paludis/qa/description_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DESCRIPTION_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DESCRIPTION_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DescriptionCheck :
+ public EbuildCheck
+ {
+ public:
+ DescriptionCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that DESCRIPTION is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_description_check(
+ DescriptionCheck::identifier(), &MakeEbuildCheck<DescriptionCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/digest_collisions_check.cc b/0.8.0/paludis/qa/digest_collisions_check.cc
new file mode 100644
index 0000000..204c7cd
--- /dev/null
+++ b/0.8.0/paludis/qa/digest_collisions_check.cc
@@ -0,0 +1,88 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <fstream>
+#include <map>
+#include <paludis/hashed_containers.hh>
+#include <paludis/qa/digest_collisions_check.hh>
+#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/is_file_with_extension.hh>
+#include <paludis/util/tokeniser.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ static MakeHashedMap<std::string, std::pair<std::string, FSEntry> >::Type digests;
+}
+
+DigestCollisionsCheck::DigestCollisionsCheck()
+{
+}
+
+CheckResult
+DigestCollisionsCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+
+ for (DirIterator i(d / "files") ; i != DirIterator() ; ++i)
+ {
+ if (! IsFileWithExtension("digest-", "")(*i))
+ continue;
+
+ std::fstream f(stringify(*i).c_str());
+ std::string line;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+ while (std::getline(f, line))
+ {
+ std::vector<std::string> entries;
+ tokeniser.tokenise(line, std::back_inserter(entries));
+
+ if (entries.size() != 4)
+ continue;
+
+ if ("MD5" != entries.at(0))
+ continue;
+
+ MakeHashedMap<std::string, std::pair<std::string, FSEntry> >::Type::iterator existing(
+ digests.find(entries.at(2)));
+ if (digests.end() != existing)
+ {
+ if (entries.at(1) != existing->second.first)
+ result << Message(qal_major, "Digest conflict on '" + entries.at(2) +
+ "' in '" + stringify(*i) +
+ "' (original was '" + stringify(existing->second.second) + "')");
+ }
+ else
+ digests.insert(std::make_pair(entries.at(2), std::make_pair(entries.at(1), *i)));
+ }
+ }
+
+ return result;
+}
+
+const std::string &
+DigestCollisionsCheck::identifier()
+{
+ static const std::string id("digest_collisions");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/digest_collisions_check.hh b/0.8.0/paludis/qa/digest_collisions_check.hh
new file mode 100644
index 0000000..d8fe441
--- /dev/null
+++ b/0.8.0/paludis/qa/digest_collisions_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_DIGEST_COLLISIONS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_DIGEST_COLLISIONS_CHECK_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class DigestCollisionsCheck :
+ public PackageDirCheck
+ {
+ public:
+ DigestCollisionsCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks for digest collisions";
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_digest_collisions_check(
+ DigestCollisionsCheck::identifier(), &MakePackageDirCheck<DigestCollisionsCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/ebuild_check.cc b/0.8.0/paludis/qa/ebuild_check.cc
new file mode 100644
index 0000000..32dd3ad
--- /dev/null
+++ b/0.8.0/paludis/qa/ebuild_check.cc
@@ -0,0 +1,35 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/ebuild_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+#include <paludis/qa/ebuild_check-sr.cc>
+
+EbuildCheck::EbuildCheck()
+{
+}
+
+NoSuchEbuildCheckTypeError::NoSuchEbuildCheckTypeError(const std::string & s) throw () :
+ Exception("No such ebuild check type: '" + s + "'")
+{
+}
+
diff --git a/0.8.0/paludis/qa/ebuild_check.hh b/0.8.0/paludis/qa/ebuild_check.hh
new file mode 100644
index 0000000..330d8a4
--- /dev/null
+++ b/0.8.0/paludis/qa/ebuild_check.hh
@@ -0,0 +1,75 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_EBUILD_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_EBUILD_CHECK_HH 1
+
+#include <paludis/name.hh>
+#include <paludis/qa/check.hh>
+#include <paludis/qa/check_result.hh>
+#include <paludis/util/counted_ptr.hh>
+#include <paludis/util/virtual_constructor.hh>
+#include <paludis/version_spec.hh>
+
+namespace paludis
+{
+ class Environment;
+
+ namespace qa
+ {
+
+#include <paludis/qa/ebuild_check-sr.hh>
+
+ class PALUDIS_VISIBLE EbuildCheck :
+ public Check,
+ public InternalCounted<EbuildCheck>
+ {
+ protected:
+ EbuildCheck();
+
+ public:
+ virtual CheckResult operator() (const EbuildCheckData &) const = 0;
+ };
+
+ class PALUDIS_VISIBLE NoSuchEbuildCheckTypeError :
+ public Exception
+ {
+ public:
+ NoSuchEbuildCheckTypeError(const std::string &) throw ();
+ };
+
+ /* icc stupidity workaround */
+ template <typename T_>
+ struct MakeEbuildCheck
+ {
+ static EbuildCheck::Pointer
+ make_ebuild_check()
+ {
+ return EbuildCheck::Pointer(new T_);
+ }
+ };
+
+ typedef VirtualConstructor<
+ std::string,
+ EbuildCheck::Pointer (*) (),
+ virtual_constructor_not_found::ThrowException<NoSuchEbuildCheckTypeError> > EbuildCheckMaker;
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/ebuild_check.sr b/0.8.0/paludis/qa/ebuild_check.sr
new file mode 100644
index 0000000..c5248dd
--- /dev/null
+++ b/0.8.0/paludis/qa/ebuild_check.sr
@@ -0,0 +1,10 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_EbuildCheckData()
+{
+ key name QualifiedPackageName
+ key version VersionSpec
+ key environment "const Environment *"
+}
+
diff --git a/0.8.0/paludis/qa/ebuild_count_check.cc b/0.8.0/paludis/qa/ebuild_count_check.cc
new file mode 100644
index 0000000..b33f612
--- /dev/null
+++ b/0.8.0/paludis/qa/ebuild_count_check.cc
@@ -0,0 +1,58 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <algorithm>
+#include <paludis/qa/ebuild_count_check.hh>
+#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/is_file_with_extension.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+EbuildCountCheck::EbuildCountCheck()
+{
+}
+
+CheckResult
+EbuildCountCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+
+ std::size_t count(std::count_if(DirIterator(d), DirIterator(), IsFileWithExtension(".ebuild")));
+ if (count > 20)
+ result << Message(qal_minor, "Found " + stringify(count) +
+ " ebuilds, which is too many to count on both hands and both feet");
+ else if (count > 15)
+ result << Message(qal_minor, "Found " + stringify(count) +
+ " ebuilds, which is too many to count on both hands and one foot");
+ else if (count > 10)
+ result << Message(qal_minor, "Found " + stringify(count) +
+ " ebuilds, which is too many to count on my fingers");
+
+ return result;
+}
+
+const std::string &
+EbuildCountCheck::identifier()
+{
+ static const std::string id("ebuild count");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/ebuild_count_check.hh b/0.8.0/paludis/qa/ebuild_count_check.hh
new file mode 100644
index 0000000..4a5fded
--- /dev/null
+++ b/0.8.0/paludis/qa/ebuild_count_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_EBUILD_COUNT_HH
+#define PALUDIS_GUARD_PALUDIS_QA_EBUILD_COUNT_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class EbuildCountCheck :
+ public PackageDirCheck
+ {
+ public:
+ EbuildCountCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks for a sane number of ebuilds";
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_ebuild_count_check(
+ EbuildCountCheck::identifier(), &MakePackageDirCheck<EbuildCountCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/extract_check.cc b/0.8.0/paludis/qa/extract_check.cc
new file mode 100644
index 0000000..5228616
--- /dev/null
+++ b/0.8.0/paludis/qa/extract_check.cc
@@ -0,0 +1,128 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/qa/extract_check.hh>
+#include <paludis/util/tokeniser.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ bool need_zip;
+ bool have_zip;
+
+ Checker() :
+ need_zip(false),
+ have_zip(false)
+ {
+ }
+
+ void visit(const PlainTextDepAtom * const a)
+ {
+ if (a->text().length() >= 4)
+ if (a->text().substr(a->text().length() - 4) == ".zip")
+ need_zip = true;
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+
+ void visit(const PackageDepAtom * const p)
+ {
+ if (p->package() == QualifiedPackageName("app-arch/unzip"))
+ have_zip = true;
+ }
+ };
+}
+
+ExtractCheck::ExtractCheck()
+{
+}
+
+CheckResult
+ExtractCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ do
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ Checker checker;
+ PortageDepParser::parse(metadata->get_ebuild_interface()->src_uri,
+ PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance())->accept(&checker);
+ PortageDepParser::parse(metadata->deps.build_depend_string)->accept(&checker);
+
+ if (checker.need_zip && ! checker.have_zip)
+ result << Message(qal_major, "Found .zip in SRC_URI but app-arch/unzip is not in DEPEND");
+
+ } while (false);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+ExtractCheck::identifier()
+{
+ static const std::string id("extract");
+ return id;
+}
+
+
+
diff --git a/0.8.0/paludis/qa/extract_check.hh b/0.8.0/paludis/qa/extract_check.hh
new file mode 100644
index 0000000..7248542
--- /dev/null
+++ b/0.8.0/paludis/qa/extract_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_EXTRACT_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_EXTRACT_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class ExtractCheck :
+ public EbuildCheck
+ {
+ public:
+ ExtractCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that extraction dependencies are correct";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_extract_check(
+ ExtractCheck::identifier(), &MakeEbuildCheck<ExtractCheck>::make_ebuild_check);
+ }
+}
+
+
+#endif
diff --git a/0.8.0/paludis/qa/file_check.cc b/0.8.0/paludis/qa/file_check.cc
new file mode 100644
index 0000000..7af87cd
--- /dev/null
+++ b/0.8.0/paludis/qa/file_check.cc
@@ -0,0 +1,33 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/file_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+FileCheck::FileCheck()
+{
+}
+
+NoSuchFileCheckTypeError::NoSuchFileCheckTypeError(const std::string & s) throw () :
+ Exception("No such file check type: '" + s + "'")
+{
+}
+
diff --git a/0.8.0/paludis/qa/file_check.hh b/0.8.0/paludis/qa/file_check.hh
new file mode 100644
index 0000000..fd07fca
--- /dev/null
+++ b/0.8.0/paludis/qa/file_check.hh
@@ -0,0 +1,86 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_FILE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_FILE_CHECK_HH 1
+
+#include <paludis/qa/check.hh>
+#include <paludis/qa/check_result.hh>
+#include <paludis/util/counted_ptr.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/virtual_constructor.hh>
+
+/** \file
+ * Declarations for the FileCheck class.
+ *
+ * \ingroup QA
+ */
+
+namespace paludis
+{
+ namespace qa
+ {
+ /**
+ * A QA check that operates upon a file.
+ *
+ * \ingroup QA
+ */
+ class PALUDIS_VISIBLE FileCheck :
+ public Check,
+ public InternalCounted<FileCheck>
+ {
+ protected:
+ FileCheck();
+
+ public:
+ virtual CheckResult operator() (const FSEntry &) const = 0;
+ };
+
+ class PALUDIS_VISIBLE NoSuchFileCheckTypeError :
+ public Exception
+ {
+ public:
+ NoSuchFileCheckTypeError(const std::string &) throw ();
+ };
+
+ /* Do not turn this into a straight function. It makes icc cry. */
+ template <typename T_>
+ struct MakeFileCheck
+ {
+ static FileCheck::Pointer make_file_check();
+ };
+
+ typedef VirtualConstructor<
+ std::string,
+ FileCheck::Pointer (*) (),
+ virtual_constructor_not_found::ThrowException<NoSuchFileCheckTypeError> > FileCheckMaker;
+ }
+
+}
+
+template <typename T_>
+paludis::qa::FileCheck::Pointer
+paludis::qa::MakeFileCheck<T_>::make_file_check()
+{
+ return paludis::qa::FileCheck::Pointer(new T_);
+}
+
+
+#endif
diff --git a/0.8.0/paludis/qa/file_permissions_check.cc b/0.8.0/paludis/qa/file_permissions_check.cc
new file mode 100644
index 0000000..adcb6af
--- /dev/null
+++ b/0.8.0/paludis/qa/file_permissions_check.cc
@@ -0,0 +1,60 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/file_permissions_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+FilePermissionsCheck::FilePermissionsCheck()
+{
+}
+
+CheckResult
+FilePermissionsCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ if (f.is_directory())
+ {
+ if (! f.has_permission(fs_ug_owner, fs_perm_read))
+ result << Message(qal_minor, "Directory owner does not have read permission");
+
+ if (! f.has_permission(fs_ug_owner, fs_perm_execute))
+ result << Message(qal_minor, "Directory owner does not have execute permission");
+ }
+ else
+ {
+ if (! f.has_permission(fs_ug_owner, fs_perm_read))
+ result << Message(qal_minor, "File owner does not have read permission");
+
+ if (f.has_permission(fs_ug_owner, fs_perm_execute))
+ result << Message(qal_minor, "File owner has execute permission");
+ }
+
+ return result;
+}
+
+const std::string &
+FilePermissionsCheck::identifier()
+{
+ static const std::string id("file_permissions");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/file_permissions_check.hh b/0.8.0/paludis/qa/file_permissions_check.hh
new file mode 100644
index 0000000..d6d6f8c
--- /dev/null
+++ b/0.8.0/paludis/qa/file_permissions_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_FILE_PERMISSIONS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_FILE_PERMISSIONS_CHECK_HH 1
+
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class FilePermissionsCheck :
+ public FileCheck
+ {
+ public:
+ FilePermissionsCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that file and directory permissions are sane";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_file_permissions_check(
+ FilePermissionsCheck::identifier(), &MakeFileCheck<FilePermissionsCheck>::make_file_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/file_permissions_check_TEST.cc b/0.8.0/paludis/qa/file_permissions_check_TEST.cc
new file mode 100644
index 0000000..b86a5ea
--- /dev/null
+++ b/0.8.0/paludis/qa/file_permissions_check_TEST.cc
@@ -0,0 +1,90 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/file_permissions_check.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct FilePermissionsCheckFileTest : TestCase
+ {
+ FilePermissionsCheckFileTest() : TestCase("file permissions file") { }
+
+ void run()
+ {
+ FSEntry e("file_permissions_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "ok_file");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*FileCheckMaker::get_instance()->find_maker(
+ FilePermissionsCheck::identifier()))())(f1));
+ TEST_CHECK(r1.empty());
+
+ FSEntry f2(e / "no_read_file");
+ TEST_CHECK(f2.exists());
+ CheckResult r2((*(*FileCheckMaker::get_instance()->find_maker(
+ FilePermissionsCheck::identifier()))())(f2));
+ TEST_CHECK(! r2.empty());
+
+ FSEntry f3(e / "exec_file");
+ TEST_CHECK(f3.exists());
+ CheckResult r3((*(*FileCheckMaker::get_instance()->find_maker(
+ FilePermissionsCheck::identifier()))())(f3));
+ TEST_CHECK(! r3.empty());
+ }
+ } test_file_permissions_check_file;
+
+ struct FilePermissionsCheckDirTest : TestCase
+ {
+ FilePermissionsCheckDirTest() : TestCase("file permissions dir") { }
+
+ void run()
+ {
+ FSEntry e("file_permissions_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "ok_dir");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*FileCheckMaker::get_instance()->find_maker(
+ FilePermissionsCheck::identifier()))())(f1));
+ TEST_CHECK(r1.empty());
+
+ FSEntry f2(e / "no_read_dir");
+ TEST_CHECK(f2.exists());
+ CheckResult r2((*(*FileCheckMaker::get_instance()->find_maker(
+ FilePermissionsCheck::identifier()))())(f2));
+ TEST_CHECK(! r2.empty());
+
+ FSEntry f3(e / "no_exec_dir");
+ TEST_CHECK(f3.exists());
+ CheckResult r3((*(*FileCheckMaker::get_instance()->find_maker(
+ FilePermissionsCheck::identifier()))())(f3));
+ TEST_CHECK(! r3.empty());
+ }
+ } test_file_permissions_check_dir;
+}
+
diff --git a/0.8.0/paludis/qa/file_permissions_check_TEST_cleanup.sh b/0.8.0/paludis/qa/file_permissions_check_TEST_cleanup.sh
new file mode 100755
index 0000000..f86f9cc
--- /dev/null
+++ b/0.8.0/paludis/qa/file_permissions_check_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d file_permissions_check_TEST_dir ] ; then
+ chmod -R +rX file_permissions_check_TEST_dir
+ rm -fr file_permissions_check_TEST_dir
+else
+ true
+fi
+
+
diff --git a/0.8.0/paludis/qa/file_permissions_check_TEST_setup.sh b/0.8.0/paludis/qa/file_permissions_check_TEST_setup.sh
new file mode 100755
index 0000000..221286d
--- /dev/null
+++ b/0.8.0/paludis/qa/file_permissions_check_TEST_setup.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir file_permissions_check_TEST_dir || exit 2
+cd file_permissions_check_TEST_dir || exit 3
+
+touch ok_file no_read_file exec_file || exit 4
+chmod -r no_read_file || exit 5
+chmod +x exec_file || exit 6
+
+mkdir ok_dir no_read_dir no_exec_dir || exit 7
+chmod -r no_read_dir || exit 8
+chmod -x no_exec_dir || exit 9
+
diff --git a/0.8.0/paludis/qa/filename_check.cc b/0.8.0/paludis/qa/filename_check.cc
new file mode 100644
index 0000000..6c12690
--- /dev/null
+++ b/0.8.0/paludis/qa/filename_check.cc
@@ -0,0 +1,52 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/filename_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+FileNameCheck::FileNameCheck()
+{
+}
+
+CheckResult
+FileNameCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ static const std::string allowed(
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "0123456789"
+ "+-_.:");
+
+ if (std::string::npos != f.basename().find_first_not_of(allowed))
+ result << Message(qal_major, "Illegal filename");
+
+ return result;
+}
+
+const std::string &
+FileNameCheck::identifier()
+{
+ static const std::string id("filename");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/filename_check.hh b/0.8.0/paludis/qa/filename_check.hh
new file mode 100644
index 0000000..3b4b7b0
--- /dev/null
+++ b/0.8.0/paludis/qa/filename_check.hh
@@ -0,0 +1,56 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_FILE_NAME_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_FILE_NAME_CHECK_HH 1
+
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class FileNameCheck :
+ public FileCheck
+ {
+ public:
+ FileNameCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that the file name is legal";
+ }
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_file_name_check(
+ FileNameCheck::identifier(), &MakeFileCheck<FileNameCheck>::make_file_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/files.m4 b/0.8.0/paludis/qa/files.m4
new file mode 100644
index 0000000..7d142c7
--- /dev/null
+++ b/0.8.0/paludis/qa/files.m4
@@ -0,0 +1,52 @@
+dnl vim: set ft=m4 et :
+dnl This file is used by Makefile.am.m4 and qa.hh.m4. You should
+dnl use the provided autogen.bash script to do all the hard work.
+dnl
+dnl This file is used to avoid having to make lots of repetitive changes in
+dnl Makefile.am every time we add a source or test file. The first parameter is
+dnl the base filename with no extension; later parameters can be `hh', `cc',
+dnl `test', `impl', `testscript'. Note that there isn't much error checking done
+dnl on this file at present...
+
+add(`changelog_check', `hh', `cc')
+add(`check', `hh', `cc')
+add(`check_result', `hh', `cc', `test')
+add(`create_metadata_check', `hh', `cc')
+add(`defaults_check', `hh', `cc', `test', `testscript')
+add(`dep_any_check', `hh', `cc')
+add(`dep_flags_check', `hh', `cc')
+add(`dep_packages_check', `hh', `cc')
+add(`deprecated_functions_check', `hh', `cc')
+add(`deps_exist_check', `hh', `cc')
+add(`deps_visible_check', `hh', `cc')
+add(`description_check', `hh', `cc')
+add(`digest_collisions_check', `hh', `cc')
+add(`ebuild_check', `hh', `cc', `sr')
+add(`ebuild_count_check', `hh', `cc')
+add(`extract_check', `hh', `cc')
+add(`file_check', `hh', `cc')
+add(`filename_check', `hh', `cc')
+add(`file_permissions_check', `hh', `cc', `test', `testscript')
+add(`files_dir_size_check', `hh', `cc')
+add(`glep_31_check', `hh', `cc', `test')
+add(`gpg_check', `hh', `cc', `test', `testscript')
+add(`has_ebuilds_check', `hh', `cc', `test', `testscript')
+add(`has_misc_files_check', `hh', `cc', `test', `testscript')
+add(`homepage_check', `hh', `cc')
+add(`inherits_check', `hh', `cc')
+add(`iuse_check', `hh', `cc')
+add(`keywords_check', `hh', `cc')
+add(`license_check', `hh', `cc')
+add(`message', `hh', `cc', `sr', `test')
+add(`metadata_check', `hh', `cc')
+add(`metadata_file', `hh', `cc', `test')
+add(`package_dir_check', `hh', `cc')
+add(`package_name_check', `hh', `cc', `test', `testscript')
+add(`parse_deps_check', `hh', `cc')
+add(`qa_environment', `hh', `cc', `test', `testscript', `sr')
+add(`restrict_check', `hh', `cc')
+add(`src_uri_check', `hh', `cc')
+add(`pdepend_overlap_check', `hh', `cc')
+add(`qa', `hh', `cc')
+add(`slot_check', `hh', `cc')
+add(`whitespace_check', `hh', `cc')
diff --git a/0.8.0/paludis/qa/files_dir_size_check.cc b/0.8.0/paludis/qa/files_dir_size_check.cc
new file mode 100644
index 0000000..bcc03e6
--- /dev/null
+++ b/0.8.0/paludis/qa/files_dir_size_check.cc
@@ -0,0 +1,87 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/files_dir_size_check.hh>
+
+#include <paludis/util/is_file_with_extension.hh>
+#include <paludis/util/dir_iterator.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+FilesDirSizeCheck::FilesDirSizeCheck()
+{
+}
+
+CheckResult
+FilesDirSizeCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+
+ if (! (d / "files").exists())
+ result << Message(qal_skip, "No files/ found");
+
+ struct SizeFinder
+ {
+ off_t total_size;
+
+ SizeFinder() :
+ total_size(0)
+ {
+ }
+
+ void operator() (const FSEntry & f)
+ {
+ if (f.basename() == "CVS" || '.' == f.basename().at(0))
+ return;
+
+ if (f.is_directory())
+ {
+ for (DirIterator ff(f), ff_end ; ff != ff_end ; ++ff)
+ operator() (*ff);
+ }
+ else if (f.is_regular_file())
+ {
+ if (0 != f.basename().compare(0, 7, "digest-"))
+ total_size += f.file_size();
+ }
+ }
+ };
+
+ SizeFinder f;
+ f(d / "files");
+
+ if (f.total_size > (100 * 1024))
+ result << Message(qal_minor, "files/ is way too bloated (" +
+ stringify(f.total_size / 1024) + "KBytes, excluding digests and CVS)");
+ else if (f.total_size > (20 * 1024))
+ result << Message(qal_minor, "files/ is oversized (" +
+ stringify(f.total_size / 1024) + "KBytes, excluding digests and CVS)");
+
+
+ return result;
+}
+
+const std::string &
+FilesDirSizeCheck::identifier()
+{
+ static const std::string id("files_dir_size");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/files_dir_size_check.hh b/0.8.0/paludis/qa/files_dir_size_check.hh
new file mode 100644
index 0000000..29af68f
--- /dev/null
+++ b/0.8.0/paludis/qa/files_dir_size_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_FILES_DIR_SIZE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_FILES_DIR_SIZE_CHECK_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class FilesDirSizeCheck :
+ public PackageDirCheck
+ {
+ public:
+ FilesDirSizeCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that files/ (excluding digests) is below 20k";
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_files_dir_size_check(
+ FilesDirSizeCheck::identifier(), &MakePackageDirCheck<FilesDirSizeCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/glep_31_check.cc b/0.8.0/paludis/qa/glep_31_check.cc
new file mode 100644
index 0000000..01c95ca
--- /dev/null
+++ b/0.8.0/paludis/qa/glep_31_check.cc
@@ -0,0 +1,126 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <fstream>
+#include <paludis/qa/glep_31_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+void
+Glep31Check::check_utf8(std::istream & f, CheckResult & r)
+{
+ struct BadChar
+ {
+ };
+
+ int c, line_number(1);
+ try
+ {
+ while (std::istream::traits_type::eof() != ((c = f.get())))
+ {
+ if (c < 0)
+ throw BadChar();
+
+ else if (c > 0x7e && (((c & 0xe0) == 0xc0)))
+ {
+ if (std::istream::traits_type::eof() == ((c = f.get())))
+ throw BadChar();
+
+ if ((c & 0xc0) != 0x80)
+ throw BadChar();
+ }
+ else if (c > 0x7e && (((c & 0xf0) == 0xe0)))
+ {
+ if (std::istream::traits_type::eof() == ((c = f.get())))
+ throw BadChar();
+
+ if ((c & 0xc0) != 0x80)
+ throw BadChar();
+
+ if (std::istream::traits_type::eof() == ((c = f.get())))
+ throw BadChar();
+
+ if ((c & 0xc0) != 0x80)
+ throw BadChar();
+ }
+ else if (c > 0x7e && (((c & 0xf8) == 0xf0)))
+ {
+ if (std::istream::traits_type::eof() == ((c = f.get())))
+ throw BadChar();
+
+ if ((c & 0xc0) != 0x80)
+ throw BadChar();
+
+ if (std::istream::traits_type::eof() == ((c = f.get())))
+ throw BadChar();
+
+ if ((c & 0xc0) != 0x80)
+ throw BadChar();
+
+ if (std::istream::traits_type::eof() == ((c = f.get())))
+ throw BadChar();
+
+ if ((c & 0xc0) != 0x80)
+ throw BadChar();
+ }
+ else if ('\n' == c)
+ ++line_number;
+ else if (c <= 0x7e)
+ ;
+ else
+ throw BadChar();
+ }
+ }
+ catch (const BadChar &)
+ {
+ r << Message(qal_major, "Bad character on line " + stringify(line_number));
+ }
+}
+
+Glep31Check::Glep31Check()
+{
+}
+
+CheckResult
+Glep31Check::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ if (! f.is_regular_file())
+ result << Message(qal_skip, "Not a regular file");
+ else
+ {
+ std::ifstream ff(stringify(f).c_str());
+ if (! ff)
+ result << Message(qal_major, "Can't read file");
+ else
+ check_utf8(ff, result);
+ }
+
+ return result;
+}
+
+const std::string &
+Glep31Check::identifier()
+{
+ static const std::string id("glep_31");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/glep_31_check.hh b/0.8.0/paludis/qa/glep_31_check.hh
new file mode 100644
index 0000000..094334c
--- /dev/null
+++ b/0.8.0/paludis/qa/glep_31_check.hh
@@ -0,0 +1,55 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_GLEP_31_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_GLEP_31_CHECK_HH 1
+
+#include <istream>
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class Glep31Check :
+ public FileCheck
+ {
+ public:
+ Glep31Check();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ static void check_utf8(std::istream &, CheckResult &);
+
+ virtual std::string describe() const
+ {
+ return "Checks that files conform to GLEP 31";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_glep_31_check(
+ Glep31Check::identifier(), &MakeFileCheck<Glep31Check>::make_file_check);
+ }
+}
+
+
+#endif
diff --git a/0.8.0/paludis/qa/glep_31_check_TEST.cc b/0.8.0/paludis/qa/glep_31_check_TEST.cc
new file mode 100644
index 0000000..e372482
--- /dev/null
+++ b/0.8.0/paludis/qa/glep_31_check_TEST.cc
@@ -0,0 +1,77 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/glep_31_check.hh>
+#include <sstream>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct Utf8Test : TestCase
+ {
+ Utf8Test() : TestCase("utf8") { }
+
+ void check_valid(const std::string & s)
+ {
+ std::stringstream ss(s);
+ CheckResult r("glep_31_check_TEST.cc", "test");
+ TEST_CHECK(r.empty());
+ Glep31Check::check_utf8(ss, r);
+ TEST_CHECK(r.empty());
+ }
+
+ void check_invalid(const std::string & s)
+ {
+ std::stringstream ss(s);
+ CheckResult r("glep_31_check_TEST.cc", "test");
+ TEST_CHECK(r.empty());
+ Glep31Check::check_utf8(ss, r);
+ TEST_CHECK(! r.empty());
+ }
+
+ void run()
+ {
+ check_valid("");
+ check_valid("abcde");
+ check_valid("abc""\xc2""\xa3""de");
+ check_valid("abc""\xd7""\x90""de");
+ check_valid("abc""\xe2""\x82""\xac""de");
+ check_valid("abc""\xf0""\xa1""\xa1""\xa1""de");
+
+ check_invalid("abc""\xff""de");
+ check_invalid("abc""\xc2""\x2a""de");
+ check_invalid("abc""\xe1""\x2a""\x2a""de");
+ check_invalid("abc""\xe1""\xaa""\x2a""de");
+ check_invalid("abc""\xf0""\x2a""\x2a""\x2a""de");
+ check_invalid("abc""\xf0""\xaa""\x2a""\x2a""de");
+ check_invalid("abc""\xf0""\xa1""\xa1""\x2a""de");
+
+ check_invalid("abc""\xc2");
+ check_invalid("abc""\xd7");
+ check_invalid("abc""\xe2""\x82");
+ check_invalid("abc""\xf0""\xa1""\xa1");
+ }
+ } test_utf8;
+}
+
diff --git a/0.8.0/paludis/qa/gpg_check.cc b/0.8.0/paludis/qa/gpg_check.cc
new file mode 100644
index 0000000..c93e2cc
--- /dev/null
+++ b/0.8.0/paludis/qa/gpg_check.cc
@@ -0,0 +1,62 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Fernando J. Pereda <ferdy@gentoo.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 <paludis/qa/gpg_check.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/fd_holder.hh>
+
+#include <iostream>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+GPGCheck::GPGCheck()
+{
+}
+
+CheckResult
+GPGCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+ FSEntry manifest(d / "Manifest");
+ FDHolder dev_null(::open("/dev/null", O_WRONLY));
+
+ set_run_command_stdout_fds(dev_null, -1);
+ set_run_command_stderr_fds(dev_null, -1);
+
+ int status(run_command("gpg --verify " + stringify(manifest)));
+
+ if (1 == status)
+ result << Message(qal_major, "Broken Manifest signature");
+ else if (2 == status)
+ result << Message(qal_minor, "Manifest not signed");
+
+ return result;
+}
+
+const std::string &
+GPGCheck::identifier()
+{
+ static const std::string id("gpg");
+ return id;
+}
diff --git a/0.8.0/paludis/qa/gpg_check.hh b/0.8.0/paludis/qa/gpg_check.hh
new file mode 100644
index 0000000..7ada6eb
--- /dev/null
+++ b/0.8.0/paludis/qa/gpg_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Fernando J. Pereda <ferdy@gentoo.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_QA_GPG_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_GPG_CHECK_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class GPGCheck :
+ public PackageDirCheck
+ {
+ public:
+ GPGCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks whether the Manifest is signed";
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_gpg_check(
+ GPGCheck::identifier(), &MakePackageDirCheck<GPGCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/gpg_check_TEST.cc b/0.8.0/paludis/qa/gpg_check_TEST.cc
new file mode 100644
index 0000000..6851cde
--- /dev/null
+++ b/0.8.0/paludis/qa/gpg_check_TEST.cc
@@ -0,0 +1,65 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Fernando J. Pereda <ferdy@gentoo.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 <paludis/qa/gpg_check.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/fd_holder.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct GPGCheckTest : TestCase
+ {
+ GPGCheckTest() : TestCase("signed Manifest") { }
+
+ bool skip() const
+ {
+ FDHolder dev_null(::open("/dev/null", O_WRONLY));
+ set_run_command_stdout_fds(dev_null, -1);
+ set_run_command_stderr_fds(dev_null, -1);
+
+ return (0 != run_command("gpg --help"));
+ }
+
+ void run()
+ {
+ FSEntry e("gpg_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry package(e / "cat" / "not-signed");
+ TEST_CHECK(package.exists());
+ TEST_CHECK(package.is_directory());
+
+ CheckResult r((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ GPGCheck::identifier()))())(package));
+ TEST_CHECK(! r.empty());
+
+ }
+ } test_gpg_check;
+}
diff --git a/0.8.0/paludis/qa/gpg_check_TEST_cleanup.sh b/0.8.0/paludis/qa/gpg_check_TEST_cleanup.sh
new file mode 100755
index 0000000..ed3dd8e
--- /dev/null
+++ b/0.8.0/paludis/qa/gpg_check_TEST_cleanup.sh
@@ -0,0 +1,8 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d gpg_check_TEST_dir ] ; then
+ rm -fr gpg_check_TEST_dir
+else
+ true
+fi
diff --git a/0.8.0/paludis/qa/gpg_check_TEST_setup.sh b/0.8.0/paludis/qa/gpg_check_TEST_setup.sh
new file mode 100755
index 0000000..88bc065
--- /dev/null
+++ b/0.8.0/paludis/qa/gpg_check_TEST_setup.sh
@@ -0,0 +1,9 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir gpg_check_TEST_dir || exit 2
+cd gpg_check_TEST_dir || exit 3
+
+mkdir "cat" || exit 4
+mkdir "cat/not-signed" || exit 5
+touch "cat/not-signed/Manifest" || exit 6
diff --git a/0.8.0/paludis/qa/has_ebuilds_check.cc b/0.8.0/paludis/qa/has_ebuilds_check.cc
new file mode 100644
index 0000000..3d850c2
--- /dev/null
+++ b/0.8.0/paludis/qa/has_ebuilds_check.cc
@@ -0,0 +1,50 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <algorithm>
+#include <paludis/qa/has_ebuilds_check.hh>
+#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/is_file_with_extension.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+HasEbuildsCheck::HasEbuildsCheck()
+{
+}
+
+CheckResult
+HasEbuildsCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+
+ if (DirIterator() == std::find_if(DirIterator(d), DirIterator(),
+ IsFileWithExtension(d.basename() + "-", ".ebuild")))
+ result << Message(qal_fatal, "No ebuilds found");
+
+ return result;
+}
+
+const std::string &
+HasEbuildsCheck::identifier()
+{
+ static const std::string id("has_ebuilds");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/has_ebuilds_check.hh b/0.8.0/paludis/qa/has_ebuilds_check.hh
new file mode 100644
index 0000000..56bb744
--- /dev/null
+++ b/0.8.0/paludis/qa/has_ebuilds_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_HAS_EBUILDS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_HAS_EBUILDS_CHECK_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class HasEbuildsCheck :
+ public PackageDirCheck
+ {
+ public:
+ HasEbuildsCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that there are ebuilds present";
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_has_ebuilds_check(
+ HasEbuildsCheck::identifier(), &MakePackageDirCheck<HasEbuildsCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/has_ebuilds_check_TEST.cc b/0.8.0/paludis/qa/has_ebuilds_check_TEST.cc
new file mode 100644
index 0000000..b048061
--- /dev/null
+++ b/0.8.0/paludis/qa/has_ebuilds_check_TEST.cc
@@ -0,0 +1,66 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/has_ebuilds_check.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct HasEbuildsCheckTest : TestCase
+ {
+ HasEbuildsCheckTest() : TestCase("has ebuilds") { }
+
+ void run()
+ {
+ FSEntry e("has_ebuilds_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "cat" / "yes");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ HasEbuildsCheck::identifier()))())(f1));
+ TEST_CHECK(r1.empty());
+ }
+ } test_has_ebuilds_check;
+
+ struct HasNoEbuildsCheckTest : TestCase
+ {
+ HasNoEbuildsCheckTest() : TestCase("has no ebuilds") { }
+
+ void run()
+ {
+ FSEntry e("has_ebuilds_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "cat" / "no");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ HasEbuildsCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ }
+ } test_has_no_ebuilds_check;
+}
+
diff --git a/0.8.0/paludis/qa/has_ebuilds_check_TEST_cleanup.sh b/0.8.0/paludis/qa/has_ebuilds_check_TEST_cleanup.sh
new file mode 100755
index 0000000..d8b9da9
--- /dev/null
+++ b/0.8.0/paludis/qa/has_ebuilds_check_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d has_ebuilds_check_TEST_dir ] ; then
+ rm -fr has_ebuilds_check_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/0.8.0/paludis/qa/has_ebuilds_check_TEST_setup.sh b/0.8.0/paludis/qa/has_ebuilds_check_TEST_setup.sh
new file mode 100755
index 0000000..1b4f58a
--- /dev/null
+++ b/0.8.0/paludis/qa/has_ebuilds_check_TEST_setup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir has_ebuilds_check_TEST_dir || exit 2
+cd has_ebuilds_check_TEST_dir || exit 3
+
+mkdir "cat" || exit 4
+mkdir "cat/yes" || exit 5
+mkdir "cat/no" || exit 6
+
+touch "cat/yes/yes-1.ebuild" || exit 7
+
diff --git a/0.8.0/paludis/qa/has_misc_files_check.cc b/0.8.0/paludis/qa/has_misc_files_check.cc
new file mode 100644
index 0000000..011ccaf
--- /dev/null
+++ b/0.8.0/paludis/qa/has_misc_files_check.cc
@@ -0,0 +1,54 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/has_misc_files_check.hh>
+#include <paludis/util/dir_iterator.hh>
+#include <paludis/util/is_file_with_extension.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+HasMiscFilesCheck::HasMiscFilesCheck()
+{
+}
+
+CheckResult
+HasMiscFilesCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+
+ if (! (d / "ChangeLog").exists())
+ result << Message(qal_major, "No ChangeLog found");
+
+ if (! (d / "files").exists())
+ result << Message(qal_major, "No files/ found");
+
+ if (! (d / "metadata.xml").exists())
+ result << Message(qal_major, "No metadata.xml found");
+
+ return result;
+}
+
+const std::string &
+HasMiscFilesCheck::identifier()
+{
+ static const std::string id("has_misc_files");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/has_misc_files_check.hh b/0.8.0/paludis/qa/has_misc_files_check.hh
new file mode 100644
index 0000000..d82b302
--- /dev/null
+++ b/0.8.0/paludis/qa/has_misc_files_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_HAS_MISC_FILES_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_HAS_MISC_FILES_CHECK_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class HasMiscFilesCheck :
+ public PackageDirCheck
+ {
+ public:
+ HasMiscFilesCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that ChangeLog, metadata.xml, files/ exist";
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_misc_files_check(
+ HasMiscFilesCheck::identifier(), &MakePackageDirCheck<HasMiscFilesCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/has_misc_files_check_TEST.cc b/0.8.0/paludis/qa/has_misc_files_check_TEST.cc
new file mode 100644
index 0000000..c34e1b7
--- /dev/null
+++ b/0.8.0/paludis/qa/has_misc_files_check_TEST.cc
@@ -0,0 +1,102 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/has_misc_files_check.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct HasMiscFilesCheckTest : TestCase
+ {
+ HasMiscFilesCheckTest() : TestCase("has misc files") { }
+
+ void run()
+ {
+ FSEntry e("has_misc_files_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "cat" / "yes");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ HasMiscFilesCheck::identifier()))())(f1));
+ TEST_CHECK(r1.empty());
+ }
+ } test_has_misc_files_check;
+
+ struct HasMiscFilesCheckNoChangeLogTest : TestCase
+ {
+ HasMiscFilesCheckNoChangeLogTest() : TestCase("has misc files no ChangeLog") { }
+
+ void run()
+ {
+ FSEntry e("has_misc_files_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "cat" / "no-changelog");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ HasMiscFilesCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ }
+ } test_has_misc_files_check_no_changelog;
+
+ struct HasMiscFilesCheckNoMetadataTest : TestCase
+ {
+ HasMiscFilesCheckNoMetadataTest() : TestCase("has misc files no metadata.xml") { }
+
+ void run()
+ {
+ FSEntry e("has_misc_files_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "cat" / "no-metadata");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ HasMiscFilesCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ }
+ } test_has_misc_files_check_no_metadata;
+
+ struct HasMiscFilesCheckNoFilesTest : TestCase
+ {
+ HasMiscFilesCheckNoFilesTest() : TestCase("has misc files no files/") { }
+
+ void run()
+ {
+ FSEntry e("has_misc_files_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "cat" / "no-files");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ HasMiscFilesCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ }
+ } test_has_misc_files_check_no_files;
+}
+
diff --git a/0.8.0/paludis/qa/has_misc_files_check_TEST_cleanup.sh b/0.8.0/paludis/qa/has_misc_files_check_TEST_cleanup.sh
new file mode 100755
index 0000000..8c6fb3a
--- /dev/null
+++ b/0.8.0/paludis/qa/has_misc_files_check_TEST_cleanup.sh
@@ -0,0 +1,12 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d has_misc_files_check_TEST_dir ] ; then
+ rm -fr has_misc_files_check_TEST_dir
+else
+ true
+fi
+
+
+
+
diff --git a/0.8.0/paludis/qa/has_misc_files_check_TEST_setup.sh b/0.8.0/paludis/qa/has_misc_files_check_TEST_setup.sh
new file mode 100755
index 0000000..123f032
--- /dev/null
+++ b/0.8.0/paludis/qa/has_misc_files_check_TEST_setup.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir has_misc_files_check_TEST_dir || exit 2
+cd has_misc_files_check_TEST_dir || exit 3
+
+mkdir "cat" || exit 4
+
+mkdir "cat/yes" || exit 5
+touch "cat/yes/ChangeLog" "cat/yes/metadata.xml" || exit 6
+mkdir "cat/yes/files" || exit 7
+
+mkdir "cat/no-changelog" || exit 8
+touch "cat/no-changelog/metadata.xml" || exit 9
+mkdir "cat/no-changelog/files" || exit 10
+
+mkdir "cat/no-metadata" || exit 8
+touch "cat/no-metadata/ChangeLog" || exit 9
+mkdir "cat/no-metadata/files" || exit 10
+
+mkdir "cat/no-files" || exit 11
+touch "cat/no-files/metadata.xml" "cat/no-files/ChangeLog" || exit 12
+
diff --git a/0.8.0/paludis/qa/homepage_check.cc b/0.8.0/paludis/qa/homepage_check.cc
new file mode 100644
index 0000000..5638c79
--- /dev/null
+++ b/0.8.0/paludis/qa/homepage_check.cc
@@ -0,0 +1,73 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/homepage_check.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+HomepageCheck::HomepageCheck()
+{
+}
+
+CheckResult
+HomepageCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ std::string homepage(metadata->homepage);
+
+ if (homepage.empty())
+ result << Message(qal_major, "HOMEPAGE empty or unset");
+
+ else if (std::string::npos == homepage.find("http://") &&
+ std::string::npos == homepage.find("https://") &&
+ std::string::npos == homepage.find("ftp://"))
+ result << Message(qal_major, "HOMEPAGE doesn't look like a URL");
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+HomepageCheck::identifier()
+{
+ static const std::string id("homepage");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/homepage_check.hh b/0.8.0/paludis/qa/homepage_check.hh
new file mode 100644
index 0000000..ae67371
--- /dev/null
+++ b/0.8.0/paludis/qa/homepage_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_HOMEPAGE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_HOMEPAGE_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class HomepageCheck :
+ public EbuildCheck
+ {
+ public:
+ HomepageCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that HOMEPAGE is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_homepage_check(
+ HomepageCheck::identifier(), &MakeEbuildCheck<HomepageCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/inherits_check.cc b/0.8.0/paludis/qa/inherits_check.cc
new file mode 100644
index 0000000..cd5f855
--- /dev/null
+++ b/0.8.0/paludis/qa/inherits_check.cc
@@ -0,0 +1,91 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <algorithm>
+#include <iterator>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/qa/inherits_check.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/tokeniser.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+InheritsCheck::InheritsCheck()
+{
+}
+
+CheckResult
+InheritsCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ std::set<std::string> inherits;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+ tokeniser.tokenise(metadata->get_ebuild_interface()->inherited, std::inserter(inherits, inherits.begin()));
+
+ static std::set<std::string> inherits_blacklist;
+ if (inherits_blacklist.empty())
+ {
+ inherits_blacklist.insert("gcc");
+ inherits_blacklist.insert("kmod");
+ inherits_blacklist.insert("kernel-mod");
+ inherits_blacklist.insert("gtk-engines");
+ inherits_blacklist.insert("gtk-engines2");
+ }
+
+ std::set<std::string> bad_inherits;
+ std::set_intersection(inherits.begin(), inherits.end(),
+ inherits_blacklist.begin(), inherits_blacklist.end(),
+ std::inserter(bad_inherits, bad_inherits.begin()));
+
+ if (! bad_inherits.empty())
+ result << Message(qal_major, "Deprecated inherits '" + join(bad_inherits.begin(),
+ bad_inherits.end(), "', '") + "'");
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+InheritsCheck::identifier()
+{
+ static const std::string id("inherits");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/inherits_check.hh b/0.8.0/paludis/qa/inherits_check.hh
new file mode 100644
index 0000000..00f1468
--- /dev/null
+++ b/0.8.0/paludis/qa/inherits_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_INHERITS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_INHERITS_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class InheritsCheck :
+ public EbuildCheck
+ {
+ public:
+ InheritsCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that inherits are sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_inherits_check(
+ InheritsCheck::identifier(), &MakeEbuildCheck<InheritsCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/iuse_check.cc b/0.8.0/paludis/qa/iuse_check.cc
new file mode 100644
index 0000000..905e6ea
--- /dev/null
+++ b/0.8.0/paludis/qa/iuse_check.cc
@@ -0,0 +1,98 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/iuse_check.hh>
+#include <set>
+#include <algorithm>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/tokeniser.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+IuseCheck::IuseCheck()
+{
+}
+
+CheckResult
+IuseCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ try
+ {
+ std::set<UseFlagName> iuse;
+ WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
+ iuse, create_inserter<UseFlagName>(std::inserter(iuse, iuse.begin())));
+
+
+ static std::set<UseFlagName> iuse_blacklist;
+ if (iuse_blacklist.empty())
+ {
+ iuse_blacklist.insert(UseFlagName("gtk2"));
+ iuse_blacklist.insert(UseFlagName("xml2"));
+ iuse_blacklist.insert(UseFlagName("oggvorbis"));
+ }
+
+ std::set<UseFlagName> bad_iuse;
+ std::set_intersection(iuse.begin(), iuse.end(),
+ iuse_blacklist.begin(), iuse_blacklist.end(),
+ std::inserter(bad_iuse, bad_iuse.begin()));
+
+ if (! bad_iuse.empty())
+ result << Message(qal_minor, "Deprecated IUSEs '" + join(bad_iuse.begin(),
+ bad_iuse.end(), "', '") + "'");
+ }
+ catch (const NameError & err)
+ {
+ result << Message(qal_fatal, "Bad IUSE entry name: " + err.message() + " ("
+ + err.what() + ")");
+ }
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+IuseCheck::identifier()
+{
+ static const std::string id("iuse");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/iuse_check.hh b/0.8.0/paludis/qa/iuse_check.hh
new file mode 100644
index 0000000..92b0995
--- /dev/null
+++ b/0.8.0/paludis/qa/iuse_check.hh
@@ -0,0 +1,56 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_IUSE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_IUSE_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class IuseCheck :
+ public EbuildCheck
+ {
+ public:
+ IuseCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that IUSE is sane";
+ }
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_iuse_check(
+ IuseCheck::identifier(), &MakeEbuildCheck<IuseCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/keywords_check.cc b/0.8.0/paludis/qa/keywords_check.cc
new file mode 100644
index 0000000..aa87f7f
--- /dev/null
+++ b/0.8.0/paludis/qa/keywords_check.cc
@@ -0,0 +1,88 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/keywords_check.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+KeywordsCheck::KeywordsCheck()
+{
+}
+
+CheckResult
+KeywordsCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ try
+ {
+ //std::set<KeywordName> keywords(metadata->begin_keywords(), metadata->end_keywords());
+ std::set<KeywordName> keywords;
+ WhitespaceTokeniser::get_instance()->tokenise(metadata->get_ebuild_interface()->
+ keywords, create_inserter<KeywordName>(std::inserter(keywords, keywords.begin())));
+
+ if (keywords.end() != keywords.find(KeywordName("-*")) &&
+ keywords.size() == 1)
+ result << Message(qal_major, "-* abuse (use package.mask and keyword properly)");
+
+ else if (keywords.empty())
+ result << Message(qal_major, "KEYWORDS empty");
+
+ }
+ catch (const NameError &)
+ {
+ result << Message(qal_major, "Bad entries in KEYWORDS");
+ }
+
+ if (! metadata->get_ebuild_interface()->eclass_keywords.empty())
+ result << Message(qal_major, "KEYWORDS was altered by an eclass");
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+KeywordsCheck::identifier()
+{
+ static const std::string id("keywords");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/keywords_check.hh b/0.8.0/paludis/qa/keywords_check.hh
new file mode 100644
index 0000000..d04eab0
--- /dev/null
+++ b/0.8.0/paludis/qa/keywords_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_KEYWORDS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_KEYWORDS_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class KeywordsCheck :
+ public EbuildCheck
+ {
+ public:
+ KeywordsCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that KEYWORDS is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_keywords_check(
+ KeywordsCheck::identifier(), &MakeEbuildCheck<KeywordsCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/license_check.cc b/0.8.0/paludis/qa/license_check.cc
new file mode 100644
index 0000000..67f2603
--- /dev/null
+++ b/0.8.0/paludis/qa/license_check.cc
@@ -0,0 +1,141 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/qa/license_check.hh>
+#include <paludis/util/tokeniser.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ const Environment * const env;
+
+ Checker(CheckResult & rr, const Environment * const e) :
+ result(rr),
+ env(e)
+ {
+ }
+
+ void visit(const PlainTextDepAtom * const a)
+ {
+ if (! env->package_database()->fetch_repository(
+ env->package_database()->favourite_repository())->is_license(a->text()))
+ result << Message(qal_major, "Item '" + a->text() + "' is not a licence");
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const PackageDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+ };
+
+ void
+ Checker::visit(const BlockDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected BlockDepAtom");
+ }
+
+ void
+ Checker::visit(const PackageDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected PackageDepAtom");
+ }
+}
+
+LicenseCheck::LicenseCheck()
+{
+}
+
+CheckResult
+LicenseCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ do
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+
+ std::string license(metadata->license_string);
+
+ DepAtom::ConstPointer license_parts(0);
+ try
+ {
+ license_parts = PortageDepParser::parse(license,
+ PortageDepParserPolicy<PlainTextDepAtom, true>::get_instance());
+
+ Checker checker(result, e.environment);
+ license_parts->accept(&checker);
+ }
+ catch (const DepStringError & err)
+ {
+ result << Message(qal_major, "Invalid LICENSE: '" + err.message() + "' ("
+ + err.what() + ")");
+ break;
+ }
+ } while (false);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+LicenseCheck::identifier()
+{
+ static const std::string id("license");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/license_check.hh b/0.8.0/paludis/qa/license_check.hh
new file mode 100644
index 0000000..49b6b76
--- /dev/null
+++ b/0.8.0/paludis/qa/license_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_LICENSE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_LICENSE_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class LicenseCheck :
+ public EbuildCheck
+ {
+ public:
+ LicenseCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that LICENSE is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_license_check(
+ LicenseCheck::identifier(), &MakeEbuildCheck<LicenseCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/message.cc b/0.8.0/paludis/qa/message.cc
new file mode 100644
index 0000000..276eb81
--- /dev/null
+++ b/0.8.0/paludis/qa/message.cc
@@ -0,0 +1,34 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/message.hh>
+#include <ostream>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+#include <paludis/qa/message-sr.cc>
+
+std::ostream &
+paludis::qa::operator<< (std::ostream & s, const Message & m)
+{
+ s << "(" << m.level << ") " << m.msg;
+ return s;
+}
+
diff --git a/0.8.0/paludis/qa/message.hh b/0.8.0/paludis/qa/message.hh
new file mode 100644
index 0000000..e3bf632
--- /dev/null
+++ b/0.8.0/paludis/qa/message.hh
@@ -0,0 +1,52 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_MESSAGE_HH
+#define PALUDIS_GUARD_PALUDIS_QA_MESSAGE_HH 1
+
+#include <string>
+#include <iosfwd>
+
+/** \file
+ * Declarations for the Message class.
+ *
+ * \ingroup QA
+ */
+
+namespace paludis
+{
+ namespace qa
+ {
+ enum QALevel
+ {
+ qal_info,
+ qal_skip,
+ qal_maybe,
+ qal_minor,
+ qal_major,
+ qal_fatal
+ };
+
+#include <paludis/qa/message-sr.hh>
+
+ std::ostream & operator<< (std::ostream &, const Message &);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/message.sr b/0.8.0/paludis/qa/message.sr
new file mode 100644
index 0000000..e4f559e
--- /dev/null
+++ b/0.8.0/paludis/qa/message.sr
@@ -0,0 +1,9 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_Message()
+{
+ key level QALevel
+ key msg std::string
+}
+
diff --git a/0.8.0/paludis/qa/message_TEST.cc b/0.8.0/paludis/qa/message_TEST.cc
new file mode 100644
index 0000000..3b15e2a
--- /dev/null
+++ b/0.8.0/paludis/qa/message_TEST.cc
@@ -0,0 +1,42 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/message.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct MessageTest : TestCase
+ {
+ MessageTest() : TestCase("message") { }
+
+ void run()
+ {
+ Message m(qal_minor, "Test");
+ TEST_CHECK_EQUAL(m.level, qal_minor);
+ TEST_CHECK_EQUAL(m.msg, "Test");
+ }
+ } test_message;
+}
+
diff --git a/0.8.0/paludis/qa/metadata_check.cc b/0.8.0/paludis/qa/metadata_check.cc
new file mode 100644
index 0000000..68f850b
--- /dev/null
+++ b/0.8.0/paludis/qa/metadata_check.cc
@@ -0,0 +1,116 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <ctime>
+#include <fstream>
+#include <paludis/qa/metadata_check.hh>
+#include <paludis/libxml/libxml.hh>
+#include <paludis/util/pstream.hh>
+#include <paludis/util/system.hh>
+#include <paludis/util/log.hh>
+
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+
+#if !defined(LIBXML_XPATH_ENABLED) || !defined(LIBXML_SAX1_ENABLED)
+# error "Need libxml2 built with SAX and XPath."
+#endif
+
+using namespace paludis;
+using namespace paludis::qa;
+
+MetadataCheck::MetadataCheck()
+{
+}
+
+CheckResult
+MetadataCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ if (f.basename() != "metadata.xml")
+ result << Message(qal_skip, "Not a metadata.xml file");
+ else if (! f.is_regular_file())
+ result << Message(qal_major, "Not a regular file");
+ else
+ {
+ FSEntry dtd(FSEntry(getenv_or_error("HOME")) / ".qualudis");
+ if (! dtd.exists())
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context, "Creating ~/.qualudis "
+ "with mode 0755");
+ if (! dtd.mkdir(0755))
+ throw ConfigurationError("~/.qualudis/ does not exist, please create it");
+ }
+
+ dtd /= "cache";
+ if (! dtd.exists())
+ if (! dtd.mkdir(0755))
+ throw ConfigurationError("~/.qualudis/cache/ does not exist and cannot be created");
+
+ dtd /= "metadata.dtd";
+ if (! dtd.exists() || dtd.mtime() > (std::time(0) + (24 * 60 * 60)))
+ {
+ PStream wget("wget -O- http://www.gentoo.org/dtd/metadata.dtd");
+
+ // see \ref EffSTL item 29
+ std::string dtd_data((std::istreambuf_iterator<char>(wget)),
+ std::istreambuf_iterator<char>());
+ if (0 != wget.exit_status())
+ throw ConfigurationError("Couldn't get a new metadata.dtd");
+
+ std::ofstream dtd_file(stringify(dtd).c_str());
+ dtd_file << dtd_data;
+ if (! dtd_file)
+ throw ConfigurationError("Error writing to '" + stringify(dtd) +
+ "' -- you should remove this file manually before continuing");
+ }
+
+ LibXmlPtrHolder<xmlParserCtxtPtr> xml_parser_context(xmlNewParserCtxt(), &xmlFreeParserCtxt);
+ LibXmlPtrHolder<xmlDtdPtr> xml_dtd(
+ xmlParseDTD(0, reinterpret_cast<const xmlChar *>(stringify(dtd).c_str())), &xmlFreeDtd);
+
+ if (! xml_dtd)
+ result << Message(qal_major, "Unable to parse DTD '" + stringify(dtd) + "'");
+ else
+ {
+ LibXmlPtrHolder<xmlDocPtr> xml_doc(xmlCtxtReadFile(
+ xml_parser_context, stringify(f).c_str(), 0, XML_PARSE_DTDLOAD), &xmlFreeDoc);
+ if (! xml_doc)
+ result << Message(qal_major, "Unable to parse '" + stringify(f) + "'");
+ else
+ {
+ LibXmlPtrHolder<xmlValidCtxtPtr> xml_valid_context(xmlNewValidCtxt(), &xmlFreeValidCtxt);
+ if (! xmlValidateDtd(xml_valid_context, xml_doc, xml_dtd))
+ result << Message(qal_major, "Validation of '" + stringify(f) + "' against '"
+ + stringify(dtd) + "' failed");
+ }
+ }
+ }
+
+ return result;
+}
+
+const std::string &
+MetadataCheck::identifier()
+{
+ static const std::string id("metadata");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/metadata_check.hh b/0.8.0/paludis/qa/metadata_check.hh
new file mode 100644
index 0000000..fc61b79
--- /dev/null
+++ b/0.8.0/paludis/qa/metadata_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_METADATA_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_METADATA_CHECK_HH 1
+
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class MetadataCheck :
+ public FileCheck
+ {
+ public:
+ MetadataCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that metadata.xml is valid";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_metadata_check(
+ MetadataCheck::identifier(), &MakeFileCheck<MetadataCheck>::make_file_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/metadata_file.cc b/0.8.0/paludis/qa/metadata_file.cc
new file mode 100644
index 0000000..8e409ac
--- /dev/null
+++ b/0.8.0/paludis/qa/metadata_file.cc
@@ -0,0 +1,136 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "metadata_file.hh"
+#include <paludis/libxml/libxml.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/log.hh>
+#include <paludis/util/save.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/tokeniser.hh>
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <set>
+#include <list>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace paludis
+{
+ template<>
+ class Implementation<MetadataFile> :
+ public InternalCounted<Implementation<MetadataFile> >
+ {
+ private:
+ std::string _email, _name;
+
+ public:
+ std::set<std::string> herds;
+ std::set<std::pair<std::string, std::string> > maintainers;
+
+ void handle_node(xmlDocPtr doc, xmlNode * const node)
+ {
+ for (xmlNode * n(node) ; n ; n = n->next)
+ {
+ if (n->type == XML_ELEMENT_NODE)
+ {
+ std::string name(retarded_libxml_string_to_string(n->name));
+ if (name == "maintainer")
+ {
+ _email.clear();
+ _name.clear();
+ handle_node(doc, n->children);
+ maintainers.insert(std::make_pair(_email, _name));
+ }
+ else if (name == "herd")
+ herds.insert(normalise(retarded_libxml_string_to_string(xmlNodeListGetString(doc,
+ n->xmlChildrenNode, 1))));
+ else if (name == "email")
+ _email = normalise(retarded_libxml_string_to_string(xmlNodeListGetString(
+ doc, n->xmlChildrenNode, 1)));
+ else if (name == "name")
+ _name = normalise(retarded_libxml_string_to_string(xmlNodeListGetString(
+ doc, n->xmlChildrenNode, 1)));
+ else
+ handle_node(doc, n->children);
+ }
+ else
+ handle_node(doc, n->children);
+ }
+ }
+ };
+}
+
+MetadataFile::MetadataFile(const FSEntry & f) :
+ PrivateImplementationPattern<MetadataFile>(new Implementation<MetadataFile>)
+{
+ LibXmlPtrHolder<xmlDocPtr> xml_doc(xmlReadFile(stringify(f).c_str(), 0, 0), &xmlFreeDoc);
+ if (! xml_doc)
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context, "Couldn't parse xml file '" +
+ stringify(f) + "'");
+ return;
+ }
+
+ _imp->handle_node(xml_doc, xmlDocGetRootElement(xml_doc));
+}
+
+MetadataFile::MetadataFile(const std::string & text) :
+ PrivateImplementationPattern<MetadataFile>(new Implementation<MetadataFile>)
+{
+ LibXmlPtrHolder<xmlDocPtr> xml_doc(xmlReadDoc(reinterpret_cast<const xmlChar *>(text.c_str()),
+ "file:///var/empty/", 0, 0), &xmlFreeDoc);
+ if (! xml_doc)
+ {
+ Log::get_instance()->message(ll_warning, lc_no_context, "Couldn't parse xml text");
+ return;
+ }
+
+ _imp->handle_node(xml_doc, xmlDocGetRootElement(xml_doc));
+}
+
+MetadataFile::~MetadataFile()
+{
+}
+
+MetadataFile::HerdsIterator
+MetadataFile::begin_herds() const
+{
+ return HerdsIterator(_imp->herds.begin());
+}
+
+MetadataFile::HerdsIterator
+MetadataFile::end_herds() const
+{
+ return HerdsIterator(_imp->herds.end());
+}
+
+MetadataFile::MaintainersIterator
+MetadataFile::begin_maintainers() const
+{
+ return MaintainersIterator(_imp->maintainers.begin());
+}
+
+MetadataFile::MaintainersIterator
+MetadataFile::end_maintainers() const
+{
+ return MaintainersIterator(_imp->maintainers.end());
+}
+
diff --git a/0.8.0/paludis/qa/metadata_file.hh b/0.8.0/paludis/qa/metadata_file.hh
new file mode 100644
index 0000000..4eed78f
--- /dev/null
+++ b/0.8.0/paludis/qa/metadata_file.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_METADATA_FILE_HH
+#define PALUDIS_GUARD_PALUDIS_QA_METADATA_FILE_HH 1
+
+#include <paludis/util/private_implementation_pattern.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+
+namespace paludis
+{
+ class FSEntry;
+
+ namespace qa
+ {
+ class MetadataFile :
+ public PrivateImplementationPattern<MetadataFile>
+ {
+ public:
+ MetadataFile(const FSEntry & location);
+ MetadataFile(const std::string & text);
+ ~MetadataFile();
+
+ typedef libwrapiter::ForwardIterator<MetadataFile, const std::string> HerdsIterator;
+ HerdsIterator begin_herds() const;
+ HerdsIterator end_herds() const;
+
+ typedef libwrapiter::ForwardIterator<MetadataFile, const std::pair<std::string, std::string> > MaintainersIterator;
+ MaintainersIterator begin_maintainers() const;
+ MaintainersIterator end_maintainers() const;
+ };
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/metadata_file_TEST.cc b/0.8.0/paludis/qa/metadata_file_TEST.cc
new file mode 100644
index 0000000..11ac1c1
--- /dev/null
+++ b/0.8.0/paludis/qa/metadata_file_TEST.cc
@@ -0,0 +1,72 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/metadata_file.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct MetadataFileTest : TestCase
+ {
+ MetadataFileTest() : TestCase("metadata file") { }
+
+ void run()
+ {
+ MetadataFile f(
+"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
+"<!DOCTYPE pkgmetadata SYSTEM \"http://www.gentoo.org/dtd/metadata.dtd\">\n"
+"<pkgmetadata>\n"
+" <herd>vim</herd>\n"
+" <herd> cookie </herd>\n"
+" <maintainer>\n"
+" <email> foo@bar.baz </email>\n"
+" <name> Foo Bar </name>\n"
+" </maintainer>\n"
+" <maintainer>\n"
+" <email>oink@oink</email>\n"
+" </maintainer>\n"
+" <maintainer>\n"
+" <name> Fred the Fish </name>\n"
+" </maintainer>\n"
+" <longdescription lang=\"en\">\n"
+" Some text\n"
+" </longdescription>\n"
+"</pkgmetadata>\n"
+ );
+
+ TEST_CHECK(f.end_herds() != std::find(f.begin_herds(), f.end_herds(), "vim"));
+ TEST_CHECK(f.end_herds() != std::find(f.begin_herds(), f.end_herds(), "cookie"));
+ TEST_CHECK(f.end_herds() == std::find(f.begin_herds(), f.end_herds(), "monster"));
+
+ TEST_CHECK(f.end_maintainers() != std::find(f.begin_maintainers(),
+ f.end_maintainers(), std::make_pair(std::string("foo@bar.baz"), std::string("Foo Bar"))));
+ TEST_CHECK(f.end_maintainers() != std::find(f.begin_maintainers(),
+ f.end_maintainers(), std::make_pair(std::string("oink@oink"), std::string(""))));
+ TEST_CHECK(f.end_maintainers() != std::find(f.begin_maintainers(),
+ f.end_maintainers(), std::make_pair(std::string(""), std::string("Fred the Fish"))));
+ }
+ } test_has_ebuilds_check;
+}
+
+
diff --git a/0.8.0/paludis/qa/package_dir_check.cc b/0.8.0/paludis/qa/package_dir_check.cc
new file mode 100644
index 0000000..c604251
--- /dev/null
+++ b/0.8.0/paludis/qa/package_dir_check.cc
@@ -0,0 +1,33 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/package_dir_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+PackageDirCheck::PackageDirCheck()
+{
+}
+
+NoSuchPackageDirCheckTypeError::NoSuchPackageDirCheckTypeError(const std::string & s) throw () :
+ Exception("No such file check type: '" + s + "'")
+{
+}
+
diff --git a/0.8.0/paludis/qa/package_dir_check.hh b/0.8.0/paludis/qa/package_dir_check.hh
new file mode 100644
index 0000000..0a5aa89
--- /dev/null
+++ b/0.8.0/paludis/qa/package_dir_check.hh
@@ -0,0 +1,80 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_PACKAGE_DIR_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_PACKAGE_DIR_CHECK_HH 1
+
+#include <paludis/qa/check.hh>
+#include <paludis/qa/check_result.hh>
+#include <paludis/util/counted_ptr.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/util/fs_entry.hh>
+#include <paludis/util/virtual_constructor.hh>
+
+/** \file
+ * Declarations for the PackageDirCheck class.
+ *
+ * \ingroup QA
+ */
+
+namespace paludis
+{
+ namespace qa
+ {
+ /**
+ * A QA check that operates upon a package directory.
+ *
+ * \ingroup QA
+ */
+ class PackageDirCheck :
+ public Check,
+ public InternalCounted<PackageDirCheck>
+ {
+ protected:
+ PackageDirCheck();
+
+ public:
+ virtual CheckResult operator() (const FSEntry &) const = 0;
+ };
+
+ class NoSuchPackageDirCheckTypeError :
+ public Exception
+ {
+ public:
+ NoSuchPackageDirCheckTypeError(const std::string &) throw ();
+ };
+
+ /* icc is dumb */
+ template <typename T_>
+ struct MakePackageDirCheck
+ {
+ static PackageDirCheck::Pointer
+ make_package_dir_check()
+ {
+ return PackageDirCheck::Pointer(new T_);
+ }
+ };
+
+ typedef VirtualConstructor<
+ std::string,
+ PackageDirCheck::Pointer (*) (),
+ virtual_constructor_not_found::ThrowException<NoSuchPackageDirCheckTypeError> > PackageDirCheckMaker;
+ }
+}
+#endif
diff --git a/0.8.0/paludis/qa/package_name_check.cc b/0.8.0/paludis/qa/package_name_check.cc
new file mode 100644
index 0000000..500fd7c
--- /dev/null
+++ b/0.8.0/paludis/qa/package_name_check.cc
@@ -0,0 +1,62 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/name.hh>
+#include <paludis/qa/package_name_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+PackageNameCheck::PackageNameCheck()
+{
+}
+
+CheckResult
+PackageNameCheck::operator() (const FSEntry & d) const
+{
+ CheckResult result(d, identifier());
+
+ try
+ {
+ CategoryNamePart c(d.dirname().basename());
+ }
+ catch (const NameError &)
+ {
+ result << Message(qal_fatal, "Invalid category");
+ }
+
+ try
+ {
+ PackageNamePart p(d.basename());
+ }
+ catch (const NameError &)
+ {
+ result << Message(qal_fatal, "Invalid package");
+ }
+
+ return result;
+}
+
+const std::string &
+PackageNameCheck::identifier()
+{
+ static const std::string id("package_name");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/package_name_check.hh b/0.8.0/paludis/qa/package_name_check.hh
new file mode 100644
index 0000000..e19a4a4
--- /dev/null
+++ b/0.8.0/paludis/qa/package_name_check.hh
@@ -0,0 +1,56 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_PACKAGE_NAME_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_PACKAGE_NAME_CHECK_HH 1
+
+#include <paludis/qa/package_dir_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class PackageNameCheck :
+ public PackageDirCheck
+ {
+ public:
+ PackageNameCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that the category/package name is valid";
+ }
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
+ };
+
+ static const PackageDirCheckMaker::RegisterMaker register_package_name_check(
+ PackageNameCheck::identifier(), &MakePackageDirCheck<PackageNameCheck>::make_package_dir_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/package_name_check_TEST.cc b/0.8.0/paludis/qa/package_name_check_TEST.cc
new file mode 100644
index 0000000..f304126
--- /dev/null
+++ b/0.8.0/paludis/qa/package_name_check_TEST.cc
@@ -0,0 +1,104 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/package_name_check.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct PackageNameCheckBothValidTest : TestCase
+ {
+ PackageNameCheckBothValidTest() : TestCase("package name both valid") { }
+
+ void run()
+ {
+ FSEntry e("package_name_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "valid-cat" / "valid-pkg");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ PackageNameCheck::identifier()))())(f1));
+ TEST_CHECK(r1.empty());
+ }
+ } test_package_name_check_both_valid;
+
+ struct PackageNameCheckCatInvalidTest : TestCase
+ {
+ PackageNameCheckCatInvalidTest() : TestCase("package name cat invalid") { }
+
+ void run()
+ {
+ FSEntry e("package_name_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "invalid-cat!" / "valid-pkg");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ PackageNameCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ TEST_CHECK_EQUAL(std::distance(r1.begin(), r1.end()), 1);
+ }
+ } test_package_name_check_cat_invalid;
+
+ struct PackageNameCheckPkgInvalidTest : TestCase
+ {
+ PackageNameCheckPkgInvalidTest() : TestCase("package name pkg invalid") { }
+
+ void run()
+ {
+ FSEntry e("package_name_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "valid-cat" / "invalid-pkg...");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ PackageNameCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ TEST_CHECK_EQUAL(std::distance(r1.begin(), r1.end()), 1);
+ }
+ } test_package_name_check_pkg_invalid;
+
+ struct PackageNameCheckBothInvalidTest : TestCase
+ {
+ PackageNameCheckBothInvalidTest() : TestCase("package name both invalid") { }
+
+ void run()
+ {
+ FSEntry e("package_name_check_TEST_dir");
+ TEST_CHECK(e.exists());
+ TEST_CHECK(e.is_directory());
+
+ FSEntry f1(e / "invalid-cat!" / "invalid-pkg...");
+ TEST_CHECK(f1.exists());
+ CheckResult r1((*(*PackageDirCheckMaker::get_instance()->find_maker(
+ PackageNameCheck::identifier()))())(f1));
+ TEST_CHECK(! r1.empty());
+ TEST_CHECK_EQUAL(std::distance(r1.begin(), r1.end()), 2);
+ }
+ } test_package_name_check_both_invalid;
+}
diff --git a/0.8.0/paludis/qa/package_name_check_TEST_cleanup.sh b/0.8.0/paludis/qa/package_name_check_TEST_cleanup.sh
new file mode 100755
index 0000000..fafc30e
--- /dev/null
+++ b/0.8.0/paludis/qa/package_name_check_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d package_name_check_TEST_dir ] ; then
+ rm -fr package_name_check_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/0.8.0/paludis/qa/package_name_check_TEST_setup.sh b/0.8.0/paludis/qa/package_name_check_TEST_setup.sh
new file mode 100755
index 0000000..202ea16
--- /dev/null
+++ b/0.8.0/paludis/qa/package_name_check_TEST_setup.sh
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir package_name_check_TEST_dir || exit 2
+cd package_name_check_TEST_dir || exit 3
+
+mkdir "valid-cat" || exit 4
+mkdir "valid-cat/valid-pkg" || exit 5
+mkdir "valid-cat/invalid-pkg..." || exit 6
+
+mkdir "invalid-cat!" || exit 7
+mkdir "invalid-cat!/valid-pkg" || exit 8
+mkdir "invalid-cat!/invalid-pkg..." || exit 9
+
diff --git a/0.8.0/paludis/qa/parse_deps_check.cc b/0.8.0/paludis/qa/parse_deps_check.cc
new file mode 100644
index 0000000..7713535
--- /dev/null
+++ b/0.8.0/paludis/qa/parse_deps_check.cc
@@ -0,0 +1,97 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/portage_dep_parser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/qa/parse_deps_check.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+ParseDepsCheck::ParseDepsCheck()
+{
+}
+
+CheckResult
+ParseDepsCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ try
+ {
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend);
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Unparsable DEPEND: '" +
+ err.message() + "' (" + err.what() + ")");
+ }
+
+ try
+ {
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend);
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Unparsable RDEPEND: '" +
+ err.message() + "' (" + err.what() + ")");
+ }
+
+ try
+ {
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend);
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Unparsable PDEPEND: '" +
+ err.message() + "' (" + err.what() + ")");
+ }
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+ParseDepsCheck::identifier()
+{
+ static const std::string id("parse_deps");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/parse_deps_check.hh b/0.8.0/paludis/qa/parse_deps_check.hh
new file mode 100644
index 0000000..384620a
--- /dev/null
+++ b/0.8.0/paludis/qa/parse_deps_check.hh
@@ -0,0 +1,56 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_PARSE_DEPS_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_PARSE_DEPS_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class ParseDepsCheck :
+ public EbuildCheck
+ {
+ public:
+ ParseDepsCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that *DEPEND can be parsed";
+ }
+
+ virtual bool is_important() const
+ {
+ return true;
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_parse_deps_check(
+ ParseDepsCheck::identifier(), &MakeEbuildCheck<ParseDepsCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/pdepend_overlap_check.cc b/0.8.0/paludis/qa/pdepend_overlap_check.cc
new file mode 100644
index 0000000..4cef581
--- /dev/null
+++ b/0.8.0/paludis/qa/pdepend_overlap_check.cc
@@ -0,0 +1,144 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/qa/pdepend_overlap_check.hh>
+#include <paludis/util/join.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Collector :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ std::set<QualifiedPackageName> result;
+
+ Collector()
+ {
+ }
+
+ void visit(const PackageDepAtom * const p)
+ {
+ result.insert(p->package());
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const)
+ {
+ }
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
+ };
+}
+
+PdependOverlapCheck::PdependOverlapCheck()
+{
+}
+
+CheckResult
+PdependOverlapCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ Collector pdepend_collector;
+ std::string pdepend(metadata->deps.post_depend_string);
+ PortageDepParser::parse(pdepend)->accept(&pdepend_collector);
+
+ {
+ Collector depend_collector;
+ std::string depend(metadata->deps.build_depend_string);
+ PortageDepParser::parse(depend)->accept(&depend_collector);
+
+ std::set<QualifiedPackageName> overlap;
+ std::set_intersection(depend_collector.result.begin(), depend_collector.result.end(),
+ pdepend_collector.result.begin(), pdepend_collector.result.end(),
+ std::inserter(overlap, overlap.begin()));
+
+ if (! overlap.empty())
+ result << Message(qal_major, "Overlap between DEPEND and PDEPEND: '" +
+ join(overlap.begin(), overlap.end(), "', ") + "'");
+ }
+
+ {
+ Collector rdepend_collector;
+ std::string rdepend(metadata->deps.run_depend_string);
+ PortageDepParser::parse(rdepend)->accept(&rdepend_collector);
+
+ std::set<QualifiedPackageName> overlap;
+ std::set_intersection(rdepend_collector.result.begin(), rdepend_collector.result.end(),
+ pdepend_collector.result.begin(), pdepend_collector.result.end(),
+ std::inserter(overlap, overlap.begin()));
+
+ if (! overlap.empty())
+ result << Message(qal_major, "Overlap between RDEPEND and PDEPEND: '" +
+ join(overlap.begin(), overlap.end(), "', ") + "'");
+ }
+
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+PdependOverlapCheck::identifier()
+{
+ static const std::string id("pdepend_overlap");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/pdepend_overlap_check.hh b/0.8.0/paludis/qa/pdepend_overlap_check.hh
new file mode 100644
index 0000000..440f885
--- /dev/null
+++ b/0.8.0/paludis/qa/pdepend_overlap_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_RDEPEND_PDEPEND_OVERLAP_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_RDEPEND_PDEPEND_OVERLAP_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class PdependOverlapCheck :
+ public EbuildCheck
+ {
+ public:
+ PdependOverlapCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks for PDEPEND overlap";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_pdepend_overlap_check(
+ PdependOverlapCheck::identifier(), &MakeEbuildCheck<PdependOverlapCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/qa.cc b/0.8.0/paludis/qa/qa.cc
new file mode 100644
index 0000000..8b0cdd8
--- /dev/null
+++ b/0.8.0/paludis/qa/qa.cc
@@ -0,0 +1,21 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/qa.hh>
+
diff --git a/0.8.0/paludis/qa/qa.hh.m4 b/0.8.0/paludis/qa/qa.hh.m4
new file mode 100644
index 0000000..a80bc77
--- /dev/null
+++ b/0.8.0/paludis/qa/qa.hh.m4
@@ -0,0 +1,38 @@
+#if 0
+ifdef(`__gnu__',`',`errprint(`This is not GNU m4...
+')m4exit(1)') include(`misc/generated-file.txt')
+dnl vim: set ft=cpp et sw=4 sts=4 :
+#endif
+
+/*
+ * Copyright (c) 2006 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_QA_QA_HH
+#define PALUDIS_GUARD_PALUDIS_QA_QA_HH 1
+
+define(`addhh', `dnl
+#include <paludis/qa/$1.hh>
+')dnl
+define(`addthis', `ifelse(`$2', `hh', `addhh(`$1')',`')')
+define(`add', `addthis(`$1',`$2')addthis(`$1',`$3')addthis(`$1',`$4')dnl
+addthis(`$1',`$5')addthis(`$1',`$6')')dnl
+
+include(`paludis/qa/files.m4')
+
+#endif
+
+
diff --git a/0.8.0/paludis/qa/qa_environment.cc b/0.8.0/paludis/qa/qa_environment.cc
new file mode 100644
index 0000000..4f42b31
--- /dev/null
+++ b/0.8.0/paludis/qa/qa_environment.cc
@@ -0,0 +1,128 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006 David Morgan <david.morgan@wadham.oxford.ac.uk>
+ *
+ * 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 <paludis/package_database_entry.hh>
+#include <paludis/qa/qa_environment.hh>
+#include <paludis/util/collection_concrete.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/util/log.hh>
+#include <paludis/config_file.hh>
+#include <map>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace paludis
+{
+ namespace qa
+ {
+#include <paludis/qa/qa_environment-sr.hh>
+#include <paludis/qa/qa_environment-sr.cc>
+ }
+
+ template<>
+ struct Implementation<QAEnvironmentBase> :
+ InternalCounted<QAEnvironmentBase>
+ {
+ std::vector<PackageDatabasesEntry> package_databases;
+
+ Implementation(const FSEntry & base, const Environment * const env)
+ {
+ Context context("When creating package databases from profiles.desc under '"
+ + stringify(base / "profiles") + "':");
+
+ LineConfigFile profiles_desc(base / "profiles" / "profiles.desc");
+ for (LineConfigFile::Iterator line(profiles_desc.begin()), line_end(profiles_desc.end()) ;
+ line != line_end ; ++line)
+ {
+ std::vector<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(*line, std::back_inserter(tokens));
+
+ if (tokens.size() != 3)
+ {
+ Log::get_instance()->message(ll_warning, lc_context, "Skipping invalid line '"
+ + *line + "'");
+ continue;
+ }
+
+ PackageDatabase::Pointer db(new PackageDatabase(env));
+
+ /* create our portage repository */
+ AssociativeCollection<std::string, std::string>::Pointer keys(
+ new AssociativeCollection<std::string, std::string>::Concrete);
+
+ keys->insert("format", "portage");
+ keys->insert("importace", "1");
+ keys->insert("location", stringify(base));
+ keys->insert("cache", "/var/empty");
+ keys->insert("profiles", stringify(base / "profiles" / tokens.at(1)));
+
+ db->add_repository(RepositoryMaker::get_instance()->find_maker("portage")(env,
+ db.raw_pointer(), keys));
+
+ /* create our virtuals repository */
+ db->add_repository(RepositoryMaker::get_instance()->find_maker("virtuals")(env,
+ db.raw_pointer(), AssociativeCollection<std::string, std::string>::Pointer(0)));
+
+ /* make the entry */
+ package_databases.push_back(PackageDatabasesEntry(PackageDatabasesEntry::create()
+ .arch(UseFlagName(tokens.at(0)))
+ .location(base / "profiles" / tokens.at(1))
+ .status(tokens.at(2))
+ .package_database(db)));
+ }
+
+ if (package_databases.empty())
+ throw ProfilesDescError("No profiles.desc entries found");
+ }
+ };
+}
+
+QAEnvironmentBase::QAEnvironmentBase(const FSEntry & b, const Environment * const env) :
+ PrivateImplementationPattern<QAEnvironmentBase>(new Implementation<QAEnvironmentBase>(b, env))
+{
+}
+
+QAEnvironmentBase::~QAEnvironmentBase()
+{
+}
+
+QAEnvironment::QAEnvironment(const FSEntry & base) :
+ QAEnvironmentBase(base, this),
+ Environment(_imp->package_databases.begin()->package_database)
+{
+}
+
+QAEnvironment::~QAEnvironment()
+{
+}
+
+std::string
+QAEnvironment::paludis_command() const
+{
+ return "diefunc 'qa_environment.cc' 'QAEnvironment::paludis_command()' "
+ "'paludis_command called from within QAEnvironment'";
+}
+
+ProfilesDescError::ProfilesDescError(const std::string & our_message) throw () :
+ ConfigurationError("Bad profiles.desc: " + our_message)
+{
+}
+
diff --git a/0.8.0/paludis/qa/qa_environment.hh b/0.8.0/paludis/qa/qa_environment.hh
new file mode 100644
index 0000000..90d8a53
--- /dev/null
+++ b/0.8.0/paludis/qa/qa_environment.hh
@@ -0,0 +1,76 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaranm@ciaranm.org>
+ * Copyright (c) 2006 David Morgan <david.morgan@wadham.oxford.ac.uk>
+ *
+ * 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_QA_ENVIRONMENT_HH
+#define PALUDIS_GUARD_PALUDIS_QA_ENVIRONMENT_HH 1
+
+#include <paludis/environment.hh>
+#include <paludis/package_database.hh>
+#include <paludis/util/private_implementation_pattern.hh>
+#include <paludis/util/fs_entry.hh>
+#include <libwrapiter/libwrapiter_forward_iterator.hh>
+
+/** \file
+ * Declarations for the QAEnvironment class.
+ */
+
+namespace paludis
+{
+ namespace qa
+ {
+ /**
+ * Base from member holder for our package databases.
+ */
+ class QAEnvironmentBase :
+ private PrivateImplementationPattern<QAEnvironmentBase>
+ {
+ friend class QAEnvironment;
+
+ protected:
+ QAEnvironmentBase(const FSEntry & base, const Environment * const env);
+ ~QAEnvironmentBase();
+ };
+
+ /**
+ * The QAEnvironment is an Environment that corresponds to the environment
+ * used by Qualudis for QA checks.
+ */
+ class QAEnvironment :
+ public QAEnvironmentBase,
+ public Environment
+ {
+ public:
+ QAEnvironment(const FSEntry & base);
+
+ ~QAEnvironment();
+
+ virtual std::string paludis_command() const;
+ };
+
+ class ProfilesDescError :
+ public ConfigurationError
+ {
+ public:
+ ProfilesDescError(const std::string & message) throw ();
+ };
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/qa_environment.sr b/0.8.0/paludis/qa/qa_environment.sr
new file mode 100644
index 0000000..c7e9909
--- /dev/null
+++ b/0.8.0/paludis/qa/qa_environment.sr
@@ -0,0 +1,14 @@
+#!/bin/bash
+# vim: set sw=4 sts=4 et :
+
+make_class_PackageDatabasesEntry()
+{
+ key arch UseFlagName
+ key location FSEntry
+ key status std::string
+ key package_database PackageDatabase::Pointer
+
+ allow_named_args
+}
+
+
diff --git a/0.8.0/paludis/qa/qa_environment_TEST.cc b/0.8.0/paludis/qa/qa_environment_TEST.cc
new file mode 100644
index 0000000..0e711fc
--- /dev/null
+++ b/0.8.0/paludis/qa/qa_environment_TEST.cc
@@ -0,0 +1,60 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 "qa_environment.hh"
+#include "check_result.hh"
+#include "file_check.hh"
+#include "create_metadata_check.hh"
+#include <paludis/util/fs_entry.hh>
+#include <test/test_framework.hh>
+#include <test/test_runner.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+using namespace test;
+
+namespace test_cases
+{
+ struct QAEnvironmentPaludisCommandTest : TestCase
+ {
+ QAEnvironmentPaludisCommandTest() : TestCase("paludis_command") { }
+
+ void run()
+ {
+ QAEnvironment env(FSEntry("qa_environment_TEST_dir/repo1"));
+
+ CheckResult r1((*(*EbuildCheckMaker::get_instance()->find_maker(
+ CreateMetadataCheck::identifier()))())(EbuildCheckData(
+ QualifiedPackageName("cat-one/pkg-one"), VersionSpec("1"), &env)));
+ {
+ TestMessageSuffix suffix("r1=" + join(r1.begin(), r1.end(), "; "), false);
+ TEST_CHECK(r1.empty());
+ }
+
+ CheckResult r2((*(*EbuildCheckMaker::get_instance()->find_maker(
+ CreateMetadataCheck::identifier()))())(EbuildCheckData(
+ QualifiedPackageName("cat-one/pkg-one"), VersionSpec("2"), &env)));
+ {
+ TestMessageSuffix suffix("r2=" + join(r2.begin(), r2.end(), "; "), false);
+ TEST_CHECK(! r2.empty());
+ }
+ }
+ } qa_environment_paludis_command_test;
+}
+
diff --git a/0.8.0/paludis/qa/qa_environment_TEST_cleanup.sh b/0.8.0/paludis/qa/qa_environment_TEST_cleanup.sh
new file mode 100755
index 0000000..02ed13f
--- /dev/null
+++ b/0.8.0/paludis/qa/qa_environment_TEST_cleanup.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+if [ -d qa_environment_TEST_dir ] ; then
+ rm -fr qa_environment_TEST_dir
+else
+ true
+fi
+
+
+
diff --git a/0.8.0/paludis/qa/qa_environment_TEST_setup.sh b/0.8.0/paludis/qa/qa_environment_TEST_setup.sh
new file mode 100755
index 0000000..6764e76
--- /dev/null
+++ b/0.8.0/paludis/qa/qa_environment_TEST_setup.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# vim: set ft=sh sw=4 sts=4 et :
+
+mkdir qa_environment_TEST_dir || exit 1
+cd qa_environment_TEST_dir || exit 1
+
+mkdir -p repo1/{eclass,distfiles,profiles/profile} || exit 1
+cd repo1 || exit 1
+echo "test-repo-1" > profiles/repo_name || exit 1
+cat <<END > profiles/categories || exit 1
+cat-one
+cat-two
+cat-three
+END
+cat <<END > profiles/profile/make.defaults
+ARCH=test
+END
+cat <<END > profiles/profiles.desc
+test profile/ stable
+END
+mkdir -p cat-one/pkg-one
+cat <<END > cat-one/pkg-one/pkg-one-1.ebuild
+DESCRIPTION="foo"
+SLOT="foo"
+END
+cat <<END > cat-one/pkg-one/pkg-one-2.ebuild
+DESCRIPTION="foo"
+if has_version foo ; then
+ SLOT="foo"
+else
+ SLOT="bar"
+fi
+END
+
+cd ..
+
diff --git a/0.8.0/paludis/qa/restrict_check.cc b/0.8.0/paludis/qa/restrict_check.cc
new file mode 100644
index 0000000..83d1609
--- /dev/null
+++ b/0.8.0/paludis/qa/restrict_check.cc
@@ -0,0 +1,97 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <algorithm>
+#include <iterator>
+#include <paludis/qa/restrict_check.hh>
+#include <paludis/util/tokeniser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+RestrictCheck::RestrictCheck()
+{
+}
+
+CheckResult
+RestrictCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ std::set<std::string> restricts;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+ tokeniser.tokenise(metadata->get_ebuild_interface()->restrict_string,
+ std::inserter(restricts, restricts.begin()));
+
+ static std::set<std::string> allowed_restricts;
+ if (allowed_restricts.empty())
+ {
+ allowed_restricts.insert("fetch");
+ allowed_restricts.insert("mirror");
+ allowed_restricts.insert("nomirror");
+ allowed_restricts.insert("primaryuri");
+ allowed_restricts.insert("nostrip");
+ allowed_restricts.insert("sandbox");
+ allowed_restricts.insert("userpriv");
+ allowed_restricts.insert("test");
+ }
+
+ std::set<std::string> unknown;
+ std::set_difference(restricts.begin(), restricts.end(),
+ allowed_restricts.begin(), allowed_restricts.end(),
+ std::inserter(unknown, unknown.begin()));
+
+ if (! unknown.empty())
+ result << Message(qal_major, "Unrecognised RESTRICT values '"
+ + join(unknown.begin(), unknown.end(), "', '") + "'");
+
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+RestrictCheck::identifier()
+{
+ static const std::string id("restrict");
+ return id;
+}
+
+
+
diff --git a/0.8.0/paludis/qa/restrict_check.hh b/0.8.0/paludis/qa/restrict_check.hh
new file mode 100644
index 0000000..6916c1c
--- /dev/null
+++ b/0.8.0/paludis/qa/restrict_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_RESTRICT_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_RESTRICT_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class RestrictCheck :
+ public EbuildCheck
+ {
+ public:
+ RestrictCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that RESTRICT is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_restrict_check(
+ RestrictCheck::identifier(), &MakeEbuildCheck<RestrictCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/slot_check.cc b/0.8.0/paludis/qa/slot_check.cc
new file mode 100644
index 0000000..931ce83
--- /dev/null
+++ b/0.8.0/paludis/qa/slot_check.cc
@@ -0,0 +1,73 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/qa/slot_check.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+SlotCheck::SlotCheck()
+{
+}
+
+CheckResult
+SlotCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ try
+ {
+ SlotName slot(metadata->slot);
+ }
+ catch (const NameError &)
+ {
+ result << Message(qal_fatal, "Invalid SLOT value");
+ }
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+SlotCheck::identifier()
+{
+ static const std::string id("slot");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/slot_check.hh b/0.8.0/paludis/qa/slot_check.hh
new file mode 100644
index 0000000..b8cd486
--- /dev/null
+++ b/0.8.0/paludis/qa/slot_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_SLOT_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_SLOT_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class SlotCheck :
+ public EbuildCheck
+ {
+ public:
+ SlotCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that SLOT is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_slot_check(
+ SlotCheck::identifier(), &MakeEbuildCheck<SlotCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/src_uri_check.cc b/0.8.0/paludis/qa/src_uri_check.cc
new file mode 100644
index 0000000..dd8b433
--- /dev/null
+++ b/0.8.0/paludis/qa/src_uri_check.cc
@@ -0,0 +1,193 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <paludis/dep_atom.hh>
+#include <paludis/portage_dep_parser.hh>
+#include <paludis/package_database_entry.hh>
+#include <paludis/environment.hh>
+#include <paludis/qa/src_uri_check.hh>
+#include <paludis/util/tokeniser.hh>
+#include <set>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+namespace
+{
+ struct Checker :
+ DepAtomVisitorTypes::ConstVisitor
+ {
+ CheckResult & result;
+ bool fetch_restrict;
+ const Environment * const env;
+
+ Checker(CheckResult & rr, bool f, const Environment * const e) :
+ result(rr),
+ fetch_restrict(f),
+ env(e)
+ {
+ }
+
+ void visit(const PlainTextDepAtom * const a)
+ {
+ if (a->text().empty())
+ return;
+
+ std::string::size_type p(std::string::npos);
+ if (std::string::npos == ((p = a->text().find("://"))) && ! fetch_restrict)
+ result << Message(qal_major, "No protocol found for '" + a->text() +
+ "' and not fetch restricted");
+
+ else if ((std::string::npos != p) &&
+ (("http" != a->text().substr(0, p)) &&
+ ("https" != a->text().substr(0, p)) &&
+ ("mirror" != a->text().substr(0, p)) &&
+ ("ftp" != a->text().substr(0, p))))
+ result << Message(qal_major, "Unrecognised protocol for '" + a->text() + "'");
+
+ else if ((std::string::npos != a->text().find("dev.gentoo.org")) ||
+ (std::string::npos != a->text().find("cvs.gentoo.org")) ||
+ (std::string::npos != a->text().find("toucan.gentoo.org")) ||
+ (std::string::npos != a->text().find("emu.gentoo.org")) ||
+ (std::string::npos != a->text().find("alpha.gnu.org")) ||
+ (std::string::npos != a->text().find("geocities.com")))
+ result << Message(qal_major, "Unreliable host for '" + a->text() + "'");
+
+ else
+ {
+ if (0 == a->text().compare(0, 9, "mirror://"))
+ {
+ std::string mirror_host(a->text().substr(9));
+ std::string::size_type pos(mirror_host.find('/'));
+ if (std::string::npos == pos)
+ result << Message(qal_major, "Malformed SRC_URI component '" + a->text() + "'");
+ else
+ {
+ mirror_host.erase(pos);
+ RepositoryMirrorsInterface * m(env->package_database()->fetch_repository(
+ env->package_database()->favourite_repository())->mirrors_interface);
+ if (! m)
+ result << Message(qal_major, "Mirror '" + a->text() + "' used, but repository '"
+ + stringify(env->package_database()->favourite_repository())
+ + "' defines no mirrors interface");
+ else if (! m->is_mirror(mirror_host))
+ result << Message(qal_major, "Unknown mirror '" + mirror_host
+ + "' for '" + a->text() + "'");
+ }
+ }
+ }
+ }
+
+ void visit(const AllDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
+ {
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const AnyDepAtom * const u)
+ {
+ result << Message(qal_major, "Unexpected || dep block");
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const PackageDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+ };
+
+ void
+ Checker::visit(const BlockDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected BlockDepAtom");
+ }
+
+ void
+ Checker::visit(const PackageDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected PackageDepAtom");
+ }
+}
+
+SrcUriCheck::SrcUriCheck()
+{
+}
+
+CheckResult
+SrcUriCheck::operator() (const EbuildCheckData & e) const
+{
+ CheckResult result(stringify(e.name) + "-" + stringify(e.version),
+ identifier());
+
+ try
+ {
+ do
+ {
+ PackageDatabaseEntry ee(e.name, e.version,
+ e.environment->package_database()->favourite_repository());
+ VersionMetadata::ConstPointer metadata(
+ e.environment->package_database()->fetch_repository(ee.repository)->version_metadata(ee.name, ee.version));
+
+ std::string src_uri(metadata->get_ebuild_interface()->src_uri);
+
+ DepAtom::ConstPointer src_uri_parts(0);
+ try
+ {
+ src_uri_parts = PortageDepParser::parse(src_uri,
+ PortageDepParserPolicy<PlainTextDepAtom, false>::get_instance());
+
+ std::set<std::string> restricts;
+ Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");
+ tokeniser.tokenise(metadata->get_ebuild_interface()->restrict_string,
+ std::inserter(restricts, restricts.begin()));
+
+ bool fetch_restrict(restricts.end() != restricts.find("fetch"));
+ Checker checker(result, fetch_restrict, e.environment);
+ src_uri_parts->accept(&checker);
+ }
+ catch (const DepStringError & err)
+ {
+ result << Message(qal_major, "Invalid SRC_URI: '" + err.message() + "' ("
+ + err.what() + ")");
+ break;
+ }
+ } while (false);
+ }
+ catch (const InternalError &)
+ {
+ throw;
+ }
+ catch (const Exception & err)
+ {
+ result << Message(qal_fatal, "Caught Exception '" + err.message() + "' ("
+ + err.what() + ")");
+ }
+
+ return result;
+}
+
+const std::string &
+SrcUriCheck::identifier()
+{
+ static const std::string id("src_uri");
+ return id;
+}
+
diff --git a/0.8.0/paludis/qa/src_uri_check.hh b/0.8.0/paludis/qa/src_uri_check.hh
new file mode 100644
index 0000000..fa3aba5
--- /dev/null
+++ b/0.8.0/paludis/qa/src_uri_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_SRC_URI_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_SRC_URI_CHECK_HH 1
+
+#include <paludis/qa/ebuild_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class SrcUriCheck :
+ public EbuildCheck
+ {
+ public:
+ SrcUriCheck();
+
+ CheckResult operator() (const EbuildCheckData &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks that SRC_URI is sane";
+ }
+ };
+
+ static const EbuildCheckMaker::RegisterMaker register_src_uri_check(
+ SrcUriCheck::identifier(), &MakeEbuildCheck<SrcUriCheck>::make_ebuild_check);
+ }
+}
+
+#endif
diff --git a/0.8.0/paludis/qa/whitespace_check.cc b/0.8.0/paludis/qa/whitespace_check.cc
new file mode 100644
index 0000000..b475c39
--- /dev/null
+++ b/0.8.0/paludis/qa/whitespace_check.cc
@@ -0,0 +1,123 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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 <fstream>
+#include <paludis/qa/whitespace_check.hh>
+#include <paludis/util/is_file_with_extension.hh>
+
+using namespace paludis;
+using namespace paludis::qa;
+
+WhitespaceCheck::WhitespaceCheck()
+{
+}
+
+CheckResult
+WhitespaceCheck::operator() (const FSEntry & f) const
+{
+ CheckResult result(f, identifier());
+
+ if (! f.is_regular_file())
+ result << Message(qal_skip, "Not a regular file");
+ else if (! IsFileWithExtension(".ebuild")(f) &&
+ ! IsFileWithExtension(".xml")(f) &&
+ ! IsFileWithExtension(".eclass")(f))
+ result << Message(qal_skip, "Not an ebuild, eclass or xml file");
+ else
+ {
+ std::ifstream ff(stringify(f).c_str());
+ if (! ff)
+ result << Message(qal_major, "Can't read file");
+ else
+ {
+ std::string s;
+ unsigned line_number(0);
+ unsigned err_count(0);
+ while (std::getline(ff, s))
+ {
+ if (err_count >= 3)
+ {
+ result << Message(qal_info, "Skipping further whitespace checks");
+ break;
+ }
+
+ ++line_number;
+
+ if (s.empty())
+ continue;
+
+ if (' ' == s.at(0))
+ {
+ result << Message(qal_minor, "Spaces for indenting on line "
+ + stringify(line_number));
+ ++err_count;
+ continue;
+ }
+
+ if ('\t' == s.at(0))
+ {
+ std::string::size_type p(s.find_first_not_of("\t"));
+ if (std::string::npos == p)
+ {
+ result << Message(qal_minor, "Indent followed by no content on line "
+ + stringify(line_number));
+ ++err_count;
+ continue;
+ }
+
+ if (' ' == s.at(p))
+ {
+ result << Message(qal_minor, "Mixed spaces and tabs on line "
+ + stringify(line_number));
+ ++err_count;
+ continue;
+ }
+
+ p = s.find(p, '\t');
+ if (std::string::npos != p)
+ {
+ result << Message(qal_minor, "Non-indent tab found on line "
+ + stringify(line_number));
+ ++err_count;
+ continue;
+ }
+ }
+
+ if (' ' == s.at(s.length() - 1) || '\t' == s.at(s.length() - 1))
+ {
+ result << Message(qal_minor, "Trailing whitespace found on line "
+ + stringify(line_number));
+ ++err_count;
+ continue;
+ }
+ }
+ }
+ }
+
+ return result;
+}
+
+const std::string &
+WhitespaceCheck::identifier()
+{
+ static const std::string id("whitespace");
+ return id;
+}
+
+
diff --git a/0.8.0/paludis/qa/whitespace_check.hh b/0.8.0/paludis/qa/whitespace_check.hh
new file mode 100644
index 0000000..6a8a3ec
--- /dev/null
+++ b/0.8.0/paludis/qa/whitespace_check.hh
@@ -0,0 +1,51 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 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_QA_WHITESPACE_CHECK_HH
+#define PALUDIS_GUARD_PALUDIS_QA_WHITESPACE_CHECK_HH 1
+
+#include <paludis/qa/file_check.hh>
+#include <string>
+
+namespace paludis
+{
+ namespace qa
+ {
+ class WhitespaceCheck :
+ public FileCheck
+ {
+ public:
+ WhitespaceCheck();
+
+ CheckResult operator() (const FSEntry &) const;
+
+ static const std::string & identifier();
+
+ virtual std::string describe() const
+ {
+ return "Checks whitespace";
+ }
+ };
+
+ static const FileCheckMaker::RegisterMaker register_whitespace_check(
+ WhitespaceCheck::identifier(), &MakeFileCheck<WhitespaceCheck>::make_file_check);
+ }
+}
+
+#endif