aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-25 19:17:07 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-08-25 19:17:07 +0000
commit98abd63e73767e3b154ca73f03f5d375560fb39b (patch)
tree2d301de5ab55a0cd6d4807d5267564eaad00e110
parente8d4ed3a9ec641707d10b2388b42ab8499a9374f (diff)
downloadpaludis-98abd63e73767e3b154ca73f03f5d375560fb39b.tar.gz
paludis-98abd63e73767e3b154ca73f03f5d375560fb39b.tar.xz
QA now needs pcre++. Make defaults_check work again.
-rw-r--r--configure.ac16
-rw-r--r--paludis/qa/Makefile.am.m45
-rw-r--r--paludis/qa/defaults_check.cc55
-rw-r--r--paludis/qa/defaults_check.hh2
-rw-r--r--paludis/qa/defaults_check_TEST.cc60
-rwxr-xr-xpaludis/qa/defaults_check_TEST_cleanup.sh12
-rwxr-xr-xpaludis/qa/defaults_check_TEST_setup.sh43
-rw-r--r--paludis/qa/files.m42
-rw-r--r--paludis/qa/whitespace_check.cc6
-rw-r--r--src/gtkpaludis/Makefile.am4
-rw-r--r--src/gtkpaludis/vtemm/Makefile.am2
-rw-r--r--src/qualudis/Makefile.am3
12 files changed, 163 insertions, 47 deletions
diff --git a/configure.ac b/configure.ac
index 2e366f5..085636d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -362,11 +362,19 @@ dnl }}}
dnl {{{ check for whether to build qa stuff
AC_MSG_CHECKING([whether to build QA tools])
AC_ARG_ENABLE([qa],
- [ --enable-qa Build QA things (qualudis) (maybe broken)],
+ [ --enable-qa Build QA things (needs pcre++)],
[ENABLE_QA=$enableval
AC_MSG_RESULT([$enableval])],
[ENABLE_QA=no
AC_MSG_RESULT([no])])
+if test x"$ENABLE_QA" = "xyes" ; then
+ AC_CHECK_PROG(HAVE_PRCEPLUSPLUS, [pcre++-config], [yes],
+ [AC_MSG_ERROR([pcre++ is needed for --enable-qa])])
+ PCREPLUSPLUS_CFLAGS=`pcre++-config --cflags`
+ AC_SUBST(PCREPLUSPLUS_CFLAGS)
+ PCREPLUSPLUS_LIBS=`pcre++-config --libs`
+ AC_SUBST(PCREPLUSPLUS_LIBS)
+fi
AC_SUBST([ENABLE_QA])
AM_CONDITIONAL([ENABLE_QA], test "x$ENABLE_QA" = "xyes")
dnl }}}
@@ -455,9 +463,9 @@ if test "x$enable_gtk" = "xyes"; then
AC_SUBST(GMMPROC_DIR)
GMMPROC=$GMMPROC_DIR/gmmproc
AC_SUBST(GMMPROC)
- PKG_CHECK_MODULES(DEPS, [gtkmm-2.4 >= 2.6.0 glibmm-2.4 >= 2.6.0 pangomm-1.4 gdkmm-2.4 vte >= 0.12.1])
- AC_SUBST(DEPS_CFLAGS)
- AC_SUBST(DEPS_LIBS)
+ PKG_CHECK_MODULES(GTKDEPS, [gtkmm-2.4 >= 2.6.0 glibmm-2.4 >= 2.6.0 pangomm-1.4 gdkmm-2.4 vte >= 0.12.1])
+ AC_SUBST(GTKDEPS_CFLAGS)
+ AC_SUBST(GTKDEPS_LIBS)
fi
AM_CONDITIONAL([ENABLE_GTK], test "x$enable_gtk" = "xyes")
diff --git a/paludis/qa/Makefile.am.m4 b/paludis/qa/Makefile.am.m4
index ca944c3..93219fe 100644
--- a/paludis/qa/Makefile.am.m4
+++ b/paludis/qa/Makefile.am.m4
@@ -18,7 +18,8 @@ $1_TEST_LDADD = \
libpaludisqa.la \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
- $(DYNAMIC_LD_LIBS)
+ $(DYNAMIC_LD_LIBS) \
+ $(PCREPLUSPLUS_LIBS)
$1_TEST_CXXFLAGS = -I$(top_srcdir)
')dnl
define(`addtestscript', `define(`testscriptlist', testscriptlist `$1_TEST_setup.sh $1_TEST_cleanup.sh')')dnl
@@ -49,6 +50,8 @@ include(`paludis/qa/files.m4')
if ENABLE_QA
+INCLUDES = $(PCREPLUSPLUS_CFLAGS)
+
libpaludisqa_la_SOURCES = filelist
libpaludisqa_la_LDFLAGS = -version-info @VERSION_LIB_CURRENT@:@VERSION_LIB_REVISION@:0
diff --git a/paludis/qa/defaults_check.cc b/paludis/qa/defaults_check.cc
index fce4a7a..36c12ad 100644
--- a/paludis/qa/defaults_check.cc
+++ b/paludis/qa/defaults_check.cc
@@ -20,7 +20,7 @@
#include <fstream>
#include <paludis/qa/defaults_check.hh>
#include <paludis/util/is_file_with_extension.hh>
-#include <paludis/util/match_sequence.hh>
+#include <pcre++.h>
using namespace paludis;
using namespace paludis::qa;
@@ -44,25 +44,18 @@ DefaultsCheck::operator() (const FSEntry & f) const
{
CheckResult result(f, identifier());
- static const MatchRule r_echo(*MatchRule("\t") >> MatchRule("echo"));
- static const MatchRule r_einfo(*MatchRule("\t") >> MatchRule("einfo"));
- static const MatchRule r_colon(*MatchRule("\t") >> MatchRule(":"));
- static const MatchRule r_true(*MatchRule("\t") >> MatchRule("true"));
- static const MatchRule r_comment(*MatchRule("\t") >> MatchRule("#"));
- static const MatchRule r_econf(*MatchRule("\t") >> MatchRule("econf") >> *MatchRule(" ")
- >> (MatchRule::eol() || (MatchRule("||") >> *MatchRule(" ") >> MatchRule("die"))));
- static const MatchRule r_emake(*MatchRule("\t") >> MatchRule("emake") >> *MatchRule(" ")
- >> (MatchRule::eol() || (MatchRule("||") >> *MatchRule(" ") >> MatchRule("die"))));
- static const MatchRule r_unpack(*MatchRule("\t") >> MatchRule("unpack") >> *MatchRule(" ")
- >> (MatchRule("\"$A\"") || MatchRule("\"${A}\"") || MatchRule("$A") || MatchRule("${A}"))
- >> (MatchRule::eol() || (MatchRule("||") >> *MatchRule(" ") >> MatchRule("die"))));
- static const MatchRule r_cd_s(*MatchRule("\t") >> MatchRule("cd") >> *MatchRule(" ")
- >> (MatchRule("\"$S\"") || MatchRule("\"${S}\"") || MatchRule("$S") || MatchRule("${S}"))
- >> (MatchRule::eol() || (MatchRule("||") >> *MatchRule(" ") >> MatchRule("die"))));
+ 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.basename()))
+ else if (! IsFileWithExtension(".ebuild")(f))
result << Message(qal_skip, "Not an ebuild file");
else
{
@@ -98,19 +91,17 @@ DefaultsCheck::operator() (const FSEntry & f) const
}
else if (line.empty())
;
- else if (r_econf.match(line))
+ else if (r_econf.search(line))
;
- else if (r_emake.match(line))
+ else if (r_emake.search(line))
;
- else if (r_echo.match(line))
+ else if (r_echo.search(line))
;
- else if (r_einfo.match(line))
+ else if (r_colon.search(line))
;
- else if (r_colon.match(line))
+ else if (r_true.search(line))
;
- else if (r_true.match(line))
- ;
- else if (r_comment.match(line))
+ else if (r_comment.search(line))
;
else
src_compile_changed = true;
@@ -127,19 +118,17 @@ DefaultsCheck::operator() (const FSEntry & f) const
}
else if (line.empty())
;
- else if (r_unpack.match(line))
- ;
- else if (r_cd_s.match(line))
+ else if (r_unpack.search(line))
;
- else if (r_echo.match(line))
+ else if (r_cd_s.search(line))
;
- else if (r_einfo.match(line))
+ else if (r_echo.search(line))
;
- else if (r_colon.match(line))
+ else if (r_colon.search(line))
;
- else if (r_true.match(line))
+ else if (r_true.search(line))
;
- else if (r_comment.match(line))
+ else if (r_comment.search(line))
;
else
src_unpack_changed = true;
diff --git a/paludis/qa/defaults_check.hh b/paludis/qa/defaults_check.hh
index 4dee39f..9cc2ffc 100644
--- a/paludis/qa/defaults_check.hh
+++ b/paludis/qa/defaults_check.hh
@@ -38,8 +38,6 @@ namespace paludis
static const std::string & identifier();
- static void check_utf8(std::istream &, CheckResult &);
-
virtual std::string describe() const
{
return "Checks for default function reimplementations";
diff --git a/paludis/qa/defaults_check_TEST.cc b/paludis/qa/defaults_check_TEST.cc
new file mode 100644
index 0000000..810ec46
--- /dev/null
+++ b/paludis/qa/defaults_check_TEST.cc
@@ -0,0 +1,60 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2006 Ciaran McCreesh <ciaran.mccreesh@blueyonder.co.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 "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/paludis/qa/defaults_check_TEST_cleanup.sh b/paludis/qa/defaults_check_TEST_cleanup.sh
new file mode 100755
index 0000000..225d6fe
--- /dev/null
+++ b/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/paludis/qa/defaults_check_TEST_setup.sh b/paludis/qa/defaults_check_TEST_setup.sh
new file mode 100755
index 0000000..98d7cb9
--- /dev/null
+++ b/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/paludis/qa/files.m4 b/paludis/qa/files.m4
index cca3dfc..fee6f9c 100644
--- a/paludis/qa/files.m4
+++ b/paludis/qa/files.m4
@@ -12,7 +12,7 @@ add(`changelog_check', `hh', `cc')
add(`check', `hh', `cc')
add(`check_result', `hh', `cc', `test')
add(`create_metadata_check', `hh', `cc')
-dnl add(`defaults_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')
diff --git a/paludis/qa/whitespace_check.cc b/paludis/qa/whitespace_check.cc
index af729bc..bcf4632 100644
--- a/paludis/qa/whitespace_check.cc
+++ b/paludis/qa/whitespace_check.cc
@@ -35,9 +35,9 @@ WhitespaceCheck::operator() (const FSEntry & f) const
if (! f.is_regular_file())
result << Message(qal_skip, "Not a regular file");
- else if (! IsFileWithExtension(".ebuild")(f.basename()) &&
- ! IsFileWithExtension(".xml")(f.basename()) &&
- ! IsFileWithExtension(".eclass")(f.basename()))
+ else if (! IsFileWithExtension(".ebuild")(f) &&
+ ! IsFileWithExtension(".xml")(f) &&
+ ! IsFileWithExtension(".eclass")(f))
result << Message(qal_skip, "Not an ebuild, eclass or xml file");
else
{
diff --git a/src/gtkpaludis/Makefile.am b/src/gtkpaludis/Makefile.am
index 5c1c9b3..55cf6e0 100644
--- a/src/gtkpaludis/Makefile.am
+++ b/src/gtkpaludis/Makefile.am
@@ -10,7 +10,7 @@ DEFS = \
SUBDIRS = vtemm .
-INCLUDES = $(DEPS_CFLAGS)
+INCLUDES = $(GTKDEPS_CFLAGS)
if ENABLE_GTK
@@ -31,7 +31,7 @@ gtkpaludis_LDADD = \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
$(top_builddir)/src/gtkpaludis/vtemm/libvtemm.a \
- $(DEPS_LIBS) \
+ $(GTKDEPS_LIBS) \
$(DYNAMIC_LD_LIBS)
endif
diff --git a/src/gtkpaludis/vtemm/Makefile.am b/src/gtkpaludis/vtemm/Makefile.am
index 5873edc..7091935 100644
--- a/src/gtkpaludis/vtemm/Makefile.am
+++ b/src/gtkpaludis/vtemm/Makefile.am
@@ -60,7 +60,7 @@ noinst_LIBRARIES = libvtemm.a
nodist_libvtemm_a_SOURCES = \
$(vte_generated_sources)
-INCLUDES = $(DEPS_CFLAGS)
+INCLUDES = $(GTKDEPS_CFLAGS)
clean-local :
rm -fr private || true
diff --git a/src/qualudis/Makefile.am b/src/qualudis/Makefile.am
index f2cdae5..7a1970c 100644
--- a/src/qualudis/Makefile.am
+++ b/src/qualudis/Makefile.am
@@ -22,8 +22,11 @@ qualudis_LDADD = \
$(top_builddir)/paludis/libpaludis.la \
$(top_builddir)/paludis/args/libpaludisargs.la \
$(top_builddir)/paludis/util/libpaludisutil.la \
+ $(PCREPLUSPLUS_LIBS) \
$(DYNAMIC_LD_LIBS)
+INCLUDES = $(PCREPLUSPLUS_CFLAGS)
+
TESTS_ENVIRONMENT = env \
TEST_SCRIPT_DIR="$(srcdir)/" \
PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \