aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-13 16:08:16 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-13 16:08:16 +0000
commita9ed255e689160dd14e5665bfa301fc57b097682 (patch)
treec05f6361cfc766bcd54e7dc9ade58672473833b4
parent2aab5c6d62d68c09b35a6166a586ae3fbf7e8f13 (diff)
downloadpaludis-a9ed255e689160dd14e5665bfa301fc57b097682.tar.gz
paludis-a9ed255e689160dd14e5665bfa301fc57b097682.tar.xz
Start to move QA stuff into a library.
-rwxr-xr-xautogen.bash2
-rw-r--r--configure.ac1
-rw-r--r--doc/doc_main.doxygen7
-rw-r--r--doc/doc_namespaces.doxygen6
-rw-r--r--paludis/Makefile.am.m42
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/qa/Makefile.am.m454
-rw-r--r--paludis/qa/environment.cc (renamed from paludis/qa_environment.cc)3
-rw-r--r--paludis/qa/environment.hh (renamed from paludis/qa_environment.hh)37
-rw-r--r--paludis/qa/files.m412
-rw-r--r--paludis/qa/qa.hh.m438
-rw-r--r--src/qualudis/Makefile.am3
-rw-r--r--src/qualudis/qualudis.cc3
13 files changed, 148 insertions, 21 deletions
diff --git a/autogen.bash b/autogen.bash
index 8d73852..9030cb2 100755
--- a/autogen.bash
+++ b/autogen.bash
@@ -27,6 +27,8 @@ get() {
misc/do_m4.bash paludis/Makefile.am || exit $?
misc/do_m4.bash paludis/paludis.hh || exit $?
+misc/do_m4.bash paludis/qa/Makefile.am || exit $?
+misc/do_m4.bash paludis/qa/qa.hh || exit $?
misc/do_m4.bash paludis/smart_record.hh || exit $?
misc/do_m4.bash paludis/comparison_policy.hh || exit $?
run mkdir -p config
diff --git a/configure.ac b/configure.ac
index a696281..db4dfc1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -285,6 +285,7 @@ AC_OUTPUT(
paludis/about.hh
paludis/hashed_containers.hh
paludis/args/Makefile
+ paludis/qa/Makefile
src/Makefile
src/qualudis/Makefile
test/Makefile
diff --git a/doc/doc_main.doxygen b/doc/doc_main.doxygen
index 2e23fe2..aa3d30f 100644
--- a/doc/doc_main.doxygen
+++ b/doc/doc_main.doxygen
@@ -199,3 +199,10 @@ instance of a TestCase subclass will register it with the test case
list.
*/
+/** \defgroup QA QA Checks
+QA Checks.
+
+Various QA checks that can be applied to packages or ebuilds.
+*/
+
+
diff --git a/doc/doc_namespaces.doxygen b/doc/doc_namespaces.doxygen
index 66385b6..c26b6eb 100644
--- a/doc/doc_namespaces.doxygen
+++ b/doc/doc_namespaces.doxygen
@@ -18,6 +18,12 @@
* \ingroup Args
*/
+/** \namespace paludis::qa
+ * QA checks.
+ *
+ * \ingroup Args
+ */
+
/** \namespace paludis
* Paludis library code.
*/
diff --git a/paludis/Makefile.am.m4 b/paludis/Makefile.am.m4
index 0fe6dab..026a08b 100644
--- a/paludis/Makefile.am.m4
+++ b/paludis/Makefile.am.m4
@@ -33,7 +33,7 @@ AM_CXXFLAGS = -I$(top_srcdir)
DEFS=-DSYSCONFDIR=\"$(sysconfdir)\" -DLIBEXECDIR=\"$(libexecdir)\"
EXTRA_DIST = about.hh.in Makefile.am.m4 paludis.hh.m4 files.m4 smart_record.hh.m4 \
comparison_policy.hh.m4 hashed_containers.hh.in testscriptlist test_extras.cc
-SUBDIRS = . args
+SUBDIRS = . args qa
libpaludis_a_SOURCES = filelist
diff --git a/paludis/files.m4 b/paludis/files.m4
index 73c161c..980d779 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -61,7 +61,6 @@ add(`paludis', `hh', `cc')
add(`portage_repository', `hh', `cc')
add(`private_implementation_pattern', `hh', `cc')
add(`pstream', `hh', `cc', `test')
-add(`qa_environment', `hh', `cc')
add(`qualified_package_name', `hh', `cc', `test')
add(`repository', `hh', `cc')
add(`repository_name', `hh', `cc')
diff --git a/paludis/qa/Makefile.am.m4 b/paludis/qa/Makefile.am.m4
new file mode 100644
index 0000000..0f4b37c
--- /dev/null
+++ b/paludis/qa/Makefile.am.m4
@@ -0,0 +1,54 @@
+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(`testscriptlist', `')dnl
+define(`addtest', `define(`testlist', testlist `$1_TEST')dnl
+$1_TEST_SOURCES = $1_TEST.cc
+$1_TEST_LDADD = test_extras.o $(top_builddir)/test/libtest.a \
+ $(top_builddir)/test/libpaludis.a libpaludisqa.a
+$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')')dnl
+define(`addcc', `define(`filelist', filelist `$1.cc')')dnl
+define(`addimpl', `define(`filelist', filelist `$1-impl.hh')')dnl
+define(`addthis', `dnl
+ifelse(`$2', `hh', `addhh(`$1')', `')dnl
+ifelse(`$2', `cc', `addcc(`$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')
+
+CLEANFILES = *~
+MAINTAINERCLEANFILES = Makefile.in Makefile.am qa.hh
+AM_CXXFLAGS = -I$(top_srcdir)
+DEFS=-DSYSCONFDIR=\"$(sysconfdir)\" -DLIBEXECDIR=\"$(libexecdir)\"
+EXTRA_DIST = Makefile.am.m4 files.m4 qa.hh.m4
+
+libpaludisqa_a_SOURCES = filelist
+
+TESTS = testlist
+
+TESTS_ENVIRONMENT = env \
+ PALUDIS_EBUILD_DIR="$(srcdir)/ebuild/" \
+ TEST_SCRIPT_DIR="$(srcdir)/" \
+ $(SHELL) $(top_srcdir)/test/run_test.sh
+
+check_PROGRAMS = $(TESTS)
+check_SCRIPTS = testscriptlist
+noinst_LIBRARIES = libpaludisqa.a
+
+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
+
diff --git a/paludis/qa_environment.cc b/paludis/qa/environment.cc
index 92f7820..645628f 100644
--- a/paludis/qa_environment.cc
+++ b/paludis/qa/environment.cc
@@ -17,10 +17,11 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "qa_environment.hh"
+#include "environment.hh"
#include <map>
using namespace paludis;
+using namespace paludis::qa;
QAEnvironment::QAEnvironment(const FSEntry & base) :
Environment(PackageDatabase::Pointer(new PackageDatabase),
diff --git a/paludis/qa_environment.hh b/paludis/qa/environment.hh
index 7252600..df9b27b 100644
--- a/paludis/qa_environment.hh
+++ b/paludis/qa/environment.hh
@@ -28,32 +28,37 @@
* Declarations for the QAEnvironment class.
*
* \ingroup Environment
+ * \ingroup QA
*/
namespace paludis
{
- /**
- * The QAEnvironment is an Environment that corresponds to the environment
- * used by Qualudis for QA checks.
- *
- * \ingroup Environment
- */
- class QAEnvironment :
- public Environment
+ namespace qa
{
- public:
- QAEnvironment(const FSEntry & base);
+ /**
+ * The QAEnvironment is an Environment that corresponds to the environment
+ * used by Qualudis for QA checks.
+ *
+ * \ingroup Environment
+ * \ingroup QA
+ */
+ class QAEnvironment :
+ public Environment
+ {
+ public:
+ QAEnvironment(const FSEntry & base);
- ~QAEnvironment();
+ ~QAEnvironment();
- virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
+ virtual bool query_use(const UseFlagName &, const PackageDatabaseEntry *) const;
- virtual bool accept_keyword(const KeywordName &, const PackageDatabaseEntry * const) const;
+ virtual bool accept_keyword(const KeywordName &, const PackageDatabaseEntry * const) const;
- virtual bool query_user_masks(const PackageDatabaseEntry &) const;
+ virtual bool query_user_masks(const PackageDatabaseEntry &) const;
- virtual bool query_user_unmasks(const PackageDatabaseEntry &) const;
- };
+ virtual bool query_user_unmasks(const PackageDatabaseEntry &) const;
+ };
+ }
}
#endif
diff --git a/paludis/qa/files.m4 b/paludis/qa/files.m4
new file mode 100644
index 0000000..084641f
--- /dev/null
+++ b/paludis/qa/files.m4
@@ -0,0 +1,12 @@
+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(`environment', `hh', `cc')
+
diff --git a/paludis/qa/qa.hh.m4 b/paludis/qa/qa.hh.m4
new file mode 100644
index 0000000..5f31075
--- /dev/null
+++ b/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@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_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/src/qualudis/Makefile.am b/src/qualudis/Makefile.am
index 3293b24..9c17585 100644
--- a/src/qualudis/Makefile.am
+++ b/src/qualudis/Makefile.am
@@ -17,7 +17,8 @@ qualudis_SOURCES = \
qualudis_LDADD = \
$(top_builddir)/paludis/libpaludis.a \
- $(top_builddir)/paludis/args/libpaludisargs.a
+ $(top_builddir)/paludis/args/libpaludisargs.a \
+ $(top_builddir)/paludis/qa/libpaludisqa.a
TESTS_ENVIRONMENT = env TEST_SCRIPT_DIR="$(srcdir)/" $(SHELL) $(top_srcdir)/test/run_test.sh bash
TESTS = version_TEST
diff --git a/src/qualudis/qualudis.cc b/src/qualudis/qualudis.cc
index 48a1f38..798cdd2 100644
--- a/src/qualudis/qualudis.cc
+++ b/src/qualudis/qualudis.cc
@@ -19,6 +19,7 @@
#include <paludis/paludis.hh>
#include <paludis/args/args.hh>
+#include <paludis/qa/qa.hh>
#include <cstdlib>
#include <iostream>
@@ -85,7 +86,7 @@ do_check()
break;
}
- QAEnvironment env(cwd.dirname().dirname());
+ qa::QAEnvironment env(cwd.dirname().dirname());
for (DirIterator d(cwd), d_end ; d != d_end ; ++d)
{