diff options
author | 2009-10-20 22:10:36 +0100 | |
---|---|---|
committer | 2009-10-20 22:10:36 +0100 | |
commit | 9f94ffc79bbebf2523b987840eb40a69d30cc9f0 (patch) | |
tree | 4f63e61b98228a91e7085cf19f902e09a483523c | |
parent | 9986c514a1f13287b3f36804a9aa3092229050ee (diff) | |
download | paludis-9f94ffc79bbebf2523b987840eb40a69d30cc9f0.tar.gz paludis-9f94ffc79bbebf2523b987840eb40a69d30cc9f0.tar.xz |
Kill QA, qualudis
Pretty much a lost cause on Gentoo, and for Exherbo we'll do this
differently.
137 files changed, 6 insertions, 10961 deletions
diff --git a/Makefile.am b/Makefile.am index 3726cf0a2..ca518e2d3 100644 --- a/Makefile.am +++ b/Makefile.am @@ -6,7 +6,7 @@ AUTOMAKE_OPTIONS = dist-bzip2 no-dist-gzip std-options foreign EXTRA_DIST = autogen.bash automake-deps-dist-hack.tmp SUBDIRS = . misc test paludis python ruby src doc hooks vim bash-completion zsh-completion pkg-config -DISTCHECK_CONFIGURE_FLAGS = --enable-qa --enable-ruby --enable-ruby-doc --enable-vim \ +DISTCHECK_CONFIGURE_FLAGS = --enable-ruby --enable-ruby-doc --enable-vim \ --enable-python --enable-python-doc --enable-xml \ --with-ruby-install-dir='$${DESTDIR}$${prefix}/ruby_dir' \ --with-hacked-log-dir='$${DESTDIR}$${prefix}/log_dir' \ diff --git a/configure.ac b/configure.ac index 4ecec83cb..169d9cb96 100644 --- a/configure.ac +++ b/configure.ac @@ -908,23 +908,6 @@ AC_ARG_ENABLE([htmltidy], AC_SUBST([HAVE_HTMLTIDY]) AM_CONDITIONAL([HAVE_HTMLTIDY], test "x$HAVE_HTMLTIDY" = "xyes") -dnl {{{ check for whether to build qa stuff -AC_MSG_CHECKING([whether to build QA tools]) -AC_ARG_ENABLE([qa], - AS_HELP_STRING([--enable-qa], [Build QA things (needs pcrecpp)]), - [ENABLE_QA=$enableval - AC_MSG_RESULT([$enableval])], - [ENABLE_QA=no - AC_MSG_RESULT([no])]) -if test x"$ENABLE_QA" = "xyes" ; then - need_pcrecpp_check=yes - AC_DEFINE([ENABLE_RUBY_QA], [1], [Enable QA support in ruby]) - AC_DEFINE([ENABLE_QA], [1], [Build QA things]) -fi -AC_SUBST([ENABLE_QA]) -AM_CONDITIONAL([ENABLE_QA], test "x$ENABLE_QA" = "xyes") -dnl }}} - dnl {{{ check for whether to build xml stuff AC_MSG_CHECKING([whether to build xml things for metadata.xml and GLSA support]) AC_ARG_ENABLE([xml], @@ -1412,7 +1395,7 @@ AC_DEFINE_UNQUOTED([DEFAULT_DISTRIBUTION], "$DEFAULT_DISTRIBUTION", [Default dis dnl }}} dnl {{{ clients -ALL_CLIENTS="accerso adjutrix appareo cave importare inquisitio instruo paludis qualudis reconcilio" +ALL_CLIENTS="accerso adjutrix appareo cave importare inquisitio instruo paludis reconcilio" ALL_CLIENTS_HTML="" for a in $ALL_CLIENTS ; do if test x$a = xcave ; then @@ -1422,16 +1405,12 @@ for a in $ALL_CLIENTS ; do fi done DEFAULT_CLIENTS="adjutrix importare paludis reconcilio" -if test x"$ENABLE_QA" = "xyes" ; then - DEFAULT_CLIENTS="$DEFAULT_CLIENTS qualudis" -fi AC_MSG_CHECKING([which clients to build...]) AC_ARG_WITH([clients], [ --with-clients=foo,bar,... Build the specified clients: all All available clients default Equivalent to adjutrix,importare,paludis,reconcilio - Also includes qualudis if --enable-qa accerso A fetch / mirror client adjutrix A tool for tree querying @@ -1441,8 +1420,7 @@ AC_ARG_WITH([clients], inquisitio A search client instruo A metadata generation client paludis The Paludis console client - reconcilio A linkage repair tool - qualudis The QA console client], + reconcilio A linkage repair tool], [clients="`echo $with_clients | tr ',' ' '`"], [clients="$DEFAULT_CLIENTS"]) clients=`echo $clients | tr ' ' '\n' \ @@ -1488,7 +1466,7 @@ dnl }}} dnl {{{ pcrecpp check if test "x$need_pcrecpp_check" = "xyes" ; then PKG_CHECK_MODULES(PCRECPPDEPS, [libpcrecpp >= 7.8], [], - [AC_MSG_ERROR([pcrecpp (http://www.pcre.org/) is required if --enable-qa or --with-clients=inquisitio is used])]) + [AC_MSG_ERROR([pcrecpp (http://www.pcre.org/) is required if --with-clients=inquisitio is used])]) AC_SUBST(PCRECPPDEPS_CFLAGS) AC_SUBST(PCRECPPDEPS_LIBS) fi @@ -1641,7 +1619,6 @@ AC_OUTPUT( paludis/repositories/e/ebuild/utils/3/Makefile paludis/repositories/e/ebuild/utils/exheres-0/Makefile paludis/repositories/e/ebuild/utils/kdebuild-1/Makefile - paludis/repositories/e/qa/Makefile paludis/repositories/fake/Makefile paludis/repositories/gems/Makefile paludis/repositories/unavailable/Makefile @@ -1667,7 +1644,6 @@ AC_OUTPUT( src/clients/inquisitio/Makefile src/clients/instruo/Makefile src/clients/paludis/Makefile - src/clients/qualudis/Makefile src/clients/reconcilio/Makefile src/clients/reconcilio/broken_linkage_finder/Makefile src/clients/reconcilio/littlelf/Makefile diff --git a/paludis/files.m4 b/paludis/files.m4 index 2515358de..12ac5da75 100644 --- a/paludis/files.m4 +++ b/paludis/files.m4 @@ -66,7 +66,6 @@ add(`package_database', `hh', `cc', `fwd', `test') add(`package_dep_spec_properties', `hh', `cc', `fwd') add(`package_id', `hh', `cc', `fwd', `se') add(`paludis', `hh') -add(`qa', `hh', `cc', `fwd', `se') add(`query_visitor', `hh', `cc') add(`range_rewriter', `hh', `cc', `test') add(`report_task', `hh', `cc') diff --git a/paludis/qa-fwd.hh b/paludis/qa-fwd.hh deleted file mode 100644 index 209767aa0..000000000 --- a/paludis/qa-fwd.hh +++ /dev/null @@ -1,48 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_QA_FWD_HH -#define PALUDIS_GUARD_PALUDIS_QA_FWD_HH 1 - -#include <paludis/util/attributes.hh> -#include <paludis/util/options-fwd.hh> -#include <iosfwd> - -/** \file - * Forward declarations for paludis/qa.hh . - * - * \ingroup g_repository - */ - -namespace paludis -{ - class QAReporter; - -#include <paludis/qa-se.hh> - - /** - * A collection of properties for a QA check. - * - * \since 0.26 - * \ingroup g_repository - */ - typedef Options<QACheckProperty> QACheckProperties; -} - -#endif diff --git a/paludis/qa.cc b/paludis/qa.cc deleted file mode 100644 index 413ee3766..000000000 --- a/paludis/qa.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/qa.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/sequence-impl.hh> -#include <paludis/util/set-impl.hh> - -using namespace paludis; - -#include <paludis/qa-se.cc> - -template class Set<std::tr1::shared_ptr<const PackageID>, PackageIDSetComparator>; -template class Sequence<std::tr1::shared_ptr<const MetadataKey> >; - -QAReporter::~QAReporter() -{ -} - -std::tr1::shared_ptr<PackageIDSet> -QAMessage::default_associated_ids() -{ - return std::tr1::shared_ptr<PackageIDSet>(new PackageIDSet); -} - -std::tr1::shared_ptr<QAMessage::KeysSequence> -QAMessage::default_associated_keys() -{ - return std::tr1::shared_ptr<KeysSequence>(new KeysSequence); -} - -QAMessage & -QAMessage::with_associated_id(const std::tr1::shared_ptr<const PackageID> & id) -{ - associated_ids()->insert(id); - return *this; -} - -QAMessage & -QAMessage::with_associated_key(const std::tr1::shared_ptr<const PackageID> & id, - const std::tr1::shared_ptr<const MetadataKey> & k) -{ - associated_keys()->push_back(std::make_pair(id, k)); - return *this; -} - -QAMessage::QAMessage(const FSEntry & f, const QAMessageLevel & l, - const std::string & n, const std::string & m) : - associated_ids(default_associated_ids()), - associated_keys(default_associated_keys()), - entry(f), - level(l), - message(m), - name(n) -{ -} - diff --git a/paludis/qa.hh b/paludis/qa.hh deleted file mode 100644 index 165ebeb89..000000000 --- a/paludis/qa.hh +++ /dev/null @@ -1,103 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_QA_HH -#define PALUDIS_GUARD_PALUDIS_QA_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id.hh> -#include <paludis/metadata_key-fwd.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/sequence-fwd.hh> -#include <paludis/util/set-fwd.hh> -#include <paludis/util/named_value.hh> - -/** \file - * Declarations for Repository QA classes. - * - * \ingroup g_repository - * - * \section Examples - * - * - \ref example_repository.cc "example_repository.cc" - */ - -namespace paludis -{ - namespace n - { - struct associated_ids; - struct associated_keys; - struct entry; - struct level; - struct message; - struct name; - } - - /** - * Parameters for a QA message. - * - * \see RepositoryQAInterface - * \ingroup g_repository - * \since 0.26 - * \nosubgrouping - */ - struct PALUDIS_VISIBLE QAMessage - { - typedef Sequence<std::pair<std::tr1::shared_ptr<const PackageID>, std::tr1::shared_ptr<const MetadataKey> > > KeysSequence; - - NamedValue<n::associated_ids, std::tr1::shared_ptr<PackageIDSet> > associated_ids; - NamedValue<n::associated_keys, std::tr1::shared_ptr<KeysSequence> > associated_keys; - NamedValue<n::entry, FSEntry> entry; - NamedValue<n::level, QAMessageLevel> level; - NamedValue<n::message, std::string> message; - NamedValue<n::name, std::string> name; - - static std::tr1::shared_ptr<PackageIDSet> default_associated_ids(); - static std::tr1::shared_ptr<KeysSequence> default_associated_keys(); - QAMessage & with_associated_id(const std::tr1::shared_ptr<const PackageID> &); - QAMessage & with_associated_key(const std::tr1::shared_ptr<const PackageID> &, const std::tr1::shared_ptr<const MetadataKey> &); - - QAMessage(const FSEntry &, const QAMessageLevel &, const std::string & name, const std::string & message); - }; - - /** - * A QAReporter subclass is passed to RepositoryQAInterface::check_qa to do - * the reporting. - * - * \ingroup g_repository - */ - class PALUDIS_VISIBLE QAReporter - { - public: - virtual ~QAReporter() = 0; - - /** - * Report a QA message. - */ - virtual void message(const QAMessage &) = 0; - - /** - * Update status. - */ - virtual void status(const std::string &) = 0; - }; -} - -#endif diff --git a/paludis/qa.se b/paludis/qa.se deleted file mode 100644 index d9e816bd2..000000000 --- a/paludis/qa.se +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -# vim: set sw=4 sts=4 et ft=sh : - -make_enum_QAMessageLevel() -{ - prefix qaml - - key qaml_debug "Debug notices" - key qaml_maybe "Maybe a QA issue" - key qaml_minor "Minor QA notices" - key qaml_normal "Normal QA notices" - key qaml_severe "Severe QA notices" - - doxygen_comment << "END" - /** - * The importance of a QA notice. - * - * \see RepositoryQAInterface - * \since 0.26 - * \ingroup g_repository - */ -END -} - -make_enum_QACheckProperty() -{ - prefix qacp - - key qacp_needs_build "Needs to build the package" - key qacp_needs_network "Needs network access" - - doxygen_comment << "END" - /** - * Properties of a QA check. - * - * \see RepositoryQAInterface - * \see QACheckProperties - * \since 0.26 - * \ingroup g_repository - */ -END -} - diff --git a/paludis/repositories/accounts/accounts_repository.cc b/paludis/repositories/accounts/accounts_repository.cc index 26f5b8fff..e80cd5678 100644 --- a/paludis/repositories/accounts/accounts_repository.cc +++ b/paludis/repositories/accounts/accounts_repository.cc @@ -117,7 +117,6 @@ AccountsRepository::AccountsRepository(const AccountsRepositoryParams & p) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), @@ -139,7 +138,6 @@ AccountsRepository::AccountsRepository(const InstalledAccountsRepositoryParams & value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/cran/cran_installed_repository.cc b/paludis/repositories/cran/cran_installed_repository.cc index 66a1ccc01..317b0f64c 100644 --- a/paludis/repositories/cran/cran_installed_repository.cc +++ b/paludis/repositories/cran/cran_installed_repository.cc @@ -170,7 +170,6 @@ CRANInstalledRepository::CRANInstalledRepository(const CRANInstalledRepositoryPa value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/cran/cran_repository.cc b/paludis/repositories/cran/cran_repository.cc index bba60bf7f..4bcd5c901 100644 --- a/paludis/repositories/cran/cran_repository.cc +++ b/paludis/repositories/cran/cran_repository.cc @@ -115,7 +115,6 @@ CRANRepository::CRANRepository(const CRANRepositoryParams & p) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(this), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/e/Makefile.am b/paludis/repositories/e/Makefile.am index 898dacf5a..d19ae69f7 100644 --- a/paludis/repositories/e/Makefile.am +++ b/paludis/repositories/e/Makefile.am @@ -1,4 +1,4 @@ -SUBDIRS = eapis ebuild . qa +SUBDIRS = eapis ebuild . CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail DISTCLEANFILES = \ e_repository_params-se.hh e_repository_params-se.cc \ diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc index 0652b2a6a..1bb483a30 100644 --- a/paludis/repositories/e/e_repository.cc +++ b/paludis/repositories/e/e_repository.cc @@ -39,10 +39,6 @@ #include <paludis/repositories/e/extra_distribution_data.hh> #include <paludis/repositories/e/memoised_hashes.hh> -#ifdef ENABLE_QA -# include <paludis/repositories/e/qa/qa_controller.hh> -#endif - #include <paludis/util/config_file.hh> #include <paludis/util/create_iterator-impl.hh> #include <paludis/util/safe_ofstream.hh> @@ -57,7 +53,6 @@ #include <paludis/syncer.hh> #include <paludis/action.hh> #include <paludis/mask.hh> -#include <paludis/qa.hh> #include <paludis/elike_package_dep_spec.hh> #include <paludis/about.hh> #include <paludis/choice.hh> @@ -505,11 +500,6 @@ ERepository::ERepository(const ERepositoryParams & p) : value_for<n::manifest_interface>(this), value_for<n::mirrors_interface>(this), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), -#ifdef ENABLE_QA - value_for<n::qa_interface>(this), -#else - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), -#endif value_for<n::syncable_interface>(this), value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string(p.environment()->distribution())).support_old_style_virtuals() ? this : 0) )), @@ -1092,87 +1082,6 @@ ERepository::unimportant_category_names() const return result; } -#ifdef ENABLE_QA -namespace -{ - struct LibQAHandle - { - Mutex mutex; - void * handle; - void (* qa_checks_handle)( - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const QACheckProperties & ignore_if, - const QACheckProperties & ignore_unless, - const QAMessageLevel minimum_level, - QAReporter & reporter, - const FSEntry & dir); - - LibQAHandle() : - handle(0), - qa_checks_handle(0) - { - } - - ~LibQAHandle() - { - if (0 != handle) - dlclose(handle); - } - - } libqahandle; -} -#endif - -void -ERepository::check_qa( - QAReporter & reporter, - const QACheckProperties & ignore_if, - const QACheckProperties & ignore_unless, - const QAMessageLevel minimum_level, - const FSEntry & dir - ) const -{ -#ifdef ENABLE_QA - Context c("When performing QA checks for '" + stringify(dir) + "':"); - - { - Lock lock(libqahandle.mutex); - - if (0 == libqahandle.handle) - libqahandle.handle = dlopen(getenv_with_default("PALUDIS_E_REPOSITORY_QA_SO", - "libpaludiserepositoryqa_" + stringify(PALUDIS_PC_SLOT) + ".so").c_str(), RTLD_NOW | RTLD_GLOBAL); - if (0 == libqahandle.handle) - { - reporter.message(QAMessage(dir, qaml_severe, "check_qa", "Got error '" + stringify(dlerror()) + - "' when dlopen(" + getenv_with_default("PALUDIS_E_REPOSITORY_QA_SO", - "libpaludiserepositoryqa_" + stringify(PALUDIS_PC_SLOT) + ".so") + ")")); - return; - } - - if (0 == libqahandle.qa_checks_handle) - libqahandle.qa_checks_handle = STUPID_CAST(void (*)( - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const QACheckProperties &, - const QACheckProperties &, - const QAMessageLevel, - QAReporter &, - const FSEntry &), - dlsym(libqahandle.handle, "check_qa")); - if (0 == libqahandle.qa_checks_handle) - { - reporter.message(QAMessage(dir, qaml_severe, "check_qa", "Got error '" + stringify(dlerror) + - "' when dlsym(libpaludisqa.so, \"check_qa\")")); - return; - } - } - - (*libqahandle.qa_checks_handle)(_imp->params.environment(), shared_from_this(), ignore_if, ignore_unless, - minimum_level, reporter, dir); -#endif -} - namespace { struct SupportsActionQuery diff --git a/paludis/repositories/e/e_repository.hh b/paludis/repositories/e/e_repository.hh index 7f5aeb359..ac92ce3df 100644 --- a/paludis/repositories/e/e_repository.hh +++ b/paludis/repositories/e/e_repository.hh @@ -57,7 +57,6 @@ namespace paludis public RepositoryVirtualsInterface, public RepositoryDestinationInterface, public RepositoryEInterface, - public RepositoryQAInterface, public RepositoryManifestInterface, public std::tr1::enable_shared_from_this<ERepository>, private PrivateImplementationPattern<ERepository> @@ -114,14 +113,6 @@ namespace paludis virtual void merge(const MergeParams &); - virtual void check_qa( - QAReporter &, - const QACheckProperties &, - const QACheckProperties &, - const QAMessageLevel, - const FSEntry & - ) const; - /* RepositoryManifestInterface */ virtual void make_manifest(const QualifiedPackageName & qpn); diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc index 6a99651f7..4a2ef021b 100644 --- a/paludis/repositories/e/exndbam_repository.cc +++ b/paludis/repositories/e/exndbam_repository.cc @@ -110,7 +110,6 @@ ExndbamRepository::ExndbamRepository(const RepositoryName & n, const ExndbamRepo value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/e/qa/Makefile.am b/paludis/repositories/e/qa/Makefile.am deleted file mode 100644 index 839fdd414..000000000 --- a/paludis/repositories/e/qa/Makefile.am +++ /dev/null @@ -1,263 +0,0 @@ -SUBDIRS = . -CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail -DISTCLEANFILES = -MAINTAINERCLEANFILES = Makefile.in - -AM_CXXFLAGS = \ - -I$(top_srcdir) -I$(top_builddir) @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ \ - $(PCRECPPDEPS_CFLAGS) - -DEFS = \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DDATADIR=\"$(datadir)\" \ - -DLIBDIR=\"$(libdir)\" - -if ENABLE_QA - -paludis_qa_datadir = $(datadir)/paludis/qa/ - -dist_paludis_qa_data_DATA = \ - deprecated_functions.conf \ - extractors.conf \ - inherited_blacklist.conf \ - iuse_blacklist.conf \ - spec_keys_pds_blacklist.DEPEND.conf \ - spec_keys_pds_blacklist.RDEPEND.conf \ - spec_keys_pds_blacklist.PDEPEND.conf \ - spec_keys_pds_blacklist.SDEPEND.conf \ - spec_keys_pds_blacklist.PROVIDE.conf - -noinst_HEADERS = \ - eapi_supported.hh \ - metadata_keys.hh \ - extractors.hh \ - fetches_key.hh \ - homepage_key.hh \ - iuse_key.hh \ - keywords_key.hh \ - license_key.hh \ - spec_keys.hh \ - qa_checks.hh \ - qa_checks_group.hh \ - qa_controller.hh \ - short_description_key.hh \ - stray_files.hh \ - default_functions.hh \ - kv_variables.hh \ - root_variable.hh \ - subshell_die.hh \ - restrict_key.hh \ - inherited_key.hh \ - visibility.hh \ - function_keyword.hh \ - whitespace.hh \ - header.hh \ - variable_assigns.hh \ - deprecated_functions.hh \ - manifest.hh \ - ebuild_count.hh \ - changelog.hh \ - misc_files.hh \ - files_dir_size.hh \ - repo_name.hh \ - categories.hh - -lib_LTLIBRARIES = libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la - -libpaludiserepositoryqa_@PALUDIS_PC_SLOT@_la_LDFLAGS = \ - $(PCRECPPDEPS_LIBS) - -libpaludiserepositoryqa_@PALUDIS_PC_SLOT@_la_SOURCES = \ - qa.cc \ - eapi_supported.cc \ - metadata_keys.cc \ - extractors.cc \ - fetches_key.cc \ - homepage_key.cc \ - iuse_key.cc \ - keywords_key.cc \ - license_key.cc \ - qa_checks.cc \ - qa_checks_group.cc \ - qa_controller.cc \ - short_description_key.cc \ - spec_keys.cc \ - stray_files.cc \ - default_functions.cc \ - kv_variables.cc \ - root_variable.cc \ - subshell_die.cc \ - restrict_key.cc \ - inherited_key.cc \ - visibility.cc \ - function_keyword.cc \ - whitespace.cc \ - header.cc \ - variable_assigns.cc \ - deprecated_functions.cc \ - manifest.cc \ - ebuild_count.cc \ - changelog.cc \ - misc_files.cc \ - files_dir_size.cc \ - repo_name.cc \ - categories.cc \ - $(paludis_repositories_e_include_HEADERS) - -dist_check_SCRIPTS = \ - visibility_TEST_setup.sh \ - visibility_TEST_cleanup.sh \ - misc_files_TEST_setup.sh \ - misc_files_TEST_cleanup.sh \ - manifest_TEST_setup.sh \ - manifest_TEST_cleanup.sh - -endif - -EXTRA_DIST = $(check_SCRIPTS) -BUILT_SOURCES = - -TESTS_ENVIRONMENT = env \ - TEST_OUTPUT_WRAPPER="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/outputwrapper`" \ - PALUDIS_OPTIONS="" \ - PALUDIS_OUTPUTWRAPPER_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \ - PALUDIS_EBUILD_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/repositories/e/ebuild/`" \ - PALUDIS_EBUILD_DIR_FALLBACK="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/ebuild/`" \ - PALUDIS_EXTRA_EBUILD_MODULES_DIRS="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \ - PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \ - PALUDIS_SUFFIXES_FILE="$(top_srcdir)/paludis/repositories/e/ebuild_entries_suffixes.conf" \ - PALUDIS_QA_DATA_DIR="$(top_srcdir)/paludis/repositories/e/qa/" \ - PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ - PALUDIS_DISTRIBUTION="gentoo" \ - PALUDIS_SKIP_CONFIG="yes" \ - PALUDIS_DEFAULT_OUTPUT_CONF="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/environments/paludis/tests_output.conf`" \ - PALUDIS_OUTPUT_MANAGERS_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_srcdir)/paludis/environments/paludis/output_managers/`" \ - TEST_SCRIPT_DIR="$(srcdir)/" \ - PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ - LD_LIBRARY_PATH="`echo $$LD_LIBRARY_PATH: | sed -e 's,^:,,'`` \ - $(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/`:` \ - $(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/.libs/`" \ - bash $(top_srcdir)/test/run_test.sh - -if ENABLE_QA - -TESTS = \ - extractors_TEST \ - homepage_key_TEST \ - spec_keys_TEST \ - default_functions_TEST \ - kv_variables_TEST \ - visibility_TEST \ - misc_files_TEST \ - manifest_TEST \ - subshell_die_TEST \ - function_keyword_TEST - -check_PROGRAMS = $(TESTS) - -spec_keys_TEST_SOURCES = spec_keys_TEST.cc -spec_keys_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -spec_keys_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -extractors_TEST_SOURCES = extractors_TEST.cc -extractors_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -extractors_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -homepage_key_TEST_SOURCES = homepage_key_TEST.cc -homepage_key_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -homepage_key_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -visibility_TEST_SOURCES = visibility_TEST.cc -visibility_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -visibility_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -default_functions_TEST_SOURCES = default_functions_TEST.cc -default_functions_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -default_functions_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -kv_variables_TEST_SOURCES = kv_variables_TEST.cc -kv_variables_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -kv_variables_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -misc_files_TEST_SOURCES = misc_files_TEST.cc -misc_files_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -misc_files_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -manifest_TEST_SOURCES = manifest_TEST.cc -manifest_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -manifest_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -subshell_die_TEST_SOURCES = subshell_die_TEST.cc -subshell_die_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -subshell_die_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -function_keyword_TEST_SOURCES = function_keyword_TEST.cc -function_keyword_TEST_LDADD = \ - libpaludiserepositoryqa_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/test_extras.o \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/test/libtest.a - -function_keyword_TEST_CXXFLAGS = $(AM_CXXFLAGS) @PALUDIS_CXXFLAGS_NO_DEBUGGING@ - -endif - -built-sources : $(BUILT_SOURCES) - for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done - diff --git a/paludis/repositories/e/qa/categories.cc b/paludis/repositories/e/qa/categories.cc deleted file mode 100644 index edba7eb2d..000000000 --- a/paludis/repositories/e/qa/categories.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "categories.hh" -#include <paludis/qa.hh> -#include <paludis/repositories/e/e_repository.hh> -#include <paludis/repositories/e/layout.hh> -#include <paludis/util/config_file.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/log.hh> -#include <paludis/util/options.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/sequence.hh> - -#include <set> - -using namespace paludis; - -bool -paludis::erepository::categories_check( - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepository> & repo, - const std::string & name) -{ - Context context("When performing check '" + name + "':"); - FSEntry cats(repo->layout()->categories_file()); - Log::get_instance()->message("e.qa.categories_check", ll_debug, lc_context) << "categories_check '" - << cats << "', " << name << "'"; - - try - { - if (! cats.is_regular_file_or_symlink_to_regular_file()) - { - /* if the categories file exists but is not regular, or if we don't have a master */ - if (cats.exists() || ! (repo->params().master_repositories() && ! repo->params().master_repositories()->empty())) - reporter.message(QAMessage(cats, qaml_severe, name, "Categories file is not a regular file")); - } - else - { - LineConfigFile cf(cats, LineConfigFileOptions()); - std::set<CategoryNamePart> c; - - for (LineConfigFile::ConstIterator line(cf.begin()), line_end(cf.end()) ; - line != line_end ; ++line) - { - try - { - CategoryNamePart n(*line); - std::pair<std::set<CategoryNamePart>::const_iterator, bool> r(c.insert(n)); - - if (! r.second) - reporter.message(QAMessage(cats, qaml_normal, name, "Categories file entry '" - + stringify(*line) + "' is not unique")); - else if (next(r.first) != c.end()) - reporter.message(QAMessage(cats, qaml_minor, name, "Categories file entry '" - + stringify(*line) + "' is not in order")); - else - { - FSEntry f(repo->layout()->category_directory(n)); - - if (! f.is_directory_or_symlink_to_directory()) - { - if (f.exists()) - reporter.message(QAMessage(cats, qaml_normal, name, "Categories file entry '" - + stringify(*line) + "' exists but is not a directory")); - else - reporter.message(QAMessage(cats, qaml_minor, name, "Categories file entry '" - + stringify(*line) + "' does not exist")); - } - } - } - catch (const NameError &) - { - reporter.message(QAMessage(cats, qaml_severe, name, "Categories file entry '" - + stringify(*line) + "' is not a valid category name")); - } - } - } - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & err) - { - reporter.message(QAMessage(cats, qaml_severe, name, "Caught Exception '" + err.message() + "' (" - + err.what() + ") when handling categories file")); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/categories.hh b/paludis/repositories/e/qa/categories.hh deleted file mode 100644 index 1bcc161d1..000000000 --- a/paludis/repositories/e/qa/categories.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_CATEGORIES_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_CATEGORIES_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool categories_check( - QAReporter &, - const std::tr1::shared_ptr<const ERepository> &, - const std::string & - ); - } -} - - -#endif diff --git a/paludis/repositories/e/qa/changelog.cc b/paludis/repositories/e/qa/changelog.cc deleted file mode 100644 index 269d0ea8e..000000000 --- a/paludis/repositories/e/qa/changelog.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "changelog.hh" -#include <paludis/qa.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/log.hh> -#include <paludis/util/safe_ifstream.hh> - -using namespace paludis; - -bool -paludis::erepository::changelog_check( - QAReporter & reporter, - const FSEntry & dir, - const QualifiedPackageName & qpn, - const std::string & name - ) -{ - Context context("When performing check '" + name + "' using changelog_check on directory '" + stringify(dir) + "':"); - Log::get_instance()->message("e.qa.changelog_check", ll_debug, lc_context) << "changelog_check '" - << dir << "', " << name << "'"; - - FSEntry f(dir / "ChangeLog"); - - if (! f.exists()) - reporter.message(QAMessage(f, qaml_normal, name, "No ChangeLog found")); - else if (! f.is_regular_file_or_symlink_to_regular_file()) - reporter.message(QAMessage(f, qaml_normal, name, "Not a regular file")); - else - { - SafeIFStream ff(f); - do - { - if (! ff) - { - reporter.message(QAMessage(f, qaml_normal, name, "Can't read ChangeLog")); - continue; - } - - std::string s; - if (! std::getline(ff, s)) - { - reporter.message(QAMessage(f, qaml_normal, name, "Can't read ChangeLog header")); - continue; - } - - if (s != "# ChangeLog for " + stringify(qpn)) - reporter.message(QAMessage(f, qaml_minor, name, "ChangeLog header is incorrect")); - } - while (false); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/changelog.hh b/paludis/repositories/e/qa/changelog.hh deleted file mode 100644 index bc7ba8f47..000000000 --- a/paludis/repositories/e/qa/changelog.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_CHANGELOG_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_CHANGELOG_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool changelog_check( - QAReporter &, - const FSEntry &, - const QualifiedPackageName &, - const std::string & - ); - } -} - -#endif diff --git a/paludis/repositories/e/qa/default_functions.cc b/paludis/repositories/e/qa/default_functions.cc deleted file mode 100644 index c4235bee1..000000000 --- a/paludis/repositories/e/qa/default_functions.cc +++ /dev/null @@ -1,141 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "default_functions.hh" -#include <paludis/qa.hh> -#include <paludis/util/log.hh> -#include <pcrecpp.h> -#include <sstream> - -using namespace paludis; - -namespace -{ - enum State - { - st_default, - st_src_compile, - st_src_unpack - }; -} - -bool -paludis::erepository::default_functions_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using default_functions_check on '" + stringify(*id) + "':"); - - pcrecpp::RE r_echo("^\\s*(echo|einfo|ewarn)[^|<>]*$"); - pcrecpp::RE r_colon("^\\s*:"); - pcrecpp::RE r_true("^\\s*true"); - pcrecpp::RE r_comment("^\\s*#"); - pcrecpp::RE r_econf("^\\s*econf( *\\|\\| *die.*)?$"); - pcrecpp::RE r_emake("^\\s*emake( *\\|\\| *die.*)?$"); - pcrecpp::RE r_unpack("^\\s*unpack *([$]A|[$][{]A[}]|\"[$][{]A[}]\"|[$][{]A[}])( *\\|\\| *die.*)?$"); - pcrecpp::RE r_cd_s("^\\s*cd *([$]S|[$][{]S[}]|\"[$][{]S[}]\"|[$][{]S[}])( *\\|\\| *die.*)?$"); - - Log::get_instance()->message("e.qa.default_functions_check", ll_debug, lc_context) << "default_functions '" - << entry << "', '" << *id << "', '" << name << "'"; - - std::istringstream ff(content); - - 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) - reporter.message(QAMessage(entry, qaml_minor, name, "src_compile is redundant") - .with_associated_id(id)); - } - else if (line.empty()) - ; - else if (r_econf.PartialMatch(line)) - ; - else if (r_emake.PartialMatch(line)) - ; - else if (r_echo.PartialMatch(line)) - ; - else if (r_colon.PartialMatch(line)) - ; - else if (r_true.PartialMatch(line)) - ; - else if (r_comment.PartialMatch(line)) - ; - else - src_compile_changed = true; - } - continue; - - case st_src_unpack: - { - if (line == "}") - { - state = st_default; - if (! src_unpack_changed) - reporter.message(QAMessage(entry, qaml_minor, name, "src_unpack is redundant") - .with_associated_id(id)); - } - else if (line.empty()) - ; - else if (r_unpack.PartialMatch(line)) - ; - else if (r_cd_s.PartialMatch(line)) - ; - else if (r_echo.PartialMatch(line)) - ; - else if (r_colon.PartialMatch(line)) - ; - else if (r_true.PartialMatch(line)) - ; - else if (r_comment.PartialMatch(line)) - ; - else - src_unpack_changed = true; - } - continue; - } - - throw InternalError(PALUDIS_HERE, "bad state"); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/default_functions.hh b/paludis/repositories/e/qa/default_functions.hh deleted file mode 100644 index 757564658..000000000 --- a/paludis/repositories/e/qa/default_functions.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_DEFAULT_FUNCTIONS_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_DEFAULT_FUNCTIONS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool default_functions_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/default_functions_TEST.cc b/paludis/repositories/e/qa/default_functions_TEST.cc deleted file mode 100644 index 7b705ffbb..000000000 --- a/paludis/repositories/e/qa/default_functions_TEST.cc +++ /dev/null @@ -1,116 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "default_functions.hh" -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - std::string messages; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage & m) - { - ++count; - if (! messages.empty()) - messages.append(", "); - messages.append(m.message()); - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct UnpackWithEPatchTest : TestCase - { - UnpackWithEPatchTest() : TestCase("unpack_with_epatch") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r; - TEST_CHECK(default_functions_check(FSEntry("/var/empty"), r, id, "src_unpack() {\n\tunpack \"${A}\"\n\tcd \"${S}\"\n\tepatch \"${FILESDIR}\"/${PN}-cookie.patch\n}\n", "default_functions")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_unpack_with_epatch; - - struct UnpackEmptyTest : TestCase - { - UnpackEmptyTest() : TestCase("unpack_empty") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r; - TEST_CHECK(default_functions_check(FSEntry("/var/empty"), r, id, "src_unpack() {\n\t:\n}\n", "default_functions")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_unpack_empty; - - struct UnpackWithNontrivialEchoTest : TestCase - { - UnpackWithNontrivialEchoTest() : TestCase("unpack_with_nontrivial_echo") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r; - TEST_CHECK(default_functions_check(FSEntry("/var/empty"), r, id, "src_unpack() {\n\techo \"blah\" > foo\n}\n", "default_functions")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_unpack_with_nontrivial_echo; -} - diff --git a/paludis/repositories/e/qa/deprecated_functions.cc b/paludis/repositories/e/qa/deprecated_functions.cc deleted file mode 100644 index 166f0a6b6..000000000 --- a/paludis/repositories/e/qa/deprecated_functions.cc +++ /dev/null @@ -1,124 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "deprecated_functions.hh" -#include <paludis/qa.hh> -#include <paludis/util/config_file.hh> -#include <paludis/util/create_iterator-impl.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/instantiation_policy-impl.hh> -#include <paludis/util/log.hh> -#include <paludis/util/options.hh> -#include <paludis/util/system.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/name.hh> -#include <paludis/package_id.hh> -#include <list> -#include <string> -#include <sstream> -#include <utility> -#include <pcrecpp.h> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct DeprecatedFunctions : - InstantiationPolicy<DeprecatedFunctions, instantiation_method::SingletonTag> - { - std::list<std::string> deprecated_functions; - - DeprecatedFunctions(const FSEntry & f = FSEntry(getenv_with_default("PALUDIS_QA_DATA_DIR", - stringify(FSEntry(DATADIR) / "paludis" / "qa"))) / "deprecated_functions.conf") - { - try - { - LineConfigFile deprecated_functions_file(f, LineConfigFileOptions()); - std::copy(deprecated_functions_file.begin(), deprecated_functions_file.end(), - - std::back_inserter(deprecated_functions)); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - Log::get_instance()->message("e.qa.deprecated_functions_check.configuration_error", ll_warning, lc_context) - << "Got error '" << e.message() << "' (" << e.what() - << ") when loading deprecated_functions.conf for QA deprecated_functions"; - } - } - }; - - QAMessage - with_id(QAMessage m, const std::tr1::shared_ptr<const PackageID> & id) - { - return id ? m.with_associated_id(id) : m; - } -} - -bool -paludis::erepository::deprecated_functions_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using deprecated_functions_check on '" + (id ? stringify(*id) : stringify(entry)) + "':"); - - pcrecpp::RE r_comment("^\\s*#"); - std::list<std::pair<std::string, pcrecpp::RE> > deprecated_functions; - for (std::list<std::string>::const_iterator - it(DeprecatedFunctions::get_instance()->deprecated_functions.begin()), - it_end(DeprecatedFunctions::get_instance()->deprecated_functions.end()); - it_end != it; ++it) - deprecated_functions.push_back(std::make_pair(*it, pcrecpp::RE(*it))); - - if (id) - Log::get_instance()->message("e.qa.deprecated_functions_check", ll_debug, lc_context) << "deprecated_functions '" - << entry << "', '" << *id << "', '" << name << "'"; - else - Log::get_instance()->message("e.qa.deprecated_functions_check", ll_debug, lc_context) << "deprecated_functions '" - << entry << "', '" << name << "'"; - - std::stringstream ff(content); - - std::string s; - unsigned line_number(0); - while (std::getline(ff, s)) - { - ++line_number; - - if (s.empty() || r_comment.PartialMatch(s)) - continue; - - for (std::list<std::pair<std::string, pcrecpp::RE> >::iterator - r(deprecated_functions.begin()), r_end(deprecated_functions.end()) ; - r != r_end ; ++r ) - if (r->second.PartialMatch(s)) - reporter.message(with_id(QAMessage(entry, qaml_normal, name, - "Deprecated call to '" + r->first + "' on line " + stringify(line_number)), id)); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/deprecated_functions.conf b/paludis/repositories/e/qa/deprecated_functions.conf deleted file mode 100644 index ae6303f58..000000000 --- a/paludis/repositories/e/qa/deprecated_functions.conf +++ /dev/null @@ -1,5 +0,0 @@ -check_KV -gnuconfig_update -dyn_[a-z]* -prepall[a-z.]* -prepstrip diff --git a/paludis/repositories/e/qa/deprecated_functions.hh b/paludis/repositories/e/qa/deprecated_functions.hh deleted file mode 100644 index 0d6b6fa80..000000000 --- a/paludis/repositories/e/qa/deprecated_functions.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_DEPRECATED_FUNCTIONS_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_DEPRECATED_FUNCTIONS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool deprecated_functions_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/eapi_supported.cc b/paludis/repositories/e/qa/eapi_supported.cc deleted file mode 100644 index 10d1e7304..000000000 --- a/paludis/repositories/e/qa/eapi_supported.cc +++ /dev/null @@ -1,47 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "eapi_supported.hh" -#include <paludis/package_id.hh> -#include <paludis/qa.hh> -#include <paludis/repositories/e/eapi.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/stringify.hh> - -bool -paludis::erepository::eapi_supported_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using eapi_supported_check on ID '" + stringify(*id) + "':"); - - if (! id->eapi()->supported()) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "EAPI '" + stringify(id->eapi()->name()) + "' not supported") - .with_associated_id(id)); - return false; - } - - return true; -} - - diff --git a/paludis/repositories/e/qa/eapi_supported.hh b/paludis/repositories/e/qa/eapi_supported.hh deleted file mode 100644 index 4e101d3b9..000000000 --- a/paludis/repositories/e/qa/eapi_supported.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_EAPI_SUPPORTED_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_EAPI_SUPPORTED_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool eapi_supported_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/ebuild_count.cc b/paludis/repositories/e/qa/ebuild_count.cc deleted file mode 100644 index 3be96ffc6..000000000 --- a/paludis/repositories/e/qa/ebuild_count.cc +++ /dev/null @@ -1,56 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "ebuild_count.hh" -#include <paludis/qa.hh> -#include <paludis/repository.hh> -#include <paludis/util/log.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/wrapped_forward_iterator.hh> - -using namespace paludis; - -bool -paludis::erepository::ebuild_count_check( - QAReporter & reporter, - const FSEntry & dir, - const std::tr1::shared_ptr<const Repository> & repo, - const QualifiedPackageName & q, - const std::string & name - ) -{ - Context context("When performing check '" + name + "' using ebuild_count_check on directory '" + stringify(dir) + "':"); - Log::get_instance()->message("e.qa.ebuild_count_check", ll_debug, lc_context) << "ebuild_count_check '" - << dir << "', " << name << "'"; - - std::tr1::shared_ptr<const PackageIDSequence> ids(repo->package_ids(q)); - PackageIDSequence::ConstIterator::difference_type count(std::distance(ids->begin(), ids->end())); - - if (count > 10) - { - QAMessage m(dir, qaml_minor, name, "Found " + stringify(count) + " ebuilds, which is too many to count on " + (count > 20 ? "both hands and both feet" : count > 15 ? "both hands and one foot" : "my fingers")); - for (PackageIDSequence::ConstIterator it(ids->begin()), - it_end(ids->end()); it_end != it; ++it) - m = m.with_associated_id(*it); - reporter.message(m); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/ebuild_count.hh b/paludis/repositories/e/qa/ebuild_count.hh deleted file mode 100644 index f38dd9ed5..000000000 --- a/paludis/repositories/e/qa/ebuild_count.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_EBUILD_COUNT_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_EBUILD_COUNT_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> -#include <paludis/repository-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool - ebuild_count_check( - QAReporter &, - const FSEntry &, - const std::tr1::shared_ptr<const Repository> &, - const QualifiedPackageName &, - const std::string & - ); - } -} - -#endif diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc deleted file mode 100644 index 71f211bde..000000000 --- a/paludis/repositories/e/qa/extractors.cc +++ /dev/null @@ -1,425 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "extractors.hh" -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/qa.hh> -#include <paludis/dep_spec.hh> -#include <paludis/util/config_file.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/system.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/mutex.hh> -#include <paludis/util/options.hh> -#include <paludis/util/log.hh> -#include <paludis/util/instantiation_policy-impl.hh> -#include <paludis/elike_conditional_dep_spec.hh> -#include <tr1/functional> -#include <algorithm> -#include <map> -#include <set> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct ExtractorsRequirements : - InstantiationPolicy<ExtractorsRequirements, instantiation_method::SingletonTag> - { - std::tr1::shared_ptr<const KeyValueConfigFile> file; - - ExtractorsRequirements(const FSEntry & f = FSEntry(getenv_with_default("PALUDIS_QA_DATA_DIR", - stringify(FSEntry(DATADIR) / "paludis" / "qa"))) / "extractors.conf") - { - try - { - file.reset(new KeyValueConfigFile(f, KeyValueConfigFileOptions(), - &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - Log::get_instance()->message("e.metadata_key.extractors.configuration_error", ll_warning, lc_context) - << "Got error '" << e.message() << "' (" << e.what() - << ") when loading extractors.conf for QA extractors_check"; - file.reset(new KeyValueConfigFile(std::string(), KeyValueConfigFileOptions(), - &KeyValueConfigFile::no_defaults, &KeyValueConfigFile::no_transformation)); - } - } - }; - - struct FlagExtractor - { - std::map<QualifiedPackageName, std::set<ChoiceNameWithPrefix> > relevant; - std::set<ChoiceNameWithPrefix> current; - std::set<QualifiedPackageName> needed_packages; - - void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node) - { - std::string::size_type p(node.spec()->filename().rfind('.')); - if (std::string::npos == p) - return; - std::string extension(node.spec()->filename().substr(p + 1)); - std::string needed(ExtractorsRequirements::get_instance()->file->get(extension)); - if (! needed.empty()) - { - needed_packages.insert(QualifiedPackageName(needed)); - relevant[QualifiedPackageName(needed)].insert(current.begin(), current.end()); - } - } - - void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node) - { - if (node.spec()->package_ptr() && needed_packages.count(*node.spec()->package_ptr())) - relevant[*node.spec()->package_ptr()].insert(current.begin(), current.end()); - } - - void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - Save<std::set<ChoiceNameWithPrefix> > save_current(¤t); - current.insert(elike_conditional_dep_spec_flag(*node.spec())); - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &) - { - } - }; - - struct Requirements - { - const QualifiedPackageName & name; - const std::set<ChoiceNameWithPrefix> & relevant; - std::map<ChoiceNameWithPrefix, bool> current; - std::set<std::map<ChoiceNameWithPrefix, bool> > requirements; - - Requirements(const QualifiedPackageName & n, const std::set<ChoiceNameWithPrefix> & r) : - name(n), - relevant(r) - { - } - - void add_requirements() - { - std::set<std::map<ChoiceNameWithPrefix, bool> > new_requirements; - new_requirements.insert(current); - for (std::set<ChoiceNameWithPrefix>::const_iterator r(relevant.begin()), r_end(relevant.end()) ; - r != r_end ; ++r) - { - if (! current.count(*r)) - { - std::set<std::map<ChoiceNameWithPrefix, bool> > new_requirements_c; - for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator i(new_requirements.begin()), - i_end(new_requirements.end()) ; - i != i_end ; ++i) - { - std::map<ChoiceNameWithPrefix, bool> n(*i); - n[*r] = true; - new_requirements_c.insert(n); - n[*r] = false; - new_requirements_c.insert(n); - } - std::swap(new_requirements_c, new_requirements); - } - } - requirements.insert(new_requirements.begin(), new_requirements.end()); - } - - void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type & node) - { - std::string::size_type p(node.spec()->filename().rfind('.')); - if (std::string::npos == p) - return; - std::string extension(node.spec()->filename().substr(p + 1)); - std::string needed(ExtractorsRequirements::get_instance()->file->get(extension)); - if (needed.empty() || QualifiedPackageName(needed) != name) - return; - - add_requirements(); - } - - void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node) - { - if ((! node.spec()->package_ptr()) || (name != *node.spec()->package_ptr())) - return; - - add_requirements(); - } - - void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - Save<std::map<ChoiceNameWithPrefix, bool> > save_current(¤t); - std::pair<std::map<ChoiceNameWithPrefix, bool>::const_iterator, bool> p(current.insert(std::make_pair( - elike_conditional_dep_spec_flag(*node.spec()), ! elike_conditional_dep_spec_is_inverse(*node.spec())))); - if (p.second || (p.first->second == ! elike_conditional_dep_spec_is_inverse(*node.spec()))) - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type &) - { - } - }; -} - -bool -paludis::erepository::extractors_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.extractors_check", ll_debug, lc_context) << "extractors_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (id->fetches_key()) - { - try - { - /* Find all USE flags relevant for our operation. Don't use IUSE, - * since it needs to work with USE_EXPAND and it's potentially - * O(2^n). */ - FlagExtractor f; - id->fetches_key()->value()->root()->accept(f); - if (id->build_dependencies_key()) - id->build_dependencies_key()->value()->root()->accept(f); - - for (std::map<QualifiedPackageName, std::set<ChoiceNameWithPrefix> >::const_iterator - r(f.relevant.begin()), r_end(f.relevant.end()) ; - r != r_end ; ++r) - { - if (r->second.size() > 10) - { - reporter.message(QAMessage(entry, qaml_maybe, name, "Too many flags to determine whether " - "extractor dependency requirement '" + stringify(r->first) + "' is met") - .with_associated_id(id) - .with_associated_key(id, id->fetches_key())); - continue; - } - - /* Find the set of requirements. */ - Requirements q(r->first, r->second); - id->fetches_key()->value()->root()->accept(q); - - /* Find the set of met requirements. */ - Requirements m(r->first, r->second); - if (id->build_dependencies_key()) - id->build_dependencies_key()->value()->root()->accept(m); - - /* Find the set of unmet requirements */ - std::set<std::map<ChoiceNameWithPrefix, bool> > unmet; - std::set_difference(q.requirements.begin(), q.requirements.end(), - m.requirements.begin(), m.requirements.end(), std::inserter(unmet, unmet.begin())); - - /* Simplify the set of unmet requirements: reduce - * { { a => x, b => y }, { a => !x, b => y } } to { { b => y } } */ - bool changed(true); - while (changed) - { - changed = false; - std::set<std::map<ChoiceNameWithPrefix, bool> > new_unmet; - for (std::set<std::map<ChoiceNameWithPrefix, bool> >::const_iterator i(unmet.begin()), i_end(unmet.end()) ; - i != i_end ; ++i) - { - std::map<ChoiceNameWithPrefix, bool>::const_iterator j_rem(i->end()); - for (std::map<ChoiceNameWithPrefix, bool>::const_iterator j(i->begin()), j_end(i->end()) ; - j != j_end ; ++j) - { - std::map<ChoiceNameWithPrefix, bool> n(*i); - n[j->first] = !n[j->first]; - if (unmet.count(n)) - { - j_rem = j; - changed = true; - break; - } - } - - if (j_rem != i->end()) - { - std::map<ChoiceNameWithPrefix, bool> n(*i); - n.erase(j_rem->first); - new_unmet.insert(n); - } - else - new_unmet.insert(*i); - } - std::swap(unmet, new_unmet); - } - - /* Simplify the set of unmet requirements: reduce - * { { a => x }, { a => x, b => y } } to { { a => x } } */ - changed = true; - while (changed) - { - changed = false; - for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator i(unmet.begin()), i_end(unmet.end()) ; - i != i_end && ! changed ; ++i) - { - for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator j(unmet.begin()), j_end(unmet.end()) ; - j != j_end && ! changed ; ++j) - { - if (i == j) - continue; - - std::map<ChoiceNameWithPrefix, bool> delta; - std::set_difference(i->begin(), i->end(), j->begin(), j->end(), std::inserter(delta, delta.begin())); - if (delta.empty()) - { - unmet.erase(j); - changed = true; - } - } - } - } - - /* Messages */ - if (! unmet.empty()) - { - std::string cond; - if (! unmet.begin()->empty()) - { - cond.append(" for USE \""); - bool need_and(false); - for (std::set<std::map<ChoiceNameWithPrefix, bool> >::iterator j(unmet.begin()), j_end(unmet.end()) ; - j != j_end ; ++j) - { - if (need_and) - cond.append("\" and \""); - need_and = true; - - bool need_space(false); - for (std::map<ChoiceNameWithPrefix, bool>::const_iterator i(j->begin()), i_end(j->end()) ; - i != i_end ; ++i) - { - if (need_space) - cond.append(" "); - if (! i->second) - cond.append("!"); - cond.append(stringify(i->first)); - need_space = true; - } - } - cond.append("\""); - } - - reporter.message(QAMessage(entry, qaml_maybe, name, "Extractor '" + stringify(r->first) - + "' may be required as a build dependency" + cond) - .with_associated_id(id) - .with_associated_key(id, id->fetches_key())); - } - } - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + id->fetches_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->fetches_key())); - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/extractors.conf b/paludis/repositories/e/qa/extractors.conf deleted file mode 100644 index 8668a92a3..000000000 --- a/paludis/repositories/e/qa/extractors.conf +++ /dev/null @@ -1,8 +0,0 @@ -zip = app-arch/unzip -jar = app-arch/unzip -rar = app-arch/unrar -LHa = app-arch/lha -LHA = app-arch/lha -lha = app-arch/lha -lzh = app-arch/lha -lzma = app-arch/lzma-utils diff --git a/paludis/repositories/e/qa/extractors.hh b/paludis/repositories/e/qa/extractors.hh deleted file mode 100644 index a27ee23f7..000000000 --- a/paludis/repositories/e/qa/extractors.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_EXTRACTORS_HH -#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_EXTRACTORS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool extractors_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/extractors_TEST.cc b/paludis/repositories/e/qa/extractors_TEST.cc deleted file mode 100644 index b8f65d0d0..000000000 --- a/paludis/repositories/e/qa/extractors_TEST.cc +++ /dev/null @@ -1,158 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/extractors.hh> -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - std::string last_message; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage & m) - { - ++count; - last_message = m.message(); - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct GoodTest : TestCase - { - GoodTest() : TestCase("good") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("app-arch/unzip"); - id->fetches_key()->set_from_string("foo.zip"); - - TestReporter r; - TEST_CHECK(extractors_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_good; - - struct NoneTest : TestCase - { - NoneTest() : TestCase("none") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("app-misc/foo"); - id->fetches_key()->set_from_string("foo.tar.bz2"); - - TestReporter r; - TEST_CHECK(extractors_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_none; - - struct ComplicatedGoodTest : TestCase - { - ComplicatedGoodTest() : TestCase("complicated good") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("oink? ( app-arch/unzip ) !oink? ( bar? ( app-arch/unzip ) foo? ( app-arch/unzip ) )"); - id->fetches_key()->set_from_string("foo? ( foo.zip ) bar? ( baz? ( moo.zip ) )"); - - TestReporter r; - TEST_CHECK(extractors_check(FSEntry("/var/empty"), r, id, "spec keys")); - TestMessageSuffix s(r.last_message); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_complicated_good; - - struct BadTest : TestCase - { - BadTest() : TestCase("bad") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("app-arch/blah"); - id->fetches_key()->set_from_string("foo.zip"); - - TestReporter r; - TEST_CHECK(extractors_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_bad; - - struct ComplicatedBadTest : TestCase - { - ComplicatedBadTest() : TestCase("complicated bad") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("foo? ( baz? ( app-arch/unzip ) !baz? ( app-arch/unzip ) ) "); - id->fetches_key()->set_from_string("oink? ( a.zip ) !oink? ( bar? ( a.zip ) )"); - - TestReporter r; - TEST_CHECK(extractors_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - TEST_CHECK_EQUAL(r.last_message, "Extractor 'app-arch/unzip' may be required as a build dependency for USE " - "\"bar !foo !oink\" and \"!foo oink\""); - } - } test_complicated_bad; -} - diff --git a/paludis/repositories/e/qa/fetches_key.cc b/paludis/repositories/e/qa/fetches_key.cc deleted file mode 100644 index 926b49fab..000000000 --- a/paludis/repositories/e/qa/fetches_key.cc +++ /dev/null @@ -1,216 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "fetches_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/log.hh> -#include <paludis/util/save.hh> -#include <paludis/name.hh> -#include <paludis/dep_spec.hh> -#include <paludis/dep_label.hh> -#include <paludis/package_id.hh> -#include <paludis/repository.hh> -#include <paludis/util/fs_entry.hh> - -using namespace paludis; - -namespace -{ - struct LabelToFetchRestrict - { - bool value; - - LabelToFetchRestrict(const URILabel & l) - { - l.accept(*this); - } - - void visit(const URIMirrorsThenListedLabel &) - { - value = false; - } - - void visit(const URIMirrorsOnlyLabel &) - { - value = true; - } - - void visit(const URIListedOnlyLabel &) - { - value = false; - } - - void visit(const URIListedThenMirrorsLabel &) - { - value = false; - } - - void visit(const URILocalMirrorsOnlyLabel &) - { - value = true; - } - - void visit(const URIManualOnlyLabel &) - { - value = true; - } - }; - - struct Checker - { - QAReporter & reporter; - bool fetch_restrict; - std::tr1::shared_ptr<const PackageID> id; - std::tr1::shared_ptr<const MetadataKey> key; - FSEntry entry; - std::string name; - - Checker(QAReporter & rr, bool f, - const std::tr1::shared_ptr<const PackageID> & i, - const std::tr1::shared_ptr<const MetadataKey> & k, - const FSEntry & fs, const std::string & n) : - reporter(rr), - fetch_restrict(f), - id(i), - key(k), - entry(fs), - name(n) - { - } - - void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node) - { - std::string::size_type p(std::string::npos); - if (std::string::npos == ((p = node.spec()->original_url().find("://"))) && ! fetch_restrict) - reporter.message(QAMessage(entry, qaml_normal, name, - "No protocol found for '" + node.spec()->original_url() + - "' and not fetch restricted in '" + key->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - - else if ((std::string::npos != p) && - (("http" != node.spec()->original_url().substr(0, p)) && - ("https" != node.spec()->original_url().substr(0, p)) && - ("mirror" != node.spec()->original_url().substr(0, p)) && - ("ftp" != node.spec()->original_url().substr(0, p)))) - reporter.message(QAMessage(entry, qaml_normal, name, - "Unrecognised protocol for '" + node.spec()->original_url() + - "' in '" + key->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - - else if ((std::string::npos != node.spec()->original_url().find("dev.gentoo.org")) || - (std::string::npos != node.spec()->original_url().find("cvs.gentoo.org")) || - (std::string::npos != node.spec()->original_url().find("toucan.gentoo.org")) || - (std::string::npos != node.spec()->original_url().find("emu.gentoo.org")) || - (std::string::npos != node.spec()->original_url().find("alpha.gnu.org")) || - (std::string::npos != node.spec()->original_url().find("geocities.com"))) - reporter.message(QAMessage(entry, qaml_normal, name, - "Unreliable host for '" + node.spec()->original_url() + "' in '" + - key->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - - else - { - if (0 == node.spec()->original_url().compare(0, 9, "mirror://")) - { - std::string mirror_host(node.spec()->original_url().substr(9)); - std::string::size_type pos(mirror_host.find('/')); - if (std::string::npos == pos) - reporter.message(QAMessage(entry, qaml_normal, name, - "Malformed component '" + node.spec()->original_url() + "' in '" + - key->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - else - { - mirror_host.erase(pos); - RepositoryMirrorsInterface * m((*id->repository()).mirrors_interface()); - if (! m->is_mirror(mirror_host)) - reporter.message(QAMessage(entry, qaml_normal, name, - "Unknown mirror '" + mirror_host + "' for '" + - node.spec()->original_url() + "' in '" + key->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - } - } - - void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type & node) - { - if (1 != std::distance(node.spec()->begin(), node.spec()->end())) - throw InternalError(PALUDIS_HERE, "URILabelsDepSpec contains " + - stringify(std::distance(node.spec()->begin(), node.spec()->end())) + " labels, but expected 1"); - fetch_restrict = LabelToFetchRestrict(**node.spec()->begin()).value; - } - - void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node) - { - Save<bool> s(&fetch_restrict); - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - Save<bool> s(&fetch_restrict); - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; -} - -bool -paludis::erepository::fetches_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using fetches_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.fetches_key_check", ll_debug, lc_context) << "fetches_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (id->fetches_key()) - { - try - { - Checker c(reporter, LabelToFetchRestrict(*id->fetches_key()->initial_label()).value, - id, id->fetches_key(), entry, name); - id->fetches_key()->value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + id->fetches_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->fetches_key())); - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/fetches_key.hh b/paludis/repositories/e/qa/fetches_key.hh deleted file mode 100644 index f98514028..000000000 --- a/paludis/repositories/e/qa/fetches_key.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_FETCHES_KEY_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_FETCHES_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool fetches_key_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/files_dir_size.cc b/paludis/repositories/e/qa/files_dir_size.cc deleted file mode 100644 index 025ad242c..000000000 --- a/paludis/repositories/e/qa/files_dir_size.cc +++ /dev/null @@ -1,81 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/files_dir_size.hh> -#include <paludis/qa.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/dir_iterator.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/is_file_with_extension.hh> -#include <paludis/util/log.hh> - -using namespace paludis; -using namespace paludis::erepository; - -bool -paludis::erepository::files_dir_size_check( - QAReporter & reporter, - const FSEntry & dir, - const std::string & name - ) -{ - Context context("When performing check '" + name + "' using files_dir_size_check on directory '" + stringify(dir) + "':"); - Log::get_instance()->message("e.qa.files_dir_size_check", ll_debug, lc_context) << "files_dir_size_check '" - << dir << "', " << name << "'"; - - 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(dir / "files"); - - if (f.total_size > (100 * 1024)) - reporter.message(QAMessage(dir / "files", qaml_minor, name, "files/ is way too bloated (" + - stringify(f.total_size / 1024) + "KBytes, excluding digests and CVS)")); - else if (f.total_size > (20 * 1024)) - reporter.message(QAMessage(dir / "files", qaml_minor, name, "files/ is oversized (" + - stringify(f.total_size / 1024) + "KBytes, excluding digests and CVS)")); - - return true; -} - diff --git a/paludis/repositories/e/qa/files_dir_size.hh b/paludis/repositories/e/qa/files_dir_size.hh deleted file mode 100644 index eff40b5b1..000000000 --- a/paludis/repositories/e/qa/files_dir_size.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_FILES_DIR_SIZE_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_FILES_DIR_SIZE_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool files_dir_size_check( - QAReporter &, - const FSEntry & dir, - const std::string & s - ); - } -} - -#endif diff --git a/paludis/repositories/e/qa/function_keyword.cc b/paludis/repositories/e/qa/function_keyword.cc deleted file mode 100644 index c6c5def67..000000000 --- a/paludis/repositories/e/qa/function_keyword.cc +++ /dev/null @@ -1,74 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Fernando J. Pereda - * - * 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 "function_keyword.hh" -#include <paludis/qa.hh> -#include <paludis/util/log.hh> -#include <pcrecpp.h> -#include <list> -#include <sstream> - -using namespace paludis; - -namespace -{ - QAMessage - with_id(QAMessage m, const std::tr1::shared_ptr<const PackageID> & id) - { - return id ? m.with_associated_id(id) : m; - } -} - -bool -paludis::erepository::function_keyword_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using function_keyword_check on '" + (id ? stringify(*id) : stringify(entry)) + "':"); - - pcrecpp::RE r_function("^function +[^ ]+ *(\\(\\))? *{?"); - - if (id) - Log::get_instance()->message("e.qa.function_keyword_check", ll_debug, lc_context) << "function_keyword '" - << entry << "', '" << *id << "', '" << name << "'"; - else - Log::get_instance()->message("e.qa.function_keyword_check", ll_debug, lc_context) << "function_keyword '" - << entry << "', '" << name << "'"; - - std::stringstream ff(content); - - std::string s; - unsigned line_number(0); - while (std::getline(ff, s)) - { - ++line_number; - - if (s.empty()) - continue; - - if (r_function.PartialMatch(s)) - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Use of the keyword 'function' on line " + stringify(line_number)), id)); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/function_keyword.hh b/paludis/repositories/e/qa/function_keyword.hh deleted file mode 100644 index f4cc52b4f..000000000 --- a/paludis/repositories/e/qa/function_keyword.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_FUNCTION_KEYWORD_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_FUNCTION_KEYWORD_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool function_keyword_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &) PALUDIS_VISIBLE; - } -} - - -#endif diff --git a/paludis/repositories/e/qa/function_keyword_TEST.cc b/paludis/repositories/e/qa/function_keyword_TEST.cc deleted file mode 100644 index 0660d558c..000000000 --- a/paludis/repositories/e/qa/function_keyword_TEST.cc +++ /dev/null @@ -1,89 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * Copyright (c) 2007 Fernando J. Pereda - * - * 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 "function_keyword.hh" -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage &) - { - ++count; - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct FunctionKeywordTest : TestCase - { - FunctionKeywordTest() : TestCase("function_keyword") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r1; - TEST_CHECK(function_keyword_check(FSEntry("/var/empty"), r1, id, "function something () {\n : ;\n}\n", "function_keyword")); - TEST_CHECK_EQUAL(r1.count, 1u); - - TestReporter r2; - TEST_CHECK(function_keyword_check(FSEntry("/var/empty"), r2, id, "function foo\n{\n : ;\n}\n", "function_keyword")); - TEST_CHECK_EQUAL(r2.count, 1u); - - TestReporter r3; - TEST_CHECK(function_keyword_check(FSEntry("/var/empty"), r3, id, "function bar (){\n : ;\n}\n", "function_keyword")); - TEST_CHECK_EQUAL(r3.count, 1u); - - TestReporter r4; - TEST_CHECK(function_keyword_check(FSEntry("/var/empty"), r4, id, "# function something\nbah() {\n : ;\n}\n", "function_keyword")); - TEST_CHECK_EQUAL(r4.count, 0u); - } - } test_function_keyword; -} - diff --git a/paludis/repositories/e/qa/header.cc b/paludis/repositories/e/qa/header.cc deleted file mode 100644 index 02c5ed595..000000000 --- a/paludis/repositories/e/qa/header.cc +++ /dev/null @@ -1,104 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Danny van Dyk - * - * 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 "header.hh" -#include <paludis/qa.hh> -#include <paludis/util/log.hh> -#include <pcrecpp.h> -#include <time.h> -#include <vector> -#include <sstream> - -using namespace paludis; - -namespace -{ - QAMessage - with_id(QAMessage m, const std::tr1::shared_ptr<const PackageID> & id) - { - return id ? m.with_associated_id(id) : m; - } -} - -bool -paludis::erepository::header_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using default_functions on '" + (id ? stringify(*id) : stringify(entry)) + "':"); - - if (id) - Log::get_instance()->message("e.qa.header_check", ll_debug, lc_context) << "header '" - << entry << "', '" << *id << "', '" << name << "'"; - else - Log::get_instance()->message("e.qa.header_check", ll_debug, lc_context) << "header '" - << entry << "', '" << name << "'"; - - pcrecpp::RE r_licence("^# Distributed under the terms of the GNU General Public License v2$"); - // Match both CVS tag and extract year.[0] - pcrecpp::RE r_cvs_header("^#\\s*\\$Header.*\\s(\\d{4})/\\d{2}/\\d{2}\\s.*\\$$"); - pcrecpp::RE r_cvs_empty_header("^#\\s*\\$Header:\\s*\\$$"); - - std::stringstream ff(content); - - std::string s; - std::vector<std::string> lines; - for (unsigned line_number(0) ; line_number < 3 ; ++line_number) - { - std::getline(ff, s); - lines.push_back(s); - } - - do - { - if (! r_licence.PartialMatch(lines[1])) - reporter.message(with_id(QAMessage(entry, qaml_normal, name, "Wrong licence statement in line 2"), id)); - - std::string year; - - // Check line 3 before line 1 to extract date of last commit - if (r_cvs_empty_header.PartialMatch(lines[2])) - { - time_t now(time(NULL)); - struct tm now_struct; - year = stringify(localtime_r(&now, &now_struct)->tm_year + 1900); - } - else if (r_cvs_header.PartialMatch(lines[2], &year)) - { - } - else - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Unknown CVS tag in line 3"), id)); - break; - } - - Log::get_instance()->message("e.qa.header_check.year", ll_debug, lc_context) << "Expected copyright year is " << year; - pcrecpp::RE r_copyright("^# Copyright ((1999|200\\d)-)?" + year + " Gentoo Foundation$"); - - if (! r_copyright.PartialMatch(lines[0])) - reporter.message(with_id(QAMessage(entry, qaml_normal, name, "Wrong copyright assignment in line 1, possibly date related"), id)); - - } while (false); - - return true; -} - diff --git a/paludis/repositories/e/qa/header.hh b/paludis/repositories/e/qa/header.hh deleted file mode 100644 index 8d33b9deb..000000000 --- a/paludis/repositories/e/qa/header.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_HEADER_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_HEADER_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool header_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/homepage_key.cc b/paludis/repositories/e/qa/homepage_key.cc deleted file mode 100644 index 471002808..000000000 --- a/paludis/repositories/e/qa/homepage_key.cc +++ /dev/null @@ -1,114 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "homepage_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/log.hh> -#include <paludis/name.hh> -#include <paludis/dep_spec.hh> -#include <paludis/package_id.hh> -#include <paludis/util/fs_entry.hh> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct HomepageChecker - { - const std::tr1::shared_ptr<const MetadataKey> & key; - const FSEntry entry; - QAReporter & reporter; - const std::tr1::shared_ptr<const PackageID> id; - const std::string name; - bool found_one; - - HomepageChecker( - const std::tr1::shared_ptr<const MetadataKey> & k, - const FSEntry & f, - QAReporter & r, - const std::tr1::shared_ptr<const PackageID> & i, - const std::string & n) : - key(k), - entry(f), - reporter(r), - id(i), - name(n), - found_one(false) - { - } - - ~HomepageChecker() - { - if (! found_one) - reporter.message(QAMessage(entry, qaml_normal, name, "Homepage specifies no URIs") - .with_associated_id(id) - .with_associated_key(id, key)); - } - - void visit(const SimpleURISpecTree::NodeType<SimpleURIDepSpec>::Type & node) - { - found_one = true; - - if (0 != node.spec()->text().compare(0, 7, "http://") && - 0 != node.spec()->text().compare(0, 8, "https://") && - 0 != node.spec()->text().compare(0, 6, "ftp://")) - reporter.message(QAMessage(entry, qaml_normal, name, - "Homepage uses no or unknown protocol in part '" + node.spec()->text() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - - void visit(const SimpleURISpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const SimpleURISpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; -} - -bool -paludis::erepository::homepage_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using homepage_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.homepage_key_check", ll_debug, lc_context) << "homepage_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (! id->homepage_key()) - reporter.message(QAMessage(entry, qaml_normal, name, "No homepage available") - .with_associated_id(id)); - else - { - HomepageChecker h(id->homepage_key(), entry, reporter, id, name); - id->homepage_key()->value()->root()->accept(h); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/homepage_key.hh b/paludis/repositories/e/qa/homepage_key.hh deleted file mode 100644 index 92c6f02a4..000000000 --- a/paludis/repositories/e/qa/homepage_key.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_HOMEPAGE_KEY_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_HOMEPAGE_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool homepage_key_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/homepage_key_TEST.cc b/paludis/repositories/e/qa/homepage_key_TEST.cc deleted file mode 100644 index e0dfbdd92..000000000 --- a/paludis/repositories/e/qa/homepage_key_TEST.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * Copyright (c) 2008 David Leverton - * - * 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 "homepage_key.hh" -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - std::string last_message; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage & m) - { - ++count; - last_message = m.message(); - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct GoodTest : TestCase - { - GoodTest() : TestCase("good") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->homepage_key()->set_from_string("http://paludis.pioto.org/"); - - TestReporter r; - TEST_CHECK(homepage_key_check(FSEntry("/var/empty"), r, id, "homepage_key")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_good; - - struct BadTest : TestCase - { - BadTest() : TestCase("bad") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->homepage_key()->set_from_string("ptth://paludis.pioto.org/"); - - TestReporter r; - TEST_CHECK(homepage_key_check(FSEntry("/var/empty"), r, id, "homepage_key")); - TEST_CHECK_EQUAL(r.count, 1u); - TEST_CHECK_EQUAL(r.last_message, "Homepage uses no or unknown protocol in part 'ptth://paludis.pioto.org/'"); - } - } test_bad; - - struct EmptyTest : TestCase - { - EmptyTest() : TestCase("empty") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->homepage_key()->set_from_string("( )"); - - TestReporter r; - TEST_CHECK(homepage_key_check(FSEntry("/var/empty"), r, id, "homepage_key")); - TEST_CHECK_EQUAL(r.count, 1u); - TEST_CHECK_EQUAL(r.last_message, "Homepage specifies no URIs"); - } - } test_empty; -} - diff --git a/paludis/repositories/e/qa/inherited_blacklist.conf b/paludis/repositories/e/qa/inherited_blacklist.conf deleted file mode 100644 index 89b5b06f4..000000000 --- a/paludis/repositories/e/qa/inherited_blacklist.conf +++ /dev/null @@ -1,8 +0,0 @@ -64-bit -debug -gcc -gtk-engines -gtk-engines2 -kernel-mod -kmod -pcmcia diff --git a/paludis/repositories/e/qa/inherited_key.cc b/paludis/repositories/e/qa/inherited_key.cc deleted file mode 100644 index 8bbd167f0..000000000 --- a/paludis/repositories/e/qa/inherited_key.cc +++ /dev/null @@ -1,108 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "inherited_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/instantiation_policy-impl.hh> -#include <paludis/util/config_file.hh> -#include <paludis/util/options.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/log.hh> -#include <paludis/util/system.hh> -#include <paludis/package_id.hh> -#include <paludis/util/fs_entry.hh> -#include <set> - -using namespace paludis; - -namespace -{ - struct InheritedBlacklist : - InstantiationPolicy<InheritedBlacklist, instantiation_method::SingletonTag> - { - std::set<std::string> inherited_blacklist; - - InheritedBlacklist(const FSEntry & f = FSEntry(getenv_with_default("PALUDIS_QA_DATA_DIR", - stringify(FSEntry(DATADIR) / "paludis" / "qa"))) / "inherited_blacklist.conf") - { - try - { - LineConfigFile inherited_blacklist_file(f, LineConfigFileOptions()); - std::copy(inherited_blacklist_file.begin(), inherited_blacklist_file.end(), - std::inserter(inherited_blacklist, inherited_blacklist.end())); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - Log::get_instance()->message("e.qa.inherited_key_check.configuration_error", ll_warning, lc_context) - << "Got error '" << e.message() << "' (" << e.what() - << ") when loading inherited_blacklist.conf for QA inherited_key"; - } - } - }; -} - -bool -paludis::erepository::inherited_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using inherited_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.inherited_key_check", ll_debug, lc_context) << "inherited_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (id->inherited_key()) - { - try - { - const std::set<std::string> & inherited_blacklist(InheritedBlacklist::get_instance()->inherited_blacklist); - - for (Set<std::string>::ConstIterator it(id->inherited_key()->value()->begin()), - it_end(id->inherited_key()->value()->end()); it_end != it; ++it) - if (inherited_blacklist.end() != inherited_blacklist.find(*it)) - reporter.message(QAMessage(entry, qaml_normal, name, "Deprecated inherit '" + *it + "' in '" + id->inherited_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->inherited_key())); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + id->inherited_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->inherited_key())); - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/inherited_key.hh b/paludis/repositories/e/qa/inherited_key.hh deleted file mode 100644 index cffceaf76..000000000 --- a/paludis/repositories/e/qa/inherited_key.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_INHERITED_KEY_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_INHERITED_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool inherited_key_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/iuse_blacklist.conf b/paludis/repositories/e/qa/iuse_blacklist.conf deleted file mode 100644 index afed31f88..000000000 --- a/paludis/repositories/e/qa/iuse_blacklist.conf +++ /dev/null @@ -1,5 +0,0 @@ -gtk2 -oggvorbis -qt -tcltk -xml2 diff --git a/paludis/repositories/e/qa/iuse_key.cc b/paludis/repositories/e/qa/iuse_key.cc deleted file mode 100644 index 809cf1be4..000000000 --- a/paludis/repositories/e/qa/iuse_key.cc +++ /dev/null @@ -1,120 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "iuse_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/config_file.hh> -#include <paludis/util/create_iterator-impl.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/instantiation_policy-impl.hh> -#include <paludis/util/log.hh> -#include <paludis/util/options.hh> -#include <paludis/util/set.hh> -#include <paludis/util/system.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/repositories/e/iuse.hh> -#include <paludis/name.hh> -#include <paludis/package_id.hh> -#include <paludis/repository.hh> -#include <paludis/choice.hh> -#include <set> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct IUseBlacklist : - InstantiationPolicy<IUseBlacklist, instantiation_method::SingletonTag> - { - std::set<ChoiceNameWithPrefix> iuse_blacklist; - - IUseBlacklist(const FSEntry & f = FSEntry(getenv_with_default("PALUDIS_QA_DATA_DIR", - stringify(FSEntry(DATADIR) / "paludis" / "qa"))) / "iuse_blacklist.conf") - { - try - { - LineConfigFile iuse_blacklist_file(f, LineConfigFileOptions()); - std::copy(iuse_blacklist_file.begin(), iuse_blacklist_file.end(), - create_inserter<ChoiceNameWithPrefix>(std::inserter(iuse_blacklist, iuse_blacklist.end()))); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - Log::get_instance()->message("e.qa.iuse_key_check.configuration_error", ll_warning, lc_context) - << "Got error '" << e.message() << "' (" << e.what() - << ") when loading iuse_blacklist.conf for QA iuse_key"; - } - } - }; -} - -bool -paludis::erepository::iuse_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const Repository> &, - const std::tr1::shared_ptr<const PackageID> & id_raw, - const std::string & name) -{ - Context context("When performing check '" + name + "' using iuse_key_check on ID '" + stringify(*id_raw) + "':"); - Log::get_instance()->message("e.qa.iuse_key_check", ll_debug, lc_context) << "iuse_key_check '" - << entry << "', " << *id_raw << "', " << name << "'"; - - std::tr1::shared_ptr<const ERepositoryID> id(std::tr1::static_pointer_cast<const ERepositoryID>(id_raw)); - if (id->raw_iuse_key()) - { - try - { - const std::set<ChoiceNameWithPrefix> & iuse_blacklist(IUseBlacklist::get_instance()->iuse_blacklist); - - for (Set<std::string>::ConstIterator - it(id->raw_iuse_key()->value()->begin()), - it_end(id->raw_iuse_key()->value()->end()); it_end != it; ++it) - { - ChoiceNameWithPrefix flag(parse_iuse(id->eapi(), *it).first); - if (iuse_blacklist.end() != iuse_blacklist.find(flag)) - reporter.message(QAMessage(entry, qaml_minor, name, - "Deprecated flag '" + stringify(flag) + "' in '" + id->raw_iuse_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->raw_iuse_key())); - } - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + id->raw_iuse_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->raw_iuse_key())); - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/iuse_key.hh b/paludis/repositories/e/qa/iuse_key.hh deleted file mode 100644 index 61381fa5e..000000000 --- a/paludis/repositories/e/qa/iuse_key.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_IUSE_KEY_HH -#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_IUSE_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/repository-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool - iuse_key_check( - const FSEntry &, - QAReporter & reporter, - const std::tr1::shared_ptr<const Repository> &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/keywords_key.cc b/paludis/repositories/e/qa/keywords_key.cc deleted file mode 100644 index ddb2b0420..000000000 --- a/paludis/repositories/e/qa/keywords_key.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "keywords_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/set.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/log.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/package_id.hh> -#include <paludis/name.hh> -#include <paludis/util/fs_entry.hh> - -using namespace paludis; - -bool -paludis::erepository::keywords_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using keywords_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.keywords_key_check", ll_debug, lc_context) << "keywords_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (id->keywords_key()) - { - try - { - const Set<KeywordName> & keywords(*id->keywords_key()->value()); - - if (1 == keywords.size() && keywords.end() != keywords.find(KeywordName("-*"))) - reporter.message(QAMessage(entry, qaml_normal, name, - "-* abuse in '" + id->keywords_key()->raw_name() + "' (use package.mask and keyword properly)") - .with_associated_id(id) - .with_associated_key(id, id->keywords_key())); - - else if (keywords.empty()) - reporter.message(QAMessage(entry, qaml_normal, name, - "Empty '" + id->keywords_key()->raw_name() + "' (use package.mask and keyword properly)") - .with_associated_id(id) - .with_associated_key(id, id->keywords_key())); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + id->keywords_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->keywords_key())); - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/keywords_key.hh b/paludis/repositories/e/qa/keywords_key.hh deleted file mode 100644 index b90c57c78..000000000 --- a/paludis/repositories/e/qa/keywords_key.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_KEYWORDS_KEY_HH -#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_KEYWORDS_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool - keywords_key_check( - const FSEntry &, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/kv_variables.cc b/paludis/repositories/e/qa/kv_variables.cc deleted file mode 100644 index 7083329e6..000000000 --- a/paludis/repositories/e/qa/kv_variables.cc +++ /dev/null @@ -1,64 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/kv_variables.hh> -#include <paludis/qa.hh> -#include <paludis/util/strip.hh> -#include <paludis/util/log.hh> -#include <pcrecpp.h> -#include <list> -#include <sstream> - -using namespace paludis; - -bool -paludis::erepository::kv_variables_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using kv_variables on '" + stringify(*id) + "':"); - - pcrecpp::RE r_global("^[a-zA-Z0-9\\_]+=.*\\$[{}]?KV"); - pcrecpp::RE r_detect_version("^detect_version$"); - - Log::get_instance()->message("e.qa.kv_variables_check", ll_debug, lc_context) << "kv_variables '" - << entry << "', '" << *id << "', '" << name << "'"; - - std::stringstream ff(content); - - std::string line; - unsigned line_number(0); - while (std::getline(ff, line)) - { - ++line_number; - - if (r_detect_version.PartialMatch(line)) - break; - - if (r_global.PartialMatch(line)) - reporter.message(QAMessage(entry, qaml_normal, name, "KV variable with no detect_version on line " - + stringify(line_number) + ": " + strip_leading(line, " \t"))); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/kv_variables.hh b/paludis/repositories/e/qa/kv_variables.hh deleted file mode 100644 index 36f8182c5..000000000 --- a/paludis/repositories/e/qa/kv_variables.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_VARIANT_GLOBALS_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_VARIANT_GLOBALS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool kv_variables_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/kv_variables_TEST.cc b/paludis/repositories/e/qa/kv_variables_TEST.cc deleted file mode 100644 index 62bc07716..000000000 --- a/paludis/repositories/e/qa/kv_variables_TEST.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "kv_variables.hh" -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - std::string messages; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage & m) - { - ++count; - if (! messages.empty()) - messages.append(", "); - messages.append(m.message()); - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct GoodTest : TestCase - { - GoodTest() : TestCase("good") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r; - TEST_CHECK(kv_variables_check(FSEntry("/var/empty"), r, id, "X=KV\n", "kv_variables")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_good; - - struct BadTest : TestCase - { - BadTest() : TestCase("bad") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r; - TEST_CHECK(kv_variables_check(FSEntry("/var/empty"), r, id, "SLOT=\"foo-$KV\"\n", "kv_variables")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_bad; -} - diff --git a/paludis/repositories/e/qa/license_key.cc b/paludis/repositories/e/qa/license_key.cc deleted file mode 100644 index b3277c0e6..000000000 --- a/paludis/repositories/e/qa/license_key.cc +++ /dev/null @@ -1,119 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "license_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/log.hh> -#include <paludis/util/sequence.hh> -#include <paludis/package_id.hh> -#include <paludis/name.hh> -#include <paludis/dep_spec.hh> -#include <paludis/util/fs_entry.hh> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct Checker - { - const FSEntry & entry; - QAReporter & reporter; - std::tr1::shared_ptr<const ERepositoryID> id; - std::tr1::shared_ptr<const FSEntrySequence> dirs; - std::string name; - - Checker(const FSEntry & e, QAReporter & r, const std::tr1::shared_ptr<const ERepositoryID> & p, - const std::tr1::shared_ptr<const FSEntrySequence> d, const std::string & n) : - entry(e), - reporter(r), - id(p), - dirs(d), - name(n) - { - } - - void visit(const LicenseSpecTree::NodeType<LicenseDepSpec>::Type & node) - { - for (FSEntrySequence::ConstIterator it(dirs->begin()), - it_end(dirs->end()); it_end != it; ++it) - if (((*it) / node.spec()->text()).is_regular_file_or_symlink_to_regular_file()) - return; - - reporter.message(QAMessage(entry, qaml_normal, name, - "Item '" + node.spec()->text() + "' in '" + id->license_key()->raw_name() + "' is not a licence") - .with_associated_id(id) - .with_associated_key(id, id->license_key())); - } - - void visit(const LicenseSpecTree::NodeType<AnyDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const LicenseSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const LicenseSpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; -} - -bool -paludis::erepository::license_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepository> & repo, - const std::tr1::shared_ptr<const ERepositoryID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using license_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.license_key_check", ll_debug, lc_context) << "license_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (id->license_key()) - { - try - { - Checker c(entry, reporter, id, repo->layout()->licenses_dirs(), name); - id->license_key()->value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + id->license_key()->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, id->license_key())); - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/license_key.hh b/paludis/repositories/e/qa/license_key.hh deleted file mode 100644 index e783796a5..000000000 --- a/paludis/repositories/e/qa/license_key.hh +++ /dev/null @@ -1,43 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_LICENSE_KEY_HH -#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_LICENSE_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool - license_key_check( - const FSEntry &, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepository> &, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/manifest.cc b/paludis/repositories/e/qa/manifest.cc deleted file mode 100644 index b6ddd5ac0..000000000 --- a/paludis/repositories/e/qa/manifest.cc +++ /dev/null @@ -1,300 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Fernando J. Pereda - * Copyright (c) 2008 David Leverton - * - * 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 "manifest.hh" -#include <paludis/qa.hh> -#include <paludis/spec_tree.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/log.hh> -#include <paludis/util/system.hh> -#include <paludis/util/map.hh> -#include <paludis/util/member_iterator-impl.hh> -#include <paludis/util/set.hh> -#include <paludis/util/wrapped_forward_iterator-impl.hh> -#include <paludis/util/sha1.hh> -#include <paludis/util/sha256.hh> -#include <paludis/util/rmd160.hh> -#include <paludis/util/md5.hh> -#include <paludis/util/safe_ifstream.hh> -#include <paludis/repositories/e/e_repository.hh> -#include <paludis/repositories/e/layout.hh> -#include <paludis/repositories/e/manifest2_reader.hh> -#include <set> -#include <map> - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct DistfilesCollector - { - std::tr1::shared_ptr<const PackageID> id; - std::map<std::string, std::tr1::shared_ptr<PackageIDSet> > & distfiles; - - DistfilesCollector(const std::tr1::shared_ptr<const PackageID> & i, - std::map<std::string, std::tr1::shared_ptr<PackageIDSet> > & d) : - id(i), - distfiles(d) - { - } - - void visit(const FetchableURISpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const FetchableURISpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const FetchableURISpecTree::NodeType<URILabelsDepSpec>::Type &) - { - } - - void visit(const FetchableURISpecTree::NodeType<FetchableURIDepSpec>::Type & node) - { - std::map<std::string, std::tr1::shared_ptr<PackageIDSet> >::iterator it(distfiles.find(node.spec()->filename())); - if (distfiles.end() == it) - { - std::tr1::shared_ptr<PackageIDSet> set(new PackageIDSet); - it = distfiles.insert(std::make_pair(node.spec()->filename(), set)).first; - } - it->second->insert(id); - } - }; - - struct Manifest2Checker - { - QAReporter & reporter; - FSEntry dir; - std::string name; - - FSEntry manifest; - std::tr1::shared_ptr<Map<FSEntry, std::string> > files; - std::tr1::shared_ptr<const PackageIDSequence> packages; - - std::set<FSEntry> accounted_files; - std::map<std::string, std::tr1::shared_ptr<PackageIDSet> > distfiles; - std::set<std::string> accounted_distfiles; - - Manifest2Checker(QAReporter & r, const FSEntry & d, const std::string & n, - const FSEntry & m, const std::tr1::shared_ptr<Map<FSEntry, std::string> > & f, - const std::tr1::shared_ptr<const PackageIDSequence> & p) : - reporter(r), - dir(d), - name(n), - manifest(m), - files(f), - packages(p) - { - } - - void check_file(const Manifest2Entry & entry) - { - if ("DIST" == entry.type()) - { - if (distfiles.end() == distfiles.find(entry.name())) - { - QAMessage m(manifest, qaml_minor, name, "DIST file '" + entry.name() + "' is not used by any package"); - for (PackageIDSequence::ConstIterator it(packages->begin()), - it_end(packages->end()); it_end != it; ++it) - { - m = m.with_associated_id(*it); - if ((*it)->fetches_key()) - m = m.with_associated_key(*it, (*it)->fetches_key()); - } - reporter.message(m); - } - - accounted_distfiles.insert(entry.name()); - return; - } - - FSEntry file("AUX" == entry.type() ? dir / "files" / entry.name() : dir / entry.name()); - Map<FSEntry, std::string>::ConstIterator it(files->find(file)); - if (files->end() == it) - { - reporter.message(QAMessage(file, qaml_normal, name, "File is listed in the Manifest but is either not present or should not be listed")); - return; - } - - if (entry.type() != it->second) - reporter.message(QAMessage(file, qaml_normal, name, "File is of type '" + it->second + "', but Manifest lists '" + entry.type() + "'")); - if (entry.size() != file.file_size()) - reporter.message(QAMessage(file, qaml_normal, name, "File size is '" + stringify(file.file_size()) + "', but Manifest lists '" + stringify(entry.size()) + "'")); - - if (! entry.sha1().empty()) - { - SafeIFStream s(file); - SHA1 sha1(s); - if (entry.sha1() != sha1.hexsum()) - reporter.message(QAMessage(file, qaml_normal, name, "File SHA1 is '" + sha1.hexsum() + "', but Manifest lists '" + entry.sha1() + "'")); - - } - - if (! entry.sha256().empty()) - { - SafeIFStream s(file); - SHA256 sha256(s); - if (entry.sha256() != sha256.hexsum()) - reporter.message(QAMessage(file, qaml_normal, name, "File SHA256 is '" + sha256.hexsum() + "', but Manifest lists '" + entry.sha256() + "'")); - - } - - if (! entry.rmd160().empty()) - { - SafeIFStream s(file); - RMD160 rmd160(s); - if (entry.rmd160() != rmd160.hexsum()) - reporter.message(QAMessage(file, qaml_normal, name, "File RMD160 is '" + rmd160.hexsum() + "', but Manifest lists '" + entry.rmd160() + "'")); - - } - - if (! entry.md5().empty()) - { - SafeIFStream s(file); - MD5 md5(s); - if (entry.md5() != md5.hexsum()) - reporter.message(QAMessage(file, qaml_normal, name, "File MD5 is '" + md5.hexsum() + "', but Manifest lists '" + entry.md5() + "'")); - - } - - accounted_files.insert(it->first); - } - - void check_unmanifested() - { - std::set<FSEntry> stray_files; - std::set_difference(first_iterator(files->begin()), first_iterator(files->end()), - accounted_files.begin(), accounted_files.end(), - std::inserter(stray_files, stray_files.end())); - - for (std::set<FSEntry>::const_iterator file_it(stray_files.begin()), - file_it_end(stray_files.end()); file_it_end != file_it; ++file_it) - reporter.message(QAMessage(*file_it, qaml_normal, name, "File is not listed in the Manifest")); - - std::set<std::string> stray_distfiles; - std::set_difference(first_iterator(distfiles.begin()), first_iterator(distfiles.end()), - accounted_distfiles.begin(), accounted_distfiles.end(), - std::inserter(stray_distfiles, stray_distfiles.end())); - - for (std::set<std::string>::const_iterator dist_it(stray_distfiles.begin()), - dist_it_end(stray_distfiles.end()); dist_it_end != dist_it; ++dist_it) - { - std::tr1::shared_ptr<const PackageIDSet> set(distfiles.find(*dist_it)->second); - for (PackageIDSet::ConstIterator pkg_it(set->begin()), - pkg_it_end(set->end()); pkg_it_end != pkg_it; ++pkg_it) - reporter.message(QAMessage((*pkg_it)->fs_location_key()->value(), qaml_normal, name, "DIST file '" + *dist_it + "' is not listed in the Manifest") - .with_associated_id(*pkg_it) - .with_associated_key(*pkg_it, (*pkg_it)->fetches_key())); - } - } - }; -} - -bool -paludis::erepository::manifest_check( - QAReporter & reporter, - const FSEntry & dir, - const std::tr1::shared_ptr<const ERepository> & repo, - const QualifiedPackageName & qpn, - const std::string & name - ) -{ - using namespace std::tr1::placeholders; - - Context context("When performing check '" + name + "' using manifest_check on directory '" + stringify(dir) + "':"); - Log::get_instance()->message("e.qa.manifest_check", ll_debug, lc_context) << "manifest_check '" - << dir << "', " << name << "'"; - - try - { - FSEntry manifest(dir / "Manifest"); - - if (! manifest.is_regular_file()) - { - reporter.message(QAMessage(manifest, qaml_normal, name, "Manifest is missing or not a regular file")); - return true; - } - - std::tr1::shared_ptr<const PackageIDSequence> ids(repo->package_ids(qpn)); - Manifest2Checker checker(reporter, dir, name, manifest, repo->layout()->manifest_files(qpn), ids); - for (PackageIDSequence::ConstIterator it(ids->begin()), - it_end(ids->end()); it_end != it; ++it) - { - if ((*it)->fetches_key()) - { - DistfilesCollector c(*it, checker.distfiles); - (*it)->fetches_key()->value()->root()->accept(c); - } - } - - Manifest2Reader reader(manifest); - std::for_each(reader.begin(), reader.end(), std::tr1::bind(&Manifest2Checker::check_file, std::tr1::ref(checker), _1)); - checker.check_unmanifested(); - - bool is_signed(false); - { - try - { - SafeIFStream ff(manifest); - std::string s; - if (std::getline(ff, s)) - is_signed = (0 == s.compare("-----BEGIN PGP SIGNED MESSAGE-----")); - } - catch (const SafeIFStreamError &) - { - reporter.message(QAMessage(manifest, qaml_normal, name, "Can't read Manifest file")); - return true; - } - } - - if (is_signed) - { - int status(run_command("gpg --verify " + stringify(manifest) + " >/dev/null 2>/dev/null")); - - if (1 == status) - reporter.message(QAMessage(manifest, qaml_normal, name, "Broken Manifest signature")); - else if (2 == status) - reporter.message(QAMessage(manifest, qaml_maybe, name, "Manifest signature cannot be verified")); - } - else - reporter.message(QAMessage(manifest, qaml_minor, name, "Manifest not signed")); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(dir, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when checking Manifest for '" + stringify(qpn) + "'")); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/manifest.hh b/paludis/repositories/e/qa/manifest.hh deleted file mode 100644 index d4a6d3e6b..000000000 --- a/paludis/repositories/e/qa/manifest.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_MANIFEST_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_MANIFEST_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool manifest_check( - QAReporter &, - const FSEntry & dir, - const std::tr1::shared_ptr<const ERepository> &, - const QualifiedPackageName &, - const std::string & s - ) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/manifest_TEST.cc b/paludis/repositories/e/qa/manifest_TEST.cc deleted file mode 100644 index d014e53d0..000000000 --- a/paludis/repositories/e/qa/manifest_TEST.cc +++ /dev/null @@ -1,307 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Fernando J. Pereda - * Copyright (c) 2008 David Leverton - * - * 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 "manifest.hh" -#include <paludis/qa.hh> -#include <paludis/util/system.hh> -#include <paludis/util/fd_holder.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/map.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/repositories/e/e_repository.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::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage &) - { - ++count; - } - - void status(const std::string &) - { - } - }; - - std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m, - const std::string & k) - { - Map<std::string, std::string>::ConstIterator mm(m->find(k)); - if (m->end() == mm) - return ""; - else - return mm->second; - } -} - -namespace test_cases -{ - struct GPGCheckTest : TestCase - { - GPGCheckTest() : TestCase("signed Manifest") { } - - bool skip() const - { - return (0 != run_command("gpg --help >/dev/null 2>/dev/null")); - } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/not-signed"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 1u); - - } - } test_gpg_check; - - struct ManifestGoodTest : TestCase - { - ManifestGoodTest() : TestCase("Manifest good") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/good"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_manifest_good; - - struct ManifestBadTypeTest : TestCase - { - ManifestBadTypeTest() : TestCase("Manifest bad type") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/bad-type"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 3u); - } - } test_manifest_bad_type; - - struct ManifestBadSizeTest : TestCase - { - ManifestBadSizeTest() : TestCase("Manifest bad size") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/bad-size"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 2u); - } - } test_manifest_bad_size; - - struct ManifestBadHashTest : TestCase - { - ManifestBadHashTest() : TestCase("Manifest bad hash") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/bad-hash"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 5u); - } - } test_manifest_bad_hash; - - struct ManifestMissingFileTest : TestCase - { - ManifestMissingFileTest() : TestCase("Manifest missing file") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/missing"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 2u); - } - } test_manifest_missing_file; - - struct ManifestStrayFileTest : TestCase - { - ManifestStrayFileTest() : TestCase("Manifest stray file") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/stray"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 2u); - } - } test_manifest_stray_file; - - struct ManifestUnusedDistfileTest : TestCase - { - ManifestUnusedDistfileTest() : TestCase("Manifest unused distfile file") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/unused-distfile"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 2u); - } - } test_manifest_unused_distfile; - - struct ManifestUndigestedDistfileTest : TestCase - { - ManifestUndigestedDistfileTest() : TestCase("Manifest undigested distfile file") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "manifest_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - QualifiedPackageName qpn("cat/undigested-distfile"); - FSEntry dir(repo->layout()->package_directory(qpn)); - - TestReporter r; - TEST_CHECK(manifest_check(r, dir, repo, qpn, "manifest")); - TEST_CHECK_EQUAL(r.count, 2u); - } - } test_manifest_undigested_distfile; -} - diff --git a/paludis/repositories/e/qa/manifest_TEST_cleanup.sh b/paludis/repositories/e/qa/manifest_TEST_cleanup.sh deleted file mode 100755 index c361b7c71..000000000 --- a/paludis/repositories/e/qa/manifest_TEST_cleanup.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d manifest_TEST_dir ] ; then - rm -fr manifest_TEST_dir -else - true -fi diff --git a/paludis/repositories/e/qa/manifest_TEST_setup.sh b/paludis/repositories/e/qa/manifest_TEST_setup.sh deleted file mode 100755 index c1135b720..000000000 --- a/paludis/repositories/e/qa/manifest_TEST_setup.sh +++ /dev/null @@ -1,145 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir -p manifest_TEST_dir/repo1 || exit 2 -cd manifest_TEST_dir/repo1 || exit 3 - -mkdir -p {eclass,distfiles,profiles/test,cat-one/{visible,masked,needs-masked}} || exit 1 -echo "repo1" > profiles/repo_name || exit 1 -cat <<END > profiles/categories || exit 1 -cat -END -cat <<END > profiles/test/make.defaults -ARCH=test -ACCEPT_KEYWORDS=test -END -cat <<END > profiles/profiles.desc -test test/ stable -END - -mkdir "cat" || exit 4 -mkdir "cat/not-signed" || exit 5 -touch "cat/not-signed/Manifest" || exit 6 - -mkdir "cat/good" || exit 7 -mkdir "cat/good/files" || exit 8 -echo foo >cat/good/ChangeLog || exit 10 -echo foo >cat/good/files/foo.patch || exit 11 -cat >cat/good/good-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/good/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -EBUILD good-0.ebuild 34 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -END - -mkdir "cat/bad-type" || exit 7 -mkdir "cat/bad-type/files" || exit 8 -echo foo >cat/bad-type/ChangeLog || exit 10 -echo foo >cat/bad-type/files/foo.patch || exit 11 -cat >cat/bad-type/bad-type-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/bad-type/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -MISC bad-type-0.ebuild 34 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -EBUILD ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -END - -mkdir "cat/bad-size" || exit 7 -mkdir "cat/bad-size/files" || exit 8 -echo foo >cat/bad-size/ChangeLog || exit 10 -echo foo >cat/bad-size/files/foo.patch || exit 11 -cat >cat/bad-size/bad-size-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/bad-size/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -EBUILD bad-size-0.ebuild 35 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -END - -mkdir "cat/bad-hash" || exit 7 -mkdir "cat/bad-hash/files" || exit 8 -echo foo >cat/bad-hash/ChangeLog || exit 10 -echo foo >cat/bad-hash/files/foo.patch || exit 11 -cat >cat/bad-hash/bad-hash-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/bad-hash/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -EBUILD bad-hash-0.ebuild 34 SHA1 7834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 c68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 fc0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 e3b07384d113edec49eaa6238ad5ff00 -END - -mkdir "cat/missing" || exit 7 -mkdir "cat/missing/files" || exit 8 -echo foo >cat/missing/ChangeLog || exit 10 -echo foo >cat/missing/files/foo.patch || exit 11 -cat >cat/missing/missing-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/missing/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -EBUILD missing-0.ebuild 34 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX bar.patch 4 SHA1 e242ed3bffccdf271b7fbaf34ed72d089537b42f SHA256 7d865e959b2466918c9863afca942d0fb89d7c9ac0c99bafc3749504ded97730 RMD160 7d4e874a231f57b72509087d1e509942fdb6eac6 MD5 c157a79031e1c40f85931829bc5fc552 -END - -mkdir "cat/stray" || exit 7 -mkdir "cat/stray/files" || exit 8 -echo foo >cat/stray/ChangeLog || exit 10 -echo foo >cat/stray/files/foo.patch || exit 11 -echo foo >cat/stray/metadata.xml || exit 13 -cat >cat/stray/stray-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/stray/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -EBUILD stray-0.ebuild 34 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -END - -mkdir "cat/unused-distfile" || exit 7 -mkdir "cat/unused-distfile/files" || exit 8 -echo foo >cat/unused-distfile/ChangeLog || exit 10 -echo foo >cat/unused-distfile/files/foo.patch || exit 11 -cat >cat/unused-distfile/unused-distfile-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/unused-distfile/Manifest <<END || exit 12 -DIST monkey.tar.bz2 7 SHA1 744a9a056f145b86339221bb457aa57129f55bc2 SHA256 5a6e48105fea75ccccc66a038318f398c42761495d738786dc8a6d43179aa16a RMD160 7dbf02c6e0bbfda1550fc7ba0ebc4fdd866e2d3c MD5 2f548f61bd37f628077e552ae1537be2 -DIST donkey.tar.bz2 7 SHA1 726a4b06f832dc6d671285b492a81cebd7e98cb6 SHA256 45814cf76274a6bfdf2993b1d275a29faf1e1f8fa9fff6cf8c4f4c893ede2258 RMD160 73ee0ca7277576f1e316fd7097ebd3f02bcacf83 MD5 f5fa31b4e964cc2a86140bc2a2e11a13 -EBUILD unused-distfile-0.ebuild 34 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -END - -mkdir "cat/undigested-distfile" || exit 7 -mkdir "cat/undigested-distfile/files" || exit 8 -echo foo >cat/undigested-distfile/ChangeLog || exit 10 -echo foo >cat/undigested-distfile/files/foo.patch || exit 11 -cat >cat/undigested-distfile/undigested-distfile-0.ebuild <<END || exit 9 -SLOT="0" -SRC_URI="monkey.tar.bz2" -END -cat >cat/undigested-distfile/Manifest <<END || exit 12 -EBUILD undigested-distfile-0.ebuild 34 SHA1 6834113b3fed0c3833d3b7a42f7ead07c13209e8 SHA256 b68ae58845b2f3d15dad3eae2f02aaa2cfdbb14140c7d4a537a6bf4417fb0b30 RMD160 7bf5c52f5c2acf42d66961af3de9c97e4d2b1207 MD5 75fa0dc852d3c76e4741c650465bfa6c -MISC ChangeLog 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -AUX foo.patch 4 SHA1 f1d2d2f924e986ac86fdf7b36c94bcdf32beec15 SHA256 b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c RMD160 ec0af898b7b1ab23ccf8c5036cb97e9ab23442ab MD5 d3b07384d113edec49eaa6238ad5ff00 -END - diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc deleted file mode 100644 index c48f38a1c..000000000 --- a/paludis/repositories/e/qa/metadata_keys.cc +++ /dev/null @@ -1,188 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * Copyright (c) 2008 David Leverton - * - * 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_keys.hh" -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/qa.hh> -#include <paludis/dep_spec.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/log.hh> -#include <paludis/util/set.hh> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct KeyValidator - { - void visit(const MetadataValueKey<std::string> & k) - { - const std::string & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataValueKey<SlotName> & k) - { - const SlotName & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataValueKey<long> & k) - { - long PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataValueKey<bool> & k) - { - bool PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > & k) - { - const std::tr1::shared_ptr<const PackageID> & PALUDIS_ATTRIBUTE((unused)) p(k.value()); - } - - void visit(const MetadataTimeKey & k) - { - time_t PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const Contents> > & k) - { - const std::tr1::shared_ptr<const Contents> & PALUDIS_ATTRIBUTE((unused)) c(k.value()); - } - - void visit(const MetadataValueKey<FSEntry>& k) - { - const FSEntry & PALUDIS_ATTRIBUTE((unused)) c(k.value()); - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > & k) - { - const std::tr1::shared_ptr<const RepositoryMaskInfo> & PALUDIS_ATTRIBUTE((unused)) i(k.value()); - } - - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) - { - const std::tr1::shared_ptr<const PlainTextSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) - { - const std::tr1::shared_ptr<const ProvideSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) - { - const std::tr1::shared_ptr<const FetchableURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) - { - const std::tr1::shared_ptr<const SimpleURISpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) - { - const std::tr1::shared_ptr<const LicenseSpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) - { - const std::tr1::shared_ptr<const DependencySpecTree> & PALUDIS_ATTRIBUTE((unused)) t(k.value()); - } - - void visit(const MetadataCollectionKey<PackageIDSequence> & k) - { - const std::tr1::shared_ptr<const PackageIDSequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataCollectionKey<Set<std::string> > & k) - { - const std::tr1::shared_ptr<const Set<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataCollectionKey<Sequence<std::string> > & k) - { - const std::tr1::shared_ptr<const Sequence<std::string> > & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataCollectionKey<FSEntrySequence> & k) - { - const std::tr1::shared_ptr<const FSEntrySequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataCollectionKey<KeywordNameSet> & k) - { - const std::tr1::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k) - { - const std::tr1::shared_ptr<const Choices> & PALUDIS_ATTRIBUTE((unused)) s(k.value()); - } - - void visit(const MetadataSectionKey & k) - { - std::for_each(indirect_iterator(k.begin_metadata()), - indirect_iterator(k.end_metadata()), accept_visitor(*this)); - } - }; -} - -bool -paludis::erepository::metadata_keys_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.metadata_keys_check", ll_debug, lc_context) << "extractors_check '" - << entry << "', " << *id << "', " << name << "'"; - - bool retval(true); - KeyValidator validator; - - for (PackageID::MetadataConstIterator it(id->begin_metadata()), - it_end(id->end_metadata()); it_end != it; ++it) - { - try - { - (*it)->accept(validator); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - retval = false; - reporter.message(QAMessage(entry, qaml_severe, name, - "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + (*it)->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, *it)); - } - } - - return retval; -} - diff --git a/paludis/repositories/e/qa/metadata_keys.hh b/paludis/repositories/e/qa/metadata_keys.hh deleted file mode 100644 index 3e5c3127f..000000000 --- a/paludis/repositories/e/qa/metadata_keys.hh +++ /dev/null @@ -1,41 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * Copyright (c) 2008 David Leverton - * - * 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_PALUDIS_REPOSITORIES_E_QA_METADATA_KEYS_HH -#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_METADATA_KEYS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool metadata_keys_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/misc_files.cc b/paludis/repositories/e/qa/misc_files.cc deleted file mode 100644 index e167836d5..000000000 --- a/paludis/repositories/e/qa/misc_files.cc +++ /dev/null @@ -1,48 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/misc_files.hh> -#include <paludis/qa.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/log.hh> - -using namespace paludis; -using namespace paludis::erepository; - -bool -paludis::erepository::misc_files_check( - QAReporter & reporter, - const FSEntry & dir, - const std::string & name - ) -{ - Context context("When performing check '" + name + "' using misc_files_check on directory '" + stringify(dir) + "':"); - Log::get_instance()->message("e.qa.misc_files_check", ll_debug, lc_context) << "misc_files_check '" - << dir << "', " << name << "'"; - - if (! (dir / "metadata.xml").is_regular_file()) - reporter.message(QAMessage(dir / "metadata.xml", qaml_normal, name, "metadata.xml is missing or not a regular file")); - - if ((dir / "files").exists() && ! (dir / "files").is_directory()) - reporter.message(QAMessage(dir / "files", qaml_normal, name, "files/ exists but is not a directory")); - - return true; -} - diff --git a/paludis/repositories/e/qa/misc_files.hh b/paludis/repositories/e/qa/misc_files.hh deleted file mode 100644 index 89ebf9083..000000000 --- a/paludis/repositories/e/qa/misc_files.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_MISC_FILES_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_MISC_FILES_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool misc_files_check( - QAReporter &, - const FSEntry & dir, - const std::string & s - ) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/misc_files_TEST.cc b/paludis/repositories/e/qa/misc_files_TEST.cc deleted file mode 100644 index 00130d2b4..000000000 --- a/paludis/repositories/e/qa/misc_files_TEST.cc +++ /dev/null @@ -1,111 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 - * - * 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/repositories/e/qa/misc_files.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage &) - { - ++count; - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct HasMiscFilesCheckTest : TestCase - { - HasMiscFilesCheckTest() : TestCase("has misc files") { } - - void run() - { - FSEntry e("misc_files_TEST_dir"); - TEST_CHECK(e.exists()); - TEST_CHECK(e.is_directory()); - - FSEntry f1(e / "cat" / "yes"); - TEST_CHECK(f1.exists()); - - TestReporter r; - TEST_CHECK(misc_files_check(r, f1, "misc_files")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_has_misc_files_check; - - struct HasMiscFilesCheckNoMetadataTest : TestCase - { - HasMiscFilesCheckNoMetadataTest() : TestCase("has misc files no metadata.xml") { } - - void run() - { - FSEntry e("misc_files_TEST_dir"); - TEST_CHECK(e.exists()); - TEST_CHECK(e.is_directory()); - - FSEntry f1(e / "cat" / "no-metadata"); - TEST_CHECK(f1.exists()); - - TestReporter r; - TEST_CHECK(misc_files_check(r, f1, "misc_files")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_has_misc_files_check_no_metadata; - - struct HasMiscFilesCheckBadFilesTest : TestCase - { - HasMiscFilesCheckBadFilesTest() : TestCase("has misc files bad files/") { } - - void run() - { - FSEntry e("misc_files_TEST_dir"); - TEST_CHECK(e.exists()); - TEST_CHECK(e.is_directory()); - - FSEntry f1(e / "cat" / "bad-files"); - TEST_CHECK(f1.exists()); - - TestReporter r; - TEST_CHECK(misc_files_check(r, f1, "misc_files")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_has_misc_files_check_bad_files; -} - diff --git a/paludis/repositories/e/qa/misc_files_TEST_cleanup.sh b/paludis/repositories/e/qa/misc_files_TEST_cleanup.sh deleted file mode 100755 index 641b8e379..000000000 --- a/paludis/repositories/e/qa/misc_files_TEST_cleanup.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d misc_files_TEST_dir ] ; then - rm -fr misc_files_TEST_dir -else - true -fi - - - - diff --git a/paludis/repositories/e/qa/misc_files_TEST_setup.sh b/paludis/repositories/e/qa/misc_files_TEST_setup.sh deleted file mode 100755 index 2cd5596ee..000000000 --- a/paludis/repositories/e/qa/misc_files_TEST_setup.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir misc_files_TEST_dir || exit 2 -cd misc_files_TEST_dir || exit 3 - -mkdir "cat" || exit 4 - -mkdir "cat/yes" || exit 5 -touch "cat/yes/metadata.xml" || exit 6 -mkdir "cat/yes/files" || exit 7 - -mkdir "cat/no-metadata" || exit 8 -mkdir "cat/no-metadata/files" || exit 10 - -mkdir "cat/bad-files" || exit 11 -touch "cat/bad-files/metadata.xml" "cat/bad-files/files"|| exit 12 - diff --git a/paludis/repositories/e/qa/qa.cc b/paludis/repositories/e/qa/qa.cc deleted file mode 100644 index 8aa4ef1b6..000000000 --- a/paludis/repositories/e/qa/qa.cc +++ /dev/null @@ -1,46 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/qa_controller.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/qa-fwd.hh> - -using namespace paludis; - -namespace paludis -{ - class RepositoryFactory; - class ERepository; -} - -void check_qa( - const Environment * const env, - const std::tr1::shared_ptr<const ERepository> & repo, - const QACheckProperties & ignore_if, - const QACheckProperties & ignore_unless, - const QAMessageLevel minimum_level, - QAReporter & reporter, - const FSEntry & if_dir) -{ - erepository::QAController controller(env, repo, ignore_if, ignore_unless, minimum_level, reporter, if_dir); - controller.run(); -} - diff --git a/paludis/repositories/e/qa/qa_checks.cc b/paludis/repositories/e/qa/qa_checks.cc deleted file mode 100644 index a791fc483..000000000 --- a/paludis/repositories/e/qa/qa_checks.cc +++ /dev/null @@ -1,319 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/qa_checks.hh> -#include <paludis/repositories/e/extra_distribution_data.hh> -#include <paludis/util/private_implementation_pattern-impl.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/distribution.hh> -#include <paludis/environment.hh> - -#include <paludis/repositories/e/qa/stray_files.hh> -#include <paludis/repositories/e/qa/manifest.hh> -#include <paludis/repositories/e/qa/ebuild_count.hh> -#include <paludis/repositories/e/qa/changelog.hh> -#include <paludis/repositories/e/qa/misc_files.hh> -#include <paludis/repositories/e/qa/files_dir_size.hh> -#include <paludis/repositories/e/qa/eapi_supported.hh> -#include <paludis/repositories/e/qa/metadata_keys.hh> -#include <paludis/repositories/e/qa/short_description_key.hh> -#include <paludis/repositories/e/qa/homepage_key.hh> -#include <paludis/repositories/e/qa/iuse_key.hh> -#include <paludis/repositories/e/qa/keywords_key.hh> -#include <paludis/repositories/e/qa/license_key.hh> -#include <paludis/repositories/e/qa/spec_keys.hh> -#include <paludis/repositories/e/qa/extractors.hh> -#include <paludis/repositories/e/qa/fetches_key.hh> -#include <paludis/repositories/e/qa/restrict_key.hh> -#include <paludis/repositories/e/qa/inherited_key.hh> -#include <paludis/repositories/e/qa/visibility.hh> -#include <paludis/repositories/e/qa/default_functions.hh> -#include <paludis/repositories/e/qa/variable_assigns.hh> -#include <paludis/repositories/e/qa/deprecated_functions.hh> -#include <paludis/repositories/e/qa/kv_variables.hh> -#include <paludis/repositories/e/qa/root_variable.hh> -#include <paludis/repositories/e/qa/subshell_die.hh> -#include <paludis/repositories/e/qa/function_keyword.hh> -#include <paludis/repositories/e/qa/whitespace.hh> -#include <paludis/repositories/e/qa/header.hh> -#include <paludis/repositories/e/qa/repo_name.hh> -#include <paludis/repositories/e/qa/categories.hh> - -using namespace paludis; -using namespace paludis::erepository; - -namespace paludis -{ - template <> - struct Implementation<QAChecks> - { - const Environment * const env; - const std::tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> > tree_checks_group; - const std::tr1::shared_ptr<QAChecksGroup<EclassFileContentsCheckFunction> > eclass_file_contents_checks_group; - const std::tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> > category_dir_checks_group; - const std::tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> > package_dir_checks_group; - const std::tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> > package_id_checks_group; - const std::tr1::shared_ptr<QAChecksGroup<PackageIDFileContentsCheckFunction> > package_id_file_contents_checks_group; - - Implementation(const Environment * const e) : - env(e), - tree_checks_group(new QAChecksGroup<TreeCheckFunction>), - eclass_file_contents_checks_group(new QAChecksGroup<EclassFileContentsCheckFunction>), - category_dir_checks_group(new QAChecksGroup<CategoryDirCheckFunction>), - package_dir_checks_group(new QAChecksGroup<PackageDirCheckFunction>), - package_id_checks_group(new QAChecksGroup<PackageIDCheckFunction>), - package_id_file_contents_checks_group(new QAChecksGroup<PackageIDFileContentsCheckFunction>) - { - } - }; -} - -QAChecks::QAChecks(const Environment * const env) : - PrivateImplementationPattern<QAChecks>(new Implementation<QAChecks>(env)) -{ - using namespace std::tr1::placeholders; - - const std::tr1::shared_ptr<const EDistribution> distribution(EExtraDistributionData::get_instance()->data_from_distribution( - *DistributionData::get_instance()->distribution_from_string(_imp->env->distribution()))); - - if (distribution->qa_tree_checks()->end() != distribution->qa_tree_checks()->find("stray_tree_files")) - _imp->tree_checks_group->add_check("stray_tree_files", - std::tr1::bind(stray_files_check, _2, _4, _1, is_stray_at_tree_dir, "stray_tree_files")); - - if (distribution->qa_tree_checks()->end() != distribution->qa_tree_checks()->find("repo_name")) - _imp->tree_checks_group->add_check("repo_name", - std::tr1::bind(repo_name_check, _2, _1, "repo_name")); - - if (distribution->qa_tree_checks()->end() != distribution->qa_tree_checks()->find("categories")) - _imp->tree_checks_group->add_check("categories", - std::tr1::bind(categories_check, _2, _4, "categories")); - - if (distribution->qa_eclass_file_contents_checks()->end() != distribution->qa_eclass_file_contents_checks()->find("variable_assigns")) - _imp->eclass_file_contents_checks_group->add_check("variable_assigns", - std::tr1::bind(variable_assigns_check, _1, _2, std::tr1::shared_ptr<const ERepositoryID>(), _5, "variable_assigns")); - - if (distribution->qa_eclass_file_contents_checks()->end() != distribution->qa_eclass_file_contents_checks()->find("deprecated_functions")) - _imp->eclass_file_contents_checks_group->add_check("deprecated_functions", - std::tr1::bind(deprecated_functions_check, _1, _2, std::tr1::shared_ptr<const ERepositoryID>(), _5, "deprecated_functions")); - - if (distribution->qa_eclass_file_contents_checks()->end() != distribution->qa_eclass_file_contents_checks()->find("subshell_die")) - _imp->eclass_file_contents_checks_group->add_check("subshell_die", - std::tr1::bind(subshell_die_check, _1, _2, std::tr1::shared_ptr<const ERepositoryID>(), _5, "subshell_die")); - - if (distribution->qa_eclass_file_contents_checks()->end() != distribution->qa_eclass_file_contents_checks()->find("header")) - _imp->eclass_file_contents_checks_group->add_check("header", - std::tr1::bind(header_check, _1, _2, std::tr1::shared_ptr<const ERepositoryID>(), _5, "header")); - - if (distribution->qa_eclass_file_contents_checks()->end() != distribution->qa_eclass_file_contents_checks()->find("function_keyword")) - _imp->eclass_file_contents_checks_group->add_check("function_keyword", - std::tr1::bind(function_keyword_check, _1, _2, std::tr1::shared_ptr<const ERepositoryID>(), _5, "function_keyword")); - - if (distribution->qa_eclass_file_contents_checks()->end() != distribution->qa_eclass_file_contents_checks()->find("whitespace")) - _imp->eclass_file_contents_checks_group->add_check("whitespace", - std::tr1::bind(whitespace_check, _1, _2, std::tr1::shared_ptr<const ERepositoryID>(), _5, "whitespace")); - - if (distribution->qa_category_dir_checks()->end() != distribution->qa_category_dir_checks()->find("stray_category_dir_files")) - _imp->category_dir_checks_group->add_check("stray_category_dir_files", - std::tr1::bind(stray_files_check, _2, _4, _1, is_stray_at_category_dir, "stray_category_dir_files")); - - if (distribution->qa_package_dir_checks()->end() != distribution->qa_package_dir_checks()->find("manifest")) - _imp->package_dir_checks_group->add_check("manifest", - std::tr1::bind(manifest_check, _2, _1, _4, _5, "manifest")); - - if (distribution->qa_package_dir_checks()->end() != distribution->qa_package_dir_checks()->find("ebuild_count")) - _imp->package_dir_checks_group->add_check("ebuild_count", - std::tr1::bind(ebuild_count_check, _2, _1, _4, _5, "ebuild_count")); - - if (distribution->qa_package_dir_checks()->end() != distribution->qa_package_dir_checks()->find("changelog")) - _imp->package_dir_checks_group->add_check("changelog", - std::tr1::bind(changelog_check, _2, _1, _5, "changelog")); - - if (distribution->qa_package_dir_checks()->end() != distribution->qa_package_dir_checks()->find("misc_files")) - _imp->package_dir_checks_group->add_check("misc_files", - std::tr1::bind(misc_files_check, _2, _1, "misc_files")); - - if (distribution->qa_package_dir_checks()->end() != distribution->qa_package_dir_checks()->find("files_dir_size")) - _imp->package_dir_checks_group->add_check("files_dir_size", - std::tr1::bind(files_dir_size_check, _2, _1, "files_dir_size")); - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("eapi_supported")) - _imp->package_id_checks_group->add_check("eapi_supported", - std::tr1::bind(eapi_supported_check, _1, _2, _5, "eapi_supported")); - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("metadata_keys")) - { - _imp->package_id_checks_group->add_check("metadata_keys", - std::tr1::bind(metadata_keys_check, _1, _2, _5, "metadata_keys")); - _imp->package_id_checks_group->add_prerequirement("metadata_keys", "eapi_supported"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("short_description_key")) - { - _imp->package_id_checks_group->add_check("short_description_key", - std::tr1::bind(short_description_key_check, _1, _2, _5, "short_description_key")); - _imp->package_id_checks_group->add_prerequirement("short_description_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("homepage_key")) - { - _imp->package_id_checks_group->add_check("homepage_key", - std::tr1::bind(homepage_key_check, _1, _2, _5, "homepage_key")); - _imp->package_id_checks_group->add_prerequirement("homepage_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("iuse_key")) - { - _imp->package_id_checks_group->add_check("iuse_key", - std::tr1::bind(iuse_key_check, _1, _2, _4, _5, "iuse_key")); - _imp->package_id_checks_group->add_prerequirement("iuse_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("keywords_key")) - { - _imp->package_id_checks_group->add_check("keywords_key", - std::tr1::bind(keywords_key_check, _1, _2, _5, "keywords_key")); - _imp->package_id_checks_group->add_prerequirement("keywords_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("license_key")) - { - _imp->package_id_checks_group->add_check("license_key", - std::tr1::bind(license_key_check, _1, _2, _4, _5, "license_key")); - _imp->package_id_checks_group->add_prerequirement("license_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("spec_keys")) - { - _imp->package_id_checks_group->add_check("spec_keys", - std::tr1::bind(spec_keys_check, _1, _2, _5, "spec_keys")); - _imp->package_id_checks_group->add_prerequirement("spec_keys", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("extractors")) - { - _imp->package_id_checks_group->add_check("extractors", - std::tr1::bind(extractors_check, _1, _2, _5, "extractors")); - _imp->package_id_checks_group->add_prerequirement("extractors", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("fetches_key")) - { - _imp->package_id_checks_group->add_check("fetches_key", - std::tr1::bind(fetches_key_check, _1, _2, _5, "fetches_key")); - _imp->package_id_checks_group->add_prerequirement("fetches_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("restrict_key")) - { - _imp->package_id_checks_group->add_check("restrict_key", - std::tr1::bind(restrict_key_check, _1, _2, _5, "restrict_key")); - _imp->package_id_checks_group->add_prerequirement("restrict_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("inherited_key")) - { - _imp->package_id_checks_group->add_check("inherited_key", - std::tr1::bind(inherited_key_check, _1, _2, _5, "inherited_key")); - _imp->package_id_checks_group->add_prerequirement("inherited_key", "metadata_keys"); - } - - if (distribution->qa_package_id_checks()->end() != distribution->qa_package_id_checks()->find("visibility")) - { - _imp->package_id_checks_group->add_check("visibility", - std::tr1::bind(visibility_check, _1, _2, _3, _4, _5, "visibility")); - _imp->package_id_checks_group->add_prerequirement("visibility", "metadata_keys"); - } - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("default_functions")) - _imp->package_id_file_contents_checks_group->add_check("default_functions", - std::tr1::bind(default_functions_check, _1, _2, _5, _6, "default_functions")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("variable_assigns")) - _imp->package_id_file_contents_checks_group->add_check("variable_assigns", - std::tr1::bind(variable_assigns_check, _1, _2, _5, _6, "variable_assigns")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("deprecated_functions")) - _imp->package_id_file_contents_checks_group->add_check("deprecated_functions", - std::tr1::bind(deprecated_functions_check, _1, _2, _5, _6, "deprecated_functions")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("kv_variables")) - _imp->package_id_file_contents_checks_group->add_check("kv_variables", - std::tr1::bind(kv_variables_check, _1, _2, _5, _6, "kv_variables")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("root_variable")) - _imp->package_id_file_contents_checks_group->add_check("root_variable", - std::tr1::bind(root_variable_check, _1, _2, _5, _6, "root_variable")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("subshell_die")) - _imp->package_id_file_contents_checks_group->add_check("subshell_die", - std::tr1::bind(subshell_die_check, _1, _2, _5, _6, "subshell_die")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("function_keyword")) - _imp->package_id_file_contents_checks_group->add_check("function_keyword", - std::tr1::bind(function_keyword_check, _1, _2, _5, _6, "function_keyword")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("whitespace")) - _imp->package_id_file_contents_checks_group->add_check("whitespace", - std::tr1::bind(whitespace_check, _1, _2, _5, _6, "whitespace")); - - if (distribution->qa_package_id_file_contents_checks()->end() != distribution->qa_package_id_file_contents_checks()->find("header")) - _imp->package_id_file_contents_checks_group->add_check("header", - std::tr1::bind(header_check, _1, _2, _5, _6, "header")); -} - -QAChecks::~QAChecks() -{ -} - -const std::tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> > -QAChecks::tree_checks_group() -{ - return _imp->tree_checks_group; -} - -const std::tr1::shared_ptr<QAChecksGroup<EclassFileContentsCheckFunction> > -QAChecks::eclass_file_contents_checks_group() -{ - return _imp->eclass_file_contents_checks_group; -} - -const std::tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> > -QAChecks::category_dir_checks_group() -{ - return _imp->category_dir_checks_group; -} - -const std::tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> > -QAChecks::package_dir_checks_group() -{ - return _imp->package_dir_checks_group; -} - -const std::tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> > -QAChecks::package_id_checks_group() -{ - return _imp->package_id_checks_group; -} - -const std::tr1::shared_ptr<QAChecksGroup<PackageIDFileContentsCheckFunction> > -QAChecks::package_id_file_contents_checks_group() -{ - return _imp->package_id_file_contents_checks_group; -} - diff --git a/paludis/repositories/e/qa/qa_checks.hh b/paludis/repositories/e/qa/qa_checks.hh deleted file mode 100644 index 32cdb54b5..000000000 --- a/paludis/repositories/e/qa/qa_checks.hh +++ /dev/null @@ -1,118 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_QA_CHECKS_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_QA_CHECKS_HH 1 - -#include <paludis/util/attributes.hh> -#include <paludis/util/private_implementation_pattern.hh> -#include <paludis/util/fs_entry-fwd.hh> - -#include <paludis/environment-fwd.hh> -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> - -#include <paludis/repositories/e/qa/qa_checks_group.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/repositories/e/e_repository.hh> - -#include <tr1/functional> -#include <tr1/memory> - -namespace paludis -{ - namespace erepository - { - typedef std::tr1::function<bool ( - const FSEntry &, - QAReporter &, - const Environment * const, - const std::tr1::shared_ptr<const ERepository> & - )> TreeCheckFunction; - - typedef std::tr1::function<bool ( - const FSEntry &, - QAReporter &, - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const std::string & - )> EclassFileContentsCheckFunction; - - typedef std::tr1::function<bool ( - const FSEntry &, - QAReporter &, - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const CategoryNamePart & - )> CategoryDirCheckFunction; - - typedef std::tr1::function<bool ( - const FSEntry &, - QAReporter &, - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const QualifiedPackageName & - )> PackageDirCheckFunction; - - typedef std::tr1::function<bool ( - const FSEntry &, - QAReporter &, - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const std::tr1::shared_ptr<const ERepositoryID> & - )> PackageIDCheckFunction; - - typedef std::tr1::function<bool ( - const FSEntry &, - QAReporter &, - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string & - )> PackageIDFileContentsCheckFunction; - - class QAChecks : - private PrivateImplementationPattern<QAChecks> - { - public: - QAChecks(const Environment * const); - ~QAChecks(); - - const std::tr1::shared_ptr<QAChecksGroup<TreeCheckFunction> > - tree_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result)); - - const std::tr1::shared_ptr<QAChecksGroup<EclassFileContentsCheckFunction> > - eclass_file_contents_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result)); - - const std::tr1::shared_ptr<QAChecksGroup<CategoryDirCheckFunction> > - category_dir_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result)); - - const std::tr1::shared_ptr<QAChecksGroup<PackageDirCheckFunction> > - package_dir_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result)); - - const std::tr1::shared_ptr<QAChecksGroup<PackageIDCheckFunction> > - package_id_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result)); - - const std::tr1::shared_ptr<QAChecksGroup<PackageIDFileContentsCheckFunction> > - package_id_file_contents_checks_group() PALUDIS_ATTRIBUTE((warn_unused_result)); - }; - } -} - -#endif diff --git a/paludis/repositories/e/qa/qa_checks_group.cc b/paludis/repositories/e/qa/qa_checks_group.cc deleted file mode 100644 index f0180a566..000000000 --- a/paludis/repositories/e/qa/qa_checks_group.cc +++ /dev/null @@ -1,132 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/qa_checks_group.hh> -#include <paludis/repositories/e/qa/qa_checks.hh> -#include <paludis/util/private_implementation_pattern-impl.hh> -#include <paludis/util/graph.hh> -#include <paludis/util/graph-impl.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/mutex.hh> -#include <paludis/util/wrapped_forward_iterator-impl.hh> -#include <paludis/util/hashes.hh> -#include <tr1/functional> -#include <tr1/unordered_map> -#include <algorithm> -#include <list> - -using namespace paludis; -using namespace paludis::erepository; - -namespace paludis -{ -#ifndef PALUDIS_NO_DOUBLE_TEMPLATE - template <> -#endif - template <typename T_> - struct Implementation<QAChecksGroup<T_> > - { - mutable Mutex mutex; - DirectedGraph<std::string, int> deps; - mutable std::tr1::unordered_map<std::string, T_, Hash<std::string> > unordered; - mutable std::tr1::shared_ptr<std::list<T_> > ordered; - }; -} - -template <typename T_> -QAChecksGroup<T_>::QAChecksGroup() : - PrivateImplementationPattern<QAChecksGroup>(new Implementation<QAChecksGroup>) -{ -} - -template <typename T_> -QAChecksGroup<T_>::~QAChecksGroup() -{ -} - - -template <typename T_> -typename QAChecksGroup<T_>::ConstIterator -QAChecksGroup<T_>::begin() const -{ - need_ordering(); - return ConstIterator(_imp->ordered->begin()); -} - -template <typename T_> -typename QAChecksGroup<T_>::ConstIterator -QAChecksGroup<T_>::end() const -{ - need_ordering(); - return ConstIterator(_imp->ordered->end()); -} - -template <typename T_> -void -QAChecksGroup<T_>::add_check(const std::string & s, const T_ & f) -{ - Lock l(_imp->mutex); - - _imp->deps.add_node(s); - _imp->ordered.reset(); - _imp->unordered.insert(std::make_pair(s, f)); -} - -template <typename T_> -void -QAChecksGroup<T_>::add_prerequirement(const std::string & f, const std::string & t) -{ - Lock l(_imp->mutex); - - _imp->deps.add_edge(f, t, 0); - _imp->ordered.reset(); -} - -template <typename T_> -void -QAChecksGroup<T_>::need_ordering() const -{ - Lock l(_imp->mutex); - - using namespace std::tr1::placeholders; - - if (_imp->ordered) - return; - - std::list<std::string> o; - _imp->deps.topological_sort(std::back_inserter(o)); - _imp->ordered.reset(new std::list<T_>); - std::transform(o.begin(), o.end(), std::back_inserter(*_imp->ordered), - std::tr1::bind(std::tr1::mem_fn(&std::tr1::unordered_map<std::string, T_, Hash<std::string> >::operator []), &_imp->unordered, _1)); -} - -template class QAChecksGroup<TreeCheckFunction>; -template class QAChecksGroup<EclassFileContentsCheckFunction>; -template class QAChecksGroup<CategoryDirCheckFunction>; -template class QAChecksGroup<PackageDirCheckFunction>; -template class QAChecksGroup<PackageIDCheckFunction>; -template class QAChecksGroup<PackageIDFileContentsCheckFunction>; - -template class WrappedForwardIterator<QAChecksGroup<TreeCheckFunction>::ConstIteratorTag, TreeCheckFunction>; -template class WrappedForwardIterator<QAChecksGroup<EclassFileContentsCheckFunction>::ConstIteratorTag, EclassFileContentsCheckFunction>; -template class WrappedForwardIterator<QAChecksGroup<CategoryDirCheckFunction>::ConstIteratorTag, CategoryDirCheckFunction>; -template class WrappedForwardIterator<QAChecksGroup<PackageDirCheckFunction>::ConstIteratorTag, PackageDirCheckFunction>; -template class WrappedForwardIterator<QAChecksGroup<PackageIDCheckFunction>::ConstIteratorTag, PackageIDCheckFunction>; -template class WrappedForwardIterator<QAChecksGroup<PackageIDFileContentsCheckFunction>::ConstIteratorTag, PackageIDFileContentsCheckFunction>; - diff --git a/paludis/repositories/e/qa/qa_checks_group.hh b/paludis/repositories/e/qa/qa_checks_group.hh deleted file mode 100644 index 6a42aec0f..000000000 --- a/paludis/repositories/e/qa/qa_checks_group.hh +++ /dev/null @@ -1,56 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_QA_CHECKS_GROUP_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_QA_CHECKS_GROUP_HH 1 - -#include <paludis/util/attributes.hh> -#include <paludis/util/private_implementation_pattern.hh> -#include <paludis/util/wrapped_forward_iterator-fwd.hh> -#include <string> - -namespace paludis -{ - namespace erepository - { - template <typename T_> - class QAChecksGroup : - private PrivateImplementationPattern<QAChecksGroup<T_> >, - public InstantiationPolicy<QAChecksGroup<T_>, instantiation_method::NonCopyableTag> - { - private: - using PrivateImplementationPattern<QAChecksGroup<T_> >::_imp; - void need_ordering() const; - - public: - QAChecksGroup(); - ~QAChecksGroup(); - - struct ConstIteratorTag; - typedef WrappedForwardIterator<ConstIteratorTag, T_> ConstIterator; - ConstIterator begin() const PALUDIS_ATTRIBUTE((warn_unused_result)); - ConstIterator end() const PALUDIS_ATTRIBUTE((warn_unused_result)); - - void add_check(const std::string &, const T_ &); - void add_prerequirement(const std::string &, const std::string &); - }; - } -} - -#endif diff --git a/paludis/repositories/e/qa/qa_controller.cc b/paludis/repositories/e/qa/qa_controller.cc deleted file mode 100644 index eb208b8e4..000000000 --- a/paludis/repositories/e/qa/qa_controller.cc +++ /dev/null @@ -1,474 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/qa_controller.hh> -#include <paludis/repositories/e/qa/qa_checks.hh> -#include <paludis/repositories/e/e_repository.hh> -#include <paludis/util/private_implementation_pattern-impl.hh> -#include <paludis/util/set.hh> -#include <paludis/util/log.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/mutex.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/options.hh> -#include <paludis/util/thread_pool.hh> -#include <paludis/util/action_queue.hh> -#include <paludis/util/dir_iterator.hh> -#include <paludis/util/is_file_with_extension.hh> -#include <paludis/util/safe_ifstream.hh> -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <tr1/functional> -#include <unistd.h> -#include <algorithm> -#include <list> -#include <set> -#include <map> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct ThreadSafeQAReporter : - QAReporter - { - QAReporter & base; - Mutex mutex, flush_mutex; - ActionQueue message_queue; - - std::multimap<const FSEntry, const QAMessage> message_buf; - typedef std::multimap<const FSEntry, const QAMessage>::iterator MessageIterator; - - ThreadSafeQAReporter(QAReporter & b) : - base(b), - message_queue(1, false, false) - { - } - - ~ThreadSafeQAReporter() - { - if (! std::uncaught_exception()) - { - using namespace std::tr1::placeholders; - std::for_each(message_buf.begin(), message_buf.end(), - std::tr1::bind(&QAReporter::message, std::tr1::ref(base), - std::tr1::bind<const QAMessage>(&std::pair<const FSEntry, const QAMessage>::second, _1))); - } - } - - void flush(const FSEntry & f) - { - Lock lock(mutex); - std::string root(stringify(f)); - - for (MessageIterator i(message_buf.lower_bound(f)), i_end(message_buf.end()) ; i != i_end ; ) - { - if (0 != stringify(i->first).compare(0, root.length(), root)) - break; - - message_queue.enqueue(std::tr1::bind(&QAReporter::message, &base, QAMessage(i->second))); - message_buf.erase(i++); - } - } - - void message(const QAMessage & msg) - { - Lock lock(mutex); - message_buf.insert(std::make_pair(msg.entry(), msg)); - } - - void status(const std::string & s) - { - message_queue.enqueue(std::tr1::bind(&QAReporter::status, &base, std::string(s))); - } - }; -} - -namespace paludis -{ - template <> - struct Implementation<QAController> - { - const Environment * const env; - const std::tr1::shared_ptr<const ERepository> repo; - const QACheckProperties ignore_if; - const QACheckProperties ignore_unless; - const QAMessageLevel minimum_level; - ThreadSafeQAReporter reporter; - const FSEntry base_dir; - - QAChecks qa_checks; - - std::set<CategoryNamePart> cats_pool; - std::set<QualifiedPackageName> pkgs_pool; - Mutex pools_mutex; - - Implementation( - const Environment * const e, - const std::tr1::shared_ptr<const ERepository> & r, - const QACheckProperties & i, - const QACheckProperties & u, - const QAMessageLevel m, - QAReporter & q, - const FSEntry & d - ) : - env(e), - repo(r), - ignore_if(i), - ignore_unless(u), - minimum_level(m), - reporter(q), - base_dir(d.realpath()), - qa_checks(e) - { - } - }; -} - -QAController::QAController( - const Environment * const env, - const std::tr1::shared_ptr<const ERepository> & repo, - const QACheckProperties & ignore_if, - const QACheckProperties & ignore_unless, - const QAMessageLevel minimum_level, - QAReporter & reporter, - const FSEntry & base_dir - ) : - PrivateImplementationPattern<QAController>(new Implementation<QAController>( - env, repo, ignore_if, ignore_unless, minimum_level, reporter, base_dir)) -{ -} - -QAController::~QAController() -{ -} - -void -QAController::_worker() -{ - bool done(false); - - while (! done) - { - std::tr1::function<void ()> work_item; - - { - Lock l(_imp->pools_mutex); - if (! _imp->cats_pool.empty()) - { - CategoryNamePart cat(*_imp->cats_pool.begin()); - FSEntry c_dir(_imp->repo->layout()->category_directory(cat)); - _imp->cats_pool.erase(_imp->cats_pool.begin()); - if (_above_base_dir(c_dir) || _under_base_dir(c_dir)) - { - std::tr1::shared_ptr<const QualifiedPackageNameSet> qpns(_imp->repo->package_names(cat)); - std::copy(qpns->begin(), qpns->end(), std::inserter(_imp->pkgs_pool, _imp->pkgs_pool.begin())); - work_item = std::tr1::bind(&QAController::_check_category, this, cat, qpns); - } - } - else if (! _imp->pkgs_pool.empty()) - { - QualifiedPackageName qpn(*_imp->pkgs_pool.begin()); - _imp->pkgs_pool.erase(_imp->pkgs_pool.begin()); - work_item = std::tr1::bind(&QAController::_check_package, this, qpn); - } - else - done = true; - } - - if (work_item) - work_item(); - } -} - -void -QAController::_status_worker() -{ - while (true) - { - { - Lock l(_imp->pools_mutex); - _imp->reporter.status("Pending: " + stringify(_imp->cats_pool.size()) + " full categories, " - + stringify(_imp->pkgs_pool.size()) + " packages in '" + stringify(_imp->repo->name()) + "'"); - - if (_imp->cats_pool.empty() && _imp->pkgs_pool.empty()) - break; - } - - ::sleep(1); - } -} - -void -QAController::_check_eclasses(const FSEntry & dir, const std::string & type) -{ - using namespace std::tr1::placeholders; - - if (! _under_base_dir(dir) || ! dir.exists()) - return; - - try - { - for (DirIterator it(dir), it_end; it_end != it; ++it) - if (is_file_with_extension(*it, type, IsFileWithOptions())) - { - SafeIFStream f(*it); - std::string content((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>()); - - if (! f) - _imp->reporter.message( - QAMessage(*it, qaml_severe, "check_" + type.substr(1), - "Couldn't get file contents for " + type.substr(1) + " '" + stringify(*it) + ")")); - else - std::find_if( - _imp->qa_checks.eclass_file_contents_checks_group()->begin(), - _imp->qa_checks.eclass_file_contents_checks_group()->end(), - std::tr1::bind(std::equal_to<bool>(), false, - std::tr1::bind<bool>(std::tr1::mem_fn(&EclassFileContentsCheckFunction::operator() ), - _1, *it, std::tr1::ref(_imp->reporter), - _imp->env, _imp->repo, content))); - } - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - _imp->reporter.message( - QAMessage(dir, qaml_severe, "check_" + type.substr(1), - "Caught exception '" + e.message() + "' (" + e.what() + ")")); - } - - _imp->reporter.flush(dir); -} - -void -QAController::_check_category(const CategoryNamePart c, const std::tr1::shared_ptr<const QualifiedPackageNameSet> qpns) -{ - using namespace std::tr1::placeholders; - - FSEntry c_dir(_imp->repo->layout()->category_directory(c)); - - if (_under_base_dir(c_dir)) - { - using namespace std::tr1::placeholders; - std::find_if( - _imp->qa_checks.category_dir_checks_group()->begin(), - _imp->qa_checks.category_dir_checks_group()->end(), - std::tr1::bind(std::equal_to<bool>(), false, - std::tr1::bind<bool>(std::tr1::mem_fn(&CategoryDirCheckFunction::operator() ), - _1, _imp->repo->layout()->category_directory(c), std::tr1::ref(_imp->reporter), - _imp->env, _imp->repo, c))); - } - - std::tr1::shared_ptr<const FSEntrySequence> exlibs(_imp->repo->layout()->exlibsdirs_category(c)); - std::for_each(exlibs->begin(), exlibs->end(), std::tr1::bind(&QAController::_check_eclasses, this, _1, ".exlib")); - - bool done(false); - while (! done) - { - std::tr1::function<void ()> work_item; - { - Lock l(_imp->pools_mutex); - for (QualifiedPackageNameSet::ConstIterator q(qpns->begin()), q_end(qpns->end()) ; - q != q_end ; ++q) - { - std::set<QualifiedPackageName>::iterator i(_imp->pkgs_pool.find(*q)); - if (i != _imp->pkgs_pool.end()) - { - _imp->pkgs_pool.erase(i); - work_item = std::tr1::bind(&QAController::_check_package, this, *q); - break; - } - } - } - - if (work_item) - { - work_item(); - } - else - done = true; - } -} - -void -QAController::_check_package(const QualifiedPackageName p) -{ - using namespace std::tr1::placeholders; - - FSEntry p_dir(_imp->repo->layout()->package_directory(p)); - - if (_above_base_dir(p_dir) || _under_base_dir(p_dir)) - { - std::find_if( - _imp->qa_checks.package_dir_checks_group()->begin(), - _imp->qa_checks.package_dir_checks_group()->end(), - std::tr1::bind(std::equal_to<bool>(), false, - std::tr1::bind<bool>(std::tr1::mem_fn(&PackageDirCheckFunction::operator()), - _1, _imp->repo->layout()->package_directory(p), - std::tr1::ref(_imp->reporter), _imp->env, _imp->repo, p))); - - std::tr1::shared_ptr<const PackageIDSequence> ids(_imp->repo->package_ids(p)); - std::for_each(ids->begin(), ids->end(), std::tr1::bind(&QAController::_check_id, this, _1)); - _imp->reporter.flush(p_dir); - } - - std::tr1::shared_ptr<const FSEntrySequence> exlibs(_imp->repo->layout()->exlibsdirs_package(p)); - std::for_each(exlibs->begin(), exlibs->end(), std::tr1::bind(&QAController::_check_eclasses, this, _1, ".exlib")); -} - -void -QAController::_check_id(const std::tr1::shared_ptr<const PackageID> & i) -{ - using namespace std::tr1::placeholders; - - FSEntry p_dir(_imp->repo->layout()->package_directory(i->name())); - - try - { - if (_under_base_dir(p_dir)) - { - std::find_if( - _imp->qa_checks.package_id_checks_group()->begin(), - _imp->qa_checks.package_id_checks_group()->end(), - std::tr1::bind(std::equal_to<bool>(), false, - std::tr1::bind<bool>(std::tr1::mem_fn(&PackageIDCheckFunction::operator() ), - _1, i->fs_location_key()->value(), std::tr1::ref(_imp->reporter), - _imp->env, _imp->repo, std::tr1::static_pointer_cast<const ERepositoryID>(i)))); - - SafeIFStream f(i->fs_location_key()->value()); - std::string content((std::istreambuf_iterator<char>(f)), std::istreambuf_iterator<char>()); - if (! f) - _imp->reporter.message( - QAMessage(i->fs_location_key()->value(), qaml_severe, "check_id", - "Couldn't get file contents for ID '" + stringify(*i) + ")") - .with_associated_id(i) - .with_associated_key(i, i->fs_location_key())); - else - std::find_if( - _imp->qa_checks.package_id_file_contents_checks_group()->begin(), - _imp->qa_checks.package_id_file_contents_checks_group()->end(), - std::tr1::bind(std::equal_to<bool>(), false, - std::tr1::bind<bool>(std::tr1::mem_fn(&PackageIDFileContentsCheckFunction::operator() ), - _1, i->fs_location_key()->value(), std::tr1::ref(_imp->reporter), - _imp->env, _imp->repo, std::tr1::static_pointer_cast<const ERepositoryID>(i), content))); - } - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - _imp->reporter.message( - QAMessage(i->fs_location_key()->value(), qaml_severe, "check_id", - "Caught exception '" + e.message() + "' (" + e.what() + ")") - .with_associated_id(i)); - } -} - -void -QAController::run() -{ - using namespace std::tr1::placeholders; - - try - { - if (_under_base_dir(_imp->repo->params().location())) - if (_imp->qa_checks.tree_checks_group()->end() != - std::find_if( - _imp->qa_checks.tree_checks_group()->begin(), - _imp->qa_checks.tree_checks_group()->end(), - std::tr1::bind(std::equal_to<bool>(), false, - std::tr1::bind<bool>(std::tr1::mem_fn(&TreeCheckFunction::operator() ), - _1, _imp->repo->params().location(), std::tr1::ref(_imp->reporter), - _imp->env, _imp->repo)))) - { - QAMessage(_imp->repo->params().location(), qaml_severe, "tree_checks_group", - "Tree checks failed. Not continuing."); - return; - } - _imp->reporter.flush(_imp->repo->params().location()); - - std::for_each(_imp->repo->params().eclassdirs()->begin(), - _imp->repo->params().eclassdirs()->end(), - std::tr1::bind(&QAController::_check_eclasses, this, _1, ".eclass")); - - std::tr1::shared_ptr<const FSEntrySequence> exlibs(_imp->repo->layout()->exlibsdirs_global()); - std::for_each(exlibs->begin(), exlibs->end(), std::tr1::bind(&QAController::_check_eclasses, this, _1, ".exlib")); - - /* Create our workers and pools. Each worker starts by working on a - * separate category. If there aren't any unclaimed categories, workers - * start taking packages from another worker's category. */ - std::tr1::shared_ptr<const CategoryNamePartSet> cats(_imp->repo->category_names()); - std::copy(cats->begin(), cats->end(), std::inserter(_imp->cats_pool, _imp->cats_pool.begin())); - ThreadPool workers; - for (int x(0) ; x < 5 ; ++x) - workers.create_thread(std::tr1::bind(&QAController::_worker, this)); - workers.create_thread(std::tr1::bind(&QAController::_status_worker, this)); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - _imp->reporter.message( - QAMessage(_imp->repo->params().location(), qaml_severe, "run", - "Caught exception '" + e.message() + "' (" + e.what() + ")")); - } -} - -bool -QAController::_under_base_dir(const FSEntry & d) const -{ - if (! d.exists()) - return false; - - FSEntry dd(d.realpath()), b("/"); - while (dd != b) - { - if (dd == _imp->base_dir) - return true; - dd = dd.dirname(); - } - - return false; -} - -bool -QAController::_above_base_dir(const FSEntry & d) const -{ - if (! d.exists()) - return false; - - FSEntry dd(_imp->base_dir), b("/"); - while (dd != b) - { - if (dd == d) - return true; - dd = dd.dirname(); - } - - return false; -} - diff --git a/paludis/repositories/e/qa/qa_controller.hh b/paludis/repositories/e/qa/qa_controller.hh deleted file mode 100644 index 4c87e9863..000000000 --- a/paludis/repositories/e/qa/qa_controller.hh +++ /dev/null @@ -1,71 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_QA_CONTROLLER_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_QA_CONTROLLER_HH 1 - -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/util/private_implementation_pattern.hh> -#include <paludis/qa-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/name-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <tr1/functional> -#include <tr1/memory> - -namespace paludis -{ - class ERepository; - - namespace erepository - { - class PALUDIS_VISIBLE QAController : - private PrivateImplementationPattern<QAController> - { - private: - void _check_eclasses(const FSEntry &, const std::string &); - void _check_category(const CategoryNamePart, const std::tr1::shared_ptr<const QualifiedPackageNameSet>); - void _check_package(const QualifiedPackageName); - void _check_id(const std::tr1::shared_ptr<const PackageID> &); - - void _worker(); - void _status_worker(); - - bool _under_base_dir(const FSEntry &) const; - bool _above_base_dir(const FSEntry &) const; - - public: - QAController( - const Environment * const, - const std::tr1::shared_ptr<const ERepository> &, - const QACheckProperties & ignore_if, - const QACheckProperties & ignore_unless, - const QAMessageLevel minimum_level, - QAReporter &, - const FSEntry &); - - ~QAController(); - - void run(); - }; - } -} - -#endif diff --git a/paludis/repositories/e/qa/repo_name.cc b/paludis/repositories/e/qa/repo_name.cc deleted file mode 100644 index 85ddf6926..000000000 --- a/paludis/repositories/e/qa/repo_name.cc +++ /dev/null @@ -1,68 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "repo_name.hh" -#include <paludis/util/fs_entry.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/safe_ifstream.hh> -#include <paludis/repository.hh> -#include <paludis/qa.hh> - -using namespace paludis; -using namespace paludis::erepository; - -bool -paludis::erepository::repo_name_check( - QAReporter & reporter, - const FSEntry & dir, - const std::string & name) -{ - if (! (dir / "profiles" / "repo_name").exists()) - reporter.message(QAMessage(dir / "profiles" / "repo_name", qaml_normal, name, "No 'profiles/repo_name' file")); - else - { - SafeIFStream f(dir / "profiles" / "repo_name"); - if (! f) - reporter.message(QAMessage(dir / "profiles" / "repo_name", qaml_normal, name, "repo_name file unreadable")); - else - { - std::string line; - if (! std::getline(f, line)) - reporter.message(QAMessage(dir / "profiles" / "repo_name", qaml_normal, name, "repo_name file empty")); - else - { - try - { - RepositoryName n(line); - } - catch (const RepositoryNameError &) - { - reporter.message(QAMessage(dir / "profiles" / "repo_name", qaml_normal, name, - "repo_name not a valid repository name")); - } - - if (std::getline(f, line)) - reporter.message(QAMessage(dir / "profiles" / "repo_name", qaml_normal, name, "repo_name has trailing content")); - } - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/repo_name.hh b/paludis/repositories/e/qa/repo_name.hh deleted file mode 100644 index 168837dde..000000000 --- a/paludis/repositories/e/qa/repo_name.hh +++ /dev/null @@ -1,38 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_REPO_NAME_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_REPO_NAME_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool repo_name_check( - QAReporter &, - const FSEntry & dir, - const std::string & s - ); - } -} - - -#endif diff --git a/paludis/repositories/e/qa/restrict_key.cc b/paludis/repositories/e/qa/restrict_key.cc deleted file mode 100644 index ef3ed1aed..000000000 --- a/paludis/repositories/e/qa/restrict_key.cc +++ /dev/null @@ -1,135 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "restrict_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/log.hh> -#include <paludis/util/instantiation_policy-impl.hh> -#include <paludis/name.hh> -#include <paludis/dep_spec.hh> -#include <paludis/package_id.hh> -#include <paludis/util/fs_entry.hh> -#include <set> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct AllowedRestricts : - InstantiationPolicy<AllowedRestricts, instantiation_method::SingletonTag> - { - std::set<std::string> allowed_restricts; - - AllowedRestricts() - { - allowed_restricts.insert("fetch"); - allowed_restricts.insert("mirror"); - allowed_restricts.insert("nomirror"); - allowed_restricts.insert("primaryuri"); - allowed_restricts.insert("nostrip"); - allowed_restricts.insert("strip"); - allowed_restricts.insert("sandbox"); - allowed_restricts.insert("sydbox"); - allowed_restricts.insert("userpriv"); - allowed_restricts.insert("test"); - } - }; - - struct RestrictChecker - { - const std::set<std::string> & allowed_restricts; - - const std::tr1::shared_ptr<const MetadataKey> & key; - const FSEntry entry; - QAReporter & reporter; - const std::tr1::shared_ptr<const PackageID> id; - const std::string name; - - RestrictChecker( - const std::tr1::shared_ptr<const MetadataKey> & k, - const FSEntry & f, - QAReporter & r, - const std::tr1::shared_ptr<const PackageID> & i, - const std::string & n) : - allowed_restricts(AllowedRestricts::get_instance()->allowed_restricts), - key(k), - entry(f), - reporter(r), - id(i), - name(n) - { - } - - void visit(const PlainTextSpecTree::NodeType<PlainTextLabelDepSpec>::Type & node) - { - reporter.message(QAMessage(entry, qaml_normal, name, - "Unexpected label '" + stringify(node.spec()->text()) + "' in '" + key->raw_name() + "@") - .with_associated_id(id) - .with_associated_key(id, key)); - } - - void visit(const PlainTextSpecTree::NodeType<PlainTextDepSpec>::Type & node) - { - if (allowed_restricts.end() == allowed_restricts.find(node.spec()->text())) - reporter.message(QAMessage(entry, qaml_normal, name, - "Unrecognised value '" + node.spec()->text() + "' in '" + key->raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - - else if (0 == node.spec()->text().compare(0, 2, "no")) - reporter.message(QAMessage(entry, qaml_minor, name, - "Deprecated value '" + node.spec()->text() + "' in '" + key->raw_name() + "' (use '" + node.spec()->text().substr(2) + "' instead)") - .with_associated_id(id) - .with_associated_key(id, key)); - } - - void visit(const PlainTextSpecTree::NodeType<AllDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const PlainTextSpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; -} - -bool -paludis::erepository::restrict_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using restrict_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.restrict_key_check", ll_debug, lc_context) << "restrict_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (id->restrict_key()) - { - RestrictChecker r(id->restrict_key(), entry, reporter, id, name); - id->restrict_key()->value()->root()->accept(r); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/restrict_key.hh b/paludis/repositories/e/qa/restrict_key.hh deleted file mode 100644 index a583619a8..000000000 --- a/paludis/repositories/e/qa/restrict_key.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_RESTRICT_KEY_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_RESTRICT_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool restrict_key_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/root_variable.cc b/paludis/repositories/e/qa/root_variable.cc deleted file mode 100644 index 9462319ad..000000000 --- a/paludis/repositories/e/qa/root_variable.cc +++ /dev/null @@ -1,97 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "root_variable.hh" -#include <paludis/qa.hh> -#include <paludis/util/log.hh> -#include <paludis/util/strip.hh> -#include <pcrecpp.h> -#include <list> -#include <sstream> - -using namespace paludis; - -namespace -{ - enum State - { - st_default, - st_in_src - }; -} - -bool -paludis::erepository::root_variable_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using root_variable_check on '" + stringify(*id) + "':"); - - pcrecpp::RE r_root("\\$[{]?ROOT[}]?([^=a-zA-Z0-9]|$)"); - pcrecpp::RE r_start("^src_"); - pcrecpp::RE r_end("^}"); - - Log::get_instance()->message("e.qa.root_variable_check", ll_debug, lc_context) << "root_variable '" - << entry << "', '" << *id << "', '" << name << "'"; - - std::stringstream ff(content); - - State state(st_default); - std::string line, func; - unsigned line_number(0); - - while (std::getline(ff, line)) - { - ++line_number; - - switch (state) - { - case st_default: - { - if (r_start.PartialMatch(line)) - { - state = st_in_src; - func = line; - if (std::string::npos != func.find('(')) - func = func.substr(0, func.find('(')); - } - } - continue; - - case st_in_src: - { - if (r_end.PartialMatch(line)) - state = st_default; - else if (r_root.PartialMatch(line)) - reporter.message(QAMessage(entry, qaml_maybe, name, "ROOT abuse in " + func + " on line " - + stringify(line_number) + ": " + strip_leading(line, " \t")) - .with_associated_id(id)); - } - continue; - } - - throw InternalError(PALUDIS_HERE, "bad state"); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/root_variable.hh b/paludis/repositories/e/qa/root_variable.hh deleted file mode 100644 index e8fab251f..000000000 --- a/paludis/repositories/e/qa/root_variable.hh +++ /dev/null @@ -1,42 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_ROOT_VARIABLE_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_ROOT_VARIABLE_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool root_variable_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/short_description_key.cc b/paludis/repositories/e/qa/short_description_key.cc deleted file mode 100644 index f686364bb..000000000 --- a/paludis/repositories/e/qa/short_description_key.cc +++ /dev/null @@ -1,66 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "short_description_key.hh" -#include <paludis/qa.hh> -#include <paludis/metadata_key.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/log.hh> -#include <paludis/name.hh> - -bool -paludis::erepository::short_description_key_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using short_description_key_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.short_description_key_check", ll_debug, lc_context) << "short_description_key_check '" - << entry << "', " << *id << "', " << name << "'"; - - if (! id->short_description_key()) - reporter.message(QAMessage(entry, qaml_normal, name, "No description available") - .with_associated_id(id)); - else if (id->short_description_key()->value() == stringify(id->name())) - reporter.message(QAMessage(entry, qaml_normal, name, "Description is equal to PN") - .with_associated_id(id) - .with_associated_key(id, id->short_description_key())); - else if (std::string::npos != id->short_description_key()->value().find("Based on the") - && std::string::npos != id->short_description_key()->value().find("eclass")) - reporter.message( - QAMessage(entry, qaml_normal, name, "Description is about as useful as a chocolate teapot") - .with_associated_id(id) - .with_associated_key(id, id->short_description_key())); - else if (id->short_description_key()->value().length() < 10) - reporter.message(QAMessage(entry, qaml_normal, name, "Description is suspiciously short") - .with_associated_id(id) - .with_associated_key(id, id->short_description_key())); - else if (id->short_description_key()->value().length() > 300) - reporter.message(QAMessage(entry, qaml_normal, name, "Description written by Duncan?") - .with_associated_id(id) - .with_associated_key(id, id->short_description_key())); - else if (id->short_description_key()->value().length() > 120) - reporter.message(QAMessage(entry, qaml_normal, name, "Description is too long") - .with_associated_id(id) - .with_associated_key(id, id->short_description_key())); - - return true; -} - diff --git a/paludis/repositories/e/qa/short_description_key.hh b/paludis/repositories/e/qa/short_description_key.hh deleted file mode 100644 index a8ce1d421..000000000 --- a/paludis/repositories/e/qa/short_description_key.hh +++ /dev/null @@ -1,39 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_SHORT_DESCRIPTION_KEY_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_SHORT_DESCRIPTION_KEY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool short_description_key_check( - const FSEntry &, - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepositoryID> &, - const std::string & name); - } -} - -#endif diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc deleted file mode 100644 index 805620644..000000000 --- a/paludis/repositories/e/qa/spec_keys.cc +++ /dev/null @@ -1,522 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "spec_keys.hh" -#include <paludis/package_id.hh> -#include <paludis/metadata_key.hh> -#include <paludis/qa.hh> -#include <paludis/dep_spec.hh> -#include <paludis/repository.hh> -#include <paludis/choice.hh> -#include <paludis/util/config_file.hh> -#include <paludis/repositories/e/eapi.hh> -#include <paludis/repositories/e/e_repository_id.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/save.hh> -#include <paludis/util/set.hh> -#include <paludis/util/system.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/iterator_funcs.hh> -#include <paludis/util/mutex.hh> -#include <paludis/util/options.hh> -#include <paludis/util/log.hh> -#include <paludis/util/instantiation_policy-impl.hh> -#include <paludis/util/create_iterator-impl.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/wrapped_output_iterator.hh> -#include <paludis/elike_conditional_dep_spec.hh> -#include <algorithm> -#include <map> -#include <set> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct SpecKeysBlacklist : - InstantiationPolicy<SpecKeysBlacklist, instantiation_method::SingletonTag> - { - Mutex mutex; - std::map<std::string, const std::tr1::shared_ptr<const QualifiedPackageNameSet> > map; - - const std::tr1::shared_ptr<const QualifiedPackageNameSet> blacklist(const std::string & s) - { - Lock lock(mutex); - std::map<std::string, const std::tr1::shared_ptr<const QualifiedPackageNameSet> >::const_iterator i(map.find(s)); - if (map.end() != i) - return i->second; - else - { - Context context("When loading spec_keys PackageDepSpec blacklist '" + s + "':"); - - std::tr1::shared_ptr<QualifiedPackageNameSet> r(new QualifiedPackageNameSet); - FSEntry f(FSEntry(getenv_with_default("PALUDIS_QA_DATA_DIR", - stringify(FSEntry(DATADIR) / "paludis" / "qa"))) - / ("spec_keys_pds_blacklist." + s + ".conf")); - - if (f.exists()) - { - LineConfigFile ff(f, LineConfigFileOptions()); - std::copy(ff.begin(), ff.end(), create_inserter<QualifiedPackageName>(r->inserter())); - } - else - Log::get_instance()->message("e.qa.spec_keys_check.configuration_error", ll_warning, lc_context) - << "Blacklist data file '" << f << "' does not exist"; - - map.insert(std::make_pair(s, r)); - return r; - } - } - }; - - struct Checker - { - const FSEntry entry; - QAReporter & reporter; - const std::tr1::shared_ptr<const PackageID> & id; - const std::tr1::shared_ptr<const MetadataKey> & key; - const std::string name; - const std::tr1::shared_ptr<const QualifiedPackageNameSet> pds_blacklist; - bool forbid_arch_flags, forbid_inverse_arch_flags; - - unsigned level; - bool child_of_any; - std::set<ChoiceNameWithPrefix> uses; - - Checker( - const FSEntry & f, - QAReporter & r, - const std::tr1::shared_ptr<const PackageID> & i, - const std::tr1::shared_ptr<const MetadataKey> & k, - const std::string & n, - const std::tr1::shared_ptr<const QualifiedPackageNameSet> p, - bool a, bool ia) : - entry(f), - reporter(r), - id(i), - key(k), - name(n), - pds_blacklist(p), - forbid_arch_flags(a), - forbid_inverse_arch_flags(ia), - level(0), - child_of_any(false) - { - } - - void visit(const GenericSpecTree::NodeType<PackageDepSpec>::Type & node) - { - if (pds_blacklist && node.spec()->package_ptr()) - { - if (pds_blacklist->end() != pds_blacklist->find(*node.spec()->package_ptr())) - reporter.message(QAMessage(entry, qaml_maybe, name, "Package '" + stringify(*node.spec()) - + "' blacklisted in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const GenericSpecTree::NodeType<BlockDepSpec>::Type & node) - { - if (child_of_any) - reporter.message(QAMessage(entry, qaml_normal, name, "'|| ( )' with block child '" - + stringify(*node.spec()) + "' in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - - void visit(const GenericSpecTree::NodeType<SimpleURIDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<FetchableURIDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<PlainTextDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<PlainTextLabelDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<URILabelsDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<DependenciesLabelsDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<LicenseDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<NamedSetDepSpec>::Type &) - { - } - - void visit(const GenericSpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - if (child_of_any) - reporter.message(QAMessage(entry, qaml_normal, name, - "'|| ( )' with 'use? ( )' child in '" - + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - - if (uses.count(elike_conditional_dep_spec_flag(*node.spec()))) - reporter.message(QAMessage(entry, qaml_normal, name, - "Recursive use of flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + "' in '" - + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - - std::tr1::shared_ptr<const ChoiceValue> value; - std::tr1::shared_ptr<const Choice> choice; - { - ChoiceNameWithPrefix f(elike_conditional_dep_spec_flag(*node.spec())); - for (Choices::ConstIterator c(id->choices_key()->value()->begin()), c_end(id->choices_key()->value()->end()) ; - c != c_end && ! value ; ++c) - for (Choice::ConstIterator i((*c)->begin()), i_end((*c)->end()) ; - i != i_end && ! value ; ++i) - { - if ((*i)->name_with_prefix() == f) - { - value = *i; - choice = *c; - } - } - } - - if (! choice) - { - reporter.message(QAMessage(entry, qaml_normal, name, - "Conditional flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + - "' in '" + stringify(key->raw_name()) + "' does not exist") - .with_associated_id(id) - .with_associated_key(id, key) - ); - } - else if (choice->raw_name() == "ARCH") - { - if (forbid_arch_flags) - reporter.message(QAMessage(entry, qaml_normal, name, - "Arch flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + "' in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - else if (elike_conditional_dep_spec_is_inverse(*node.spec()) && forbid_inverse_arch_flags) - reporter.message(QAMessage(entry, qaml_maybe, name, - "Inverse arch flag '" + stringify(elike_conditional_dep_spec_flag(*node.spec())) + "' in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - - Save<unsigned> save_level(&level, level + 1); - Save<bool> save_child_of_any(&child_of_any, false); - Save<std::set<ChoiceNameWithPrefix> > save_uses(&uses, uses); - uses.insert(elike_conditional_dep_spec_flag(*node.spec())); - if (node.begin() == node.end()) - reporter.message(QAMessage(entry, qaml_normal, name, - "Empty 'use? ( )' in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - else - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<AllDepSpec>::Type & node) - { - Save<unsigned> save_level(&level, level + 1); - Save<bool> save_child_of_any(&child_of_any, false); - if (node.begin() == node.end()) - { - if (level > 1) - reporter.message(QAMessage(entry, qaml_normal, name, - "Empty '( )' in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - else - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const GenericSpecTree::NodeType<AnyDepSpec>::Type & node) - { - Save<unsigned> save_level(&level, level + 1); - Save<bool> save_child_of_any(&child_of_any, true); - if (node.begin() == node.end()) - reporter.message(QAMessage(entry, qaml_normal, name, - "Empty '|| ( )' in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - else if (next(node.begin()) == node.end()) - { - (*node.begin())->accept(*this); - reporter.message(QAMessage(entry, qaml_normal, name, - "'|| ( )' with only one child in '" + stringify(key->raw_name()) + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - else - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; - - struct CheckForwarder - { - const FSEntry entry; - QAReporter & reporter; - std::tr1::shared_ptr<const MetadataKey> key; - const std::tr1::shared_ptr<const PackageID> & id; - const std::string name; - - CheckForwarder( - const FSEntry & f, - QAReporter & r, - const std::tr1::shared_ptr<const PackageID> & i, - const std::string & n) : - entry(f), - reporter(r), - id(i), - name(n) - { - } - - void visit_sptr(const std::tr1::shared_ptr<const MetadataKey> & k) - { - key = k; - k->accept(*this); - } - - void visit(const MetadataValueKey<std::string> &) - { - } - - void visit(const MetadataValueKey<SlotName> &) - { - } - - void visit(const MetadataValueKey<long> &) - { - } - - void visit(const MetadataValueKey<bool> &) - { - } - - void visit(const MetadataTimeKey &) - { - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const Contents> > &) - { - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > &) - { - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > &) - { - } - - void visit(const MetadataCollectionKey<KeywordNameSet> &) - { - } - - void visit(const MetadataCollectionKey<Set<std::string> > &) - { - } - - void visit(const MetadataCollectionKey<Sequence<std::string> > &) - { - } - - void visit(const MetadataCollectionKey<FSEntrySequence> &) - { - } - - void visit(const MetadataCollectionKey<PackageIDSequence> &) - { - } - - void visit(const MetadataValueKey<FSEntry> &) - { - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > &) - { - } - - void visit(const MetadataSectionKey & k) - { - std::for_each(indirect_iterator(k.begin_metadata()), - indirect_iterator(k.end_metadata()), accept_visitor(*this)); - } - - void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) - { - try - { - Context context("When visiting metadata key '" + k.raw_name() + "':"); - Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), false, false); - k.value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) - { - try - { - Context context("When visiting metadata key '" + k.raw_name() + "':"); - Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true); - k.value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) - { - try - { - Context context("When visiting metadata key '" + k.raw_name() + "':"); - Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true); - k.value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) - { - try - { - Context context("When visiting metadata key '" + k.raw_name() + "':"); - Checker c(entry, reporter, id, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), false, true); - k.value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) - { - try - { - Context context("When visiting metadata key '" + k.raw_name() + "':"); - Checker c(entry, reporter, id, key, name, SpecKeysBlacklist::get_instance()->blacklist(k.raw_name()), true, true); - k.value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) - { - try - { - Context context("When visiting metadata key '" + k.raw_name() + "':"); - Checker c(entry, reporter, id, key, name, std::tr1::shared_ptr<const QualifiedPackageNameSet>(), true, true); - k.value()->root()->accept(c); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception & e) - { - reporter.message(QAMessage(entry, qaml_severe, name, "Caught exception '" + stringify(e.message()) + "' (" - + stringify(e.what()) + ") when handling key '" + k.raw_name() + "'") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - }; -} - -bool -paludis::erepository::spec_keys_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using spec_keys_check on ID '" + stringify(*id) + "':"); - Log::get_instance()->message("e.qa.spec_keys_check", ll_debug, lc_context) << "spec_keys_check '" - << entry << "', " << *id << "', " << name << "'"; - - using namespace std::tr1::placeholders; - - CheckForwarder f(entry, reporter, id, name); - std::for_each(id->begin_metadata(), id->end_metadata(), std::tr1::bind(&CheckForwarder::visit_sptr, &f, _1)); - - return true; -} - diff --git a/paludis/repositories/e/qa/spec_keys.hh b/paludis/repositories/e/qa/spec_keys.hh deleted file mode 100644 index 5818edf1c..000000000 --- a/paludis/repositories/e/qa/spec_keys.hh +++ /dev/null @@ -1,40 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_SPEC_KEYS_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_SPEC_KEYS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> - -namespace paludis -{ - namespace erepository - { - bool spec_keys_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/spec_keys_TEST.cc b/paludis/repositories/e/qa/spec_keys_TEST.cc deleted file mode 100644 index 4b908e855..000000000 --- a/paludis/repositories/e/qa/spec_keys_TEST.cc +++ /dev/null @@ -1,238 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/spec_keys.hh> -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <paludis/util/options.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage &) - { - ++count; - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct GoodTest : TestCase - { - GoodTest() : TestCase("good") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("cat/other"); - - TestReporter r; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 0u); - } - } test_good; - - struct EmptyBlockTest : TestCase - { - EmptyBlockTest() : TestCase("empty block") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - - std::tr1::shared_ptr<FakePackageID> id1(repo->add_version("cat", "pkg", "1")); - id1->build_dependencies_key()->set_from_string("( ( ) )"); - TestReporter r1; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r1, id1, "spec keys")); - TEST_CHECK_EQUAL(r1.count, 1u); - - std::tr1::shared_ptr<FakePackageID> id2(repo->add_version("cat", "pkg", "2")); - id2->build_dependencies_key()->set_from_string("|| ( )"); - TestReporter r2; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r2, id2, "spec keys")); - TEST_CHECK_EQUAL(r2.count, 1u); - - std::tr1::shared_ptr<FakePackageID> id3(repo->add_version("cat", "pkg", "3")); - id3->build_dependencies_key()->set_from_string("x? ( )"); - id3->choices_key()->add("", "x"); - TestReporter r3; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r3, id3, "spec keys")); - TEST_CHECK_EQUAL(r3.count, 1u); - - std::tr1::shared_ptr<FakePackageID> id4(repo->add_version("cat", "pkg", "4")); - id4->build_dependencies_key()->set_from_string("x? ( ) ( y? ( || ( ) ) )"); - id4->choices_key()->add("", "x"); - id4->choices_key()->add("", "y"); - TestReporter r4; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r4, id4, "spec keys")); - TEST_CHECK_EQUAL(r4.count, 2u); - } - } test_empty_block; - - struct AnyUseTest : TestCase - { - AnyUseTest() : TestCase("|| ( use? ( ) )") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("|| ( v/w x? ( x/y ) )"); - id->choices_key()->add("", "x"); - - TestReporter r; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_any_use; - - struct AnyOneTest : TestCase - { - AnyOneTest() : TestCase("|| ( one )") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("|| ( x/x )"); - - TestReporter r; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_any_one; - - struct AnyBlockTest : TestCase - { - AnyBlockTest() : TestCase("|| ( !block )") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("|| ( x/x !y/y z/z )"); - - TestReporter r; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_any_block; - - struct DeprecatedTest : TestCase - { - DeprecatedTest() : TestCase("deprecated") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - repo->add_version("virtual", "libc", "1"); - - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("virtual/libc"); - - TestReporter r; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_deprecated; - - struct RecursiveUseTest : TestCase - { - RecursiveUseTest() : TestCase("recursive use") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - - std::tr1::shared_ptr<FakePackageID> id1(repo->add_version("cat", "pkg", "1")); - id1->build_dependencies_key()->set_from_string("x? ( x? ( cat/pkg ) )"); - id1->choices_key()->add("", "x"); - - TestReporter r1; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r1, id1, "spec keys")); - TEST_CHECK_EQUAL(r1.count, 1u); - - std::tr1::shared_ptr<FakePackageID> id2(repo->add_version("cat", "pkg", "2")); - id2->build_dependencies_key()->set_from_string("x? ( !x? ( cat/pkg ) )"); - id2->choices_key()->add("", "x"); - - TestReporter r2; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r2, id2, "spec keys")); - TEST_CHECK_EQUAL(r2.count, 1u); - } - } test_recursive_use; - - struct MissingIUseTest : TestCase - { - MissingIUseTest() : TestCase("missing iuse") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - id->build_dependencies_key()->set_from_string("foo? ( cat/pkg1 )"); - - TestReporter r; - TEST_CHECK(spec_keys_check(FSEntry("/var/empty"), r, id, "spec keys")); - TEST_CHECK_EQUAL(r.count, 1u); - } - } test_missing_iuse; -} - diff --git a/paludis/repositories/e/qa/spec_keys_pds_blacklist.DEPEND.conf b/paludis/repositories/e/qa/spec_keys_pds_blacklist.DEPEND.conf deleted file mode 100644 index cb217d85b..000000000 --- a/paludis/repositories/e/qa/spec_keys_pds_blacklist.DEPEND.conf +++ /dev/null @@ -1,2 +0,0 @@ -sys-apps/portage -virtual/libc diff --git a/paludis/repositories/e/qa/spec_keys_pds_blacklist.PDEPEND.conf b/paludis/repositories/e/qa/spec_keys_pds_blacklist.PDEPEND.conf deleted file mode 100644 index e69de29bb..000000000 --- a/paludis/repositories/e/qa/spec_keys_pds_blacklist.PDEPEND.conf +++ /dev/null diff --git a/paludis/repositories/e/qa/spec_keys_pds_blacklist.PROVIDE.conf b/paludis/repositories/e/qa/spec_keys_pds_blacklist.PROVIDE.conf deleted file mode 100644 index a9715b82b..000000000 --- a/paludis/repositories/e/qa/spec_keys_pds_blacklist.PROVIDE.conf +++ /dev/null @@ -1 +0,0 @@ -virtual/libc diff --git a/paludis/repositories/e/qa/spec_keys_pds_blacklist.RDEPEND.conf b/paludis/repositories/e/qa/spec_keys_pds_blacklist.RDEPEND.conf deleted file mode 100644 index 6eea4953a..000000000 --- a/paludis/repositories/e/qa/spec_keys_pds_blacklist.RDEPEND.conf +++ /dev/null @@ -1,16 +0,0 @@ -app-arch/cabextract -app-arch/rpm2targz -app-arch/unzip -app-doc/doxygen -dev-util/pkgconfig -dev-util/yacc -media-gfx/ebdftopcf -sys-devel/autoconf -sys-devel/automake -sys-devel/bison -sys-devel/flex -sys-devel/gettext -sys-devel/libtool -sys-devel/patch -x11-apps/bdftopcf -x11-misc/imake diff --git a/paludis/repositories/e/qa/spec_keys_pds_blacklist.SDEPEND.conf b/paludis/repositories/e/qa/spec_keys_pds_blacklist.SDEPEND.conf deleted file mode 100644 index e69de29bb..000000000 --- a/paludis/repositories/e/qa/spec_keys_pds_blacklist.SDEPEND.conf +++ /dev/null diff --git a/paludis/repositories/e/qa/stray_files.cc b/paludis/repositories/e/qa/stray_files.cc deleted file mode 100644 index bff86da20..000000000 --- a/paludis/repositories/e/qa/stray_files.cc +++ /dev/null @@ -1,92 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/stray_files.hh> -#include <paludis/repositories/e/e_repository.hh> -#include <paludis/qa.hh> -#include <paludis/util/fs_entry.hh> -#include <paludis/util/dir_iterator.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/is_file_with_extension.hh> -#include <paludis/util/log.hh> - -using namespace paludis; -using namespace paludis::erepository; - -bool -paludis::erepository::stray_files_check( - QAReporter & reporter, - const std::tr1::shared_ptr<const ERepository> & repo, - const FSEntry & dir, - const std::tr1::function<bool (const std::tr1::shared_ptr<const ERepository> &, const FSEntry &)> & stray, - const std::string & name - ) -{ - Context context("When performing check '" + name + "' using stray_files_check on directory '" + stringify(dir) + "':"); - Log::get_instance()->message("e.qa.stray_files_check", ll_debug, lc_context) << "stray_files_check '" - << repo->name() << "', '" << dir << "', " << name << "'"; - - if (dir.exists()) - for (DirIterator d(dir), d_end ; d != d_end ; ++d) - if (stray(repo, *d)) - reporter.message(QAMessage(*d, qaml_normal, name, "Stray file")); - - return true; -} - -bool -paludis::erepository::is_stray_at_tree_dir( - const std::tr1::shared_ptr<const ERepository> &, - const FSEntry & d) -{ - if (d.is_directory_or_symlink_to_directory()) - return false; - - if (d.is_regular_file_or_symlink_to_regular_file()) - { - if (d.basename() == "header.txt") - return false; - if (is_file_with_prefix_extension(d, "skel.", "", IsFileWithOptions())) - return false; - - return true; - } - - return true; -} - -bool -paludis::erepository::is_stray_at_category_dir( - const std::tr1::shared_ptr<const ERepository> &, - const FSEntry & d) -{ - if (d.is_directory_or_symlink_to_directory()) - return false; - - if (d.is_regular_file_or_symlink_to_regular_file()) - { - if (d.basename() == "metadata.xml") - return false; - - return true; - } - - return true; -} - diff --git a/paludis/repositories/e/qa/stray_files.hh b/paludis/repositories/e/qa/stray_files.hh deleted file mode 100644 index de7c6471e..000000000 --- a/paludis/repositories/e/qa/stray_files.hh +++ /dev/null @@ -1,47 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_STRAY_FILES_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_STRAY_FILES_HH 1 - -#include <paludis/repositories/e/qa/qa_controller.hh> - -namespace paludis -{ - namespace erepository - { - bool stray_files_check( - QAReporter &, - const std::tr1::shared_ptr<const ERepository> &, - const FSEntry & dir, - const std::tr1::function<bool (const std::tr1::shared_ptr<const ERepository> &, const FSEntry &)> &, - const std::string & s - ); - - bool is_stray_at_tree_dir( - const std::tr1::shared_ptr<const ERepository> &, - const FSEntry &); - - bool is_stray_at_category_dir( - const std::tr1::shared_ptr<const ERepository> &, - const FSEntry &); - } -} - -#endif diff --git a/paludis/repositories/e/qa/subshell_die.cc b/paludis/repositories/e/qa/subshell_die.cc deleted file mode 100644 index 36eee0776..000000000 --- a/paludis/repositories/e/qa/subshell_die.cc +++ /dev/null @@ -1,79 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Danny van Dyk - * - * 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/repositories/e/qa/subshell_die.hh> -#include <paludis/qa.hh> -#include <paludis/util/log.hh> -#include <pcrecpp.h> -#include <list> -#include <sstream> - -using namespace paludis; - -namespace -{ - QAMessage - with_id(QAMessage m, const std::tr1::shared_ptr<const PackageID> & id) - { - return id ? m.with_associated_id(id) : m; - } -} - -bool -paludis::erepository::subshell_die_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using subshell_die_check on '" + (id ? stringify(*id) : stringify(entry)) + "':"); - - pcrecpp::RE r_comment("^\\s*#"); - pcrecpp::RE r_subshell_die("\\([^\\)]*\\bdie\\b"); - - if (id) - Log::get_instance()->message("e.qa.subshell_die_check", ll_debug, lc_context) << "subshell_die '" - << entry << "', '" << *id << "', '" << name << "'"; - else - Log::get_instance()->message("e.qa.subshell_die_check", ll_debug, lc_context) << "subshell_die '" - << entry << "', '" << name << "'"; - - std::stringstream ff(content); - - std::string s; - unsigned line(0); - while (std::getline(ff, s)) - { - ++line; - - if (s.empty() || r_comment.PartialMatch(s)) - continue; - - if (r_subshell_die.PartialMatch(s)) - { - reporter.message(with_id(QAMessage(entry, qaml_normal, name, "Invalid call of 'die' within subshell on line " - + stringify(line)), id)); - continue; - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/subshell_die.hh b/paludis/repositories/e/qa/subshell_die.hh deleted file mode 100644 index 0aee2e2e4..000000000 --- a/paludis/repositories/e/qa/subshell_die.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_SUBSHELL_DIE_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_SUBSHELL_DIE_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool subshell_die_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &) PALUDIS_VISIBLE; - } -} - - -#endif diff --git a/paludis/repositories/e/qa/subshell_die_TEST.cc b/paludis/repositories/e/qa/subshell_die_TEST.cc deleted file mode 100644 index d8d60c5b7..000000000 --- a/paludis/repositories/e/qa/subshell_die_TEST.cc +++ /dev/null @@ -1,80 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006 Danny van Dyk - * - * 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 "subshell_die.hh" -#include <paludis/repositories/fake/fake_repository.hh> -#include <paludis/repositories/fake/fake_package_id.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/package_database.hh> -#include <paludis/qa.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage &) - { - ++count; - } - - void status(const std::string &) - { - } - }; -} - -namespace test_cases -{ - struct SubshellDieCheckTest : TestCase - { - SubshellDieCheckTest() : TestCase("subshell_die") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<FakeRepository> repo(new FakeRepository(&env, RepositoryName("repo"))); - env.package_database()->add_repository(1, repo); - std::tr1::shared_ptr<FakePackageID> id(repo->add_version("cat", "pkg", "1")); - - TestReporter r1; - TEST_CHECK(subshell_die_check(FSEntry("/var/empty"), r1, id, "src_unpack() {\n\tunpack \"${A}\"\n\tcd \"${S}\"\n\ttrue && ( epatch \"${FILESDIR}\"/${PN}-cookie.patch || die \"subshelled!\")\n}\n", "subshell_die")); - TEST_CHECK_EQUAL(r1.count, 1u); - - TestReporter r2; - TEST_CHECK(subshell_die_check(FSEntry("/var/empty"), r2, id, "src_unpack() {\n\t:\n}\n", "subshell_die")); - TEST_CHECK_EQUAL(r2.count, 0u); - } - } test_subshell_die; -} - - diff --git a/paludis/repositories/e/qa/variable_assigns.cc b/paludis/repositories/e/qa/variable_assigns.cc deleted file mode 100644 index 387d47baa..000000000 --- a/paludis/repositories/e/qa/variable_assigns.cc +++ /dev/null @@ -1,103 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "variable_assigns.hh" -#include <paludis/qa.hh> -#include <paludis/util/log.hh> -#include <pcrecpp.h> -#include <list> -#include <sstream> -#include <map> - -using namespace paludis; - -namespace -{ - QAMessage - with_id(QAMessage m, const std::tr1::shared_ptr<const PackageID> & id) - { - return id ? m.with_associated_id(id) : m; - } -} - -bool -paludis::erepository::variable_assigns_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using variable_assigns_check on '" + (id ? stringify(*id) : stringify(entry)) + "':"); - - pcrecpp::RE r_comment("^\\s*#"); - pcrecpp::RE r_make_line("^\\s*e?make\\b"); - pcrecpp::RE r_make_continuation_line("\\\\\\s*$"); - pcrecpp::RE r_strip_quotes("(\"(\\\\.|[^\"])+\"|'(\\\\.|[^'])+')"); - - std::map<std::string, pcrecpp::RE> r_vars; - r_vars.insert(std::make_pair("CFLAGS", pcrecpp::RE("\\bCFLAGS="))); - r_vars.insert(std::make_pair("CXXFLAGS", pcrecpp::RE("\\bCXXFLAGS="))); - r_vars.insert(std::make_pair("CPPFLAGS", pcrecpp::RE("\\bCPPFLAGS="))); - r_vars.insert(std::make_pair("LDFLAGS", pcrecpp::RE("\\bLDFLAGS="))); - r_vars.insert(std::make_pair("ASFLAGS", pcrecpp::RE("\\bASFLAGS="))); - - if (id) - Log::get_instance()->message("e.qa.variable_assigns_check", ll_debug, lc_context) << "variable_assigns '" - << entry << "', '" << *id << "', '" << name << "'"; - else - Log::get_instance()->message("e.qa.variable_assigns_check", ll_debug, lc_context) << "variable_assigns '" - << entry << "', '" << name << "'"; - - std::stringstream ff(content); - - std::string s; - unsigned line_number(0); - bool in_make_continuation(false); - while (std::getline(ff, s)) - { - ++line_number; - if (s.empty() || r_comment.PartialMatch(s)) - continue; - - r_strip_quotes.GlobalReplace("", &s); - - if (r_make_line.PartialMatch(s)) - { - if (r_make_continuation_line.PartialMatch(s)) - in_make_continuation = true; - continue; - } - - if (in_make_continuation) - { - in_make_continuation = r_make_continuation_line.PartialMatch(s); - continue; - } - - for (std::map<std::string, pcrecpp::RE>::iterator r(r_vars.begin()), - r_end(r_vars.end()) ; r != r_end ; ++r) - if (r->second.PartialMatch(s)) - reporter.message(with_id(QAMessage(entry, qaml_normal, name, "Attempting to assign to " + - r->first + " on line " + stringify(line_number)), id)); - } - - return true; -} - diff --git a/paludis/repositories/e/qa/variable_assigns.hh b/paludis/repositories/e/qa/variable_assigns.hh deleted file mode 100644 index 1a8a62f8f..000000000 --- a/paludis/repositories/e/qa/variable_assigns.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_VARIABLE_ASSIGNS_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_VARIABLE_ASSIGNS_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool variable_assigns_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &); - } -} - - -#endif diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc deleted file mode 100644 index 2b82d0bdd..000000000 --- a/paludis/repositories/e/qa/visibility.cc +++ /dev/null @@ -1,413 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/visibility.hh> -#include <paludis/repositories/e/dep_spec_pretty_printer.hh> -#include <paludis/util/exception.hh> -#include <paludis/util/stringify.hh> -#include <paludis/util/tokeniser.hh> -#include <paludis/util/log.hh> -#include <paludis/util/set.hh> -#include <paludis/util/create_iterator-impl.hh> -#include <paludis/util/make_shared_ptr.hh> -#include <paludis/qa.hh> -#include <paludis/dep_spec.hh> -#include <paludis/environment.hh> -#include <paludis/package_database.hh> -#include <paludis/package_id.hh> -#include <paludis/version_requirements.hh> -#include <paludis/metadata_key.hh> -#include <paludis/stringify_formatter.hh> -#include <paludis/elike_conditional_dep_spec.hh> -#include <paludis/selection.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/choice.hh> -#include <set> -#include <algorithm> - -using namespace paludis; -using namespace paludis::erepository; - -namespace -{ - struct Checker - { - const FSEntry entry; - QAReporter * const reporter; - const Environment * const env; - const std::tr1::shared_ptr<const PackageID> & id; - const std::tr1::shared_ptr<const ERepository> repo; - const std::set<KeywordName> & accepted_keywords; - const ERepository::ProfilesConstIterator profile; - const std::string name; - const bool unstable; - const std::tr1::shared_ptr<const MetadataKey> & key; - - bool success; - bool viable; - - Checker( - const FSEntry & e, - QAReporter * const r, - const Environment * const v, - const std::tr1::shared_ptr<const PackageID> & i, - const std::tr1::shared_ptr<const ERepository> o, - const std::set<KeywordName> & a, - const ERepository::ProfilesConstIterator & p, - const std::string & n, - const bool u, - const std::tr1::shared_ptr<const MetadataKey> & k) : - entry(e), - reporter(r), - env(v), - id(i), - repo(o), - accepted_keywords(a), - profile(p), - name(n), - unstable(u), - key(k), - success(true), - viable(false) - { - } - - void visit(const DependencySpecTree::NodeType<BlockDepSpec>::Type &) - { - viable = true; - } - - void visit(const DependencySpecTree::NodeType<DependenciesLabelsDepSpec>::Type &) - { - } - - void visit(const DependencySpecTree::NodeType<NamedSetDepSpec>::Type &) - { - } - - void visit(const DependencySpecTree::NodeType<PackageDepSpec>::Type & node) - { - using namespace std::tr1::placeholders; - - success = false; - viable = true; - - const PackageDepSpec * p(node.spec().get()); - std::tr1::shared_ptr<PackageDepSpec> local_p; - - /* rewrite virtuals to avoid problems later on */ - if (p->package_ptr()) - { - ERepositoryProfile::VirtualsConstIterator v((*profile).profile()->fetch()->find_virtual(*p->package_ptr())); - if ((*profile).profile()->fetch()->end_virtuals() != v) - { - PartiallyMadePackageDepSpec pp((PartiallyMadePackageDepSpecOptions())); - - if (v->second->version_requirements_ptr()) - std::for_each(v->second->version_requirements_ptr()->begin(), v->second->version_requirements_ptr()->end(), - std::tr1::bind(&PartiallyMadePackageDepSpec::version_requirement, &pp, _1)); - if (node.spec()->version_requirements_ptr()) - std::for_each(node.spec()->version_requirements_ptr()->begin(), node.spec()->version_requirements_ptr()->end(), - std::tr1::bind(&PartiallyMadePackageDepSpec::version_requirement, &pp, _1)); - - pp.package(*v->second->package_ptr()); - if (node.spec()->slot_requirement_ptr()) - pp.slot_requirement(node.spec()->slot_requirement_ptr()); - if (node.spec()->in_repository_ptr()) - pp.in_repository(*node.spec()->in_repository_ptr()); - - local_p.reset(new PackageDepSpec(pp)); - local_p->set_tag(node.spec()->tag()); - p = local_p.get(); - } - } - - const std::tr1::shared_ptr<const PackageIDSequence> matches((*env)[selection::AllVersionsSorted( - generator::Matches(*p, MatchPackageOptions() + mpo_ignore_additional_requirements) - | filter::SupportsAction<InstallAction>())]); - if (matches->empty()) - { - if (reporter) - reporter->message(QAMessage(entry, qaml_normal, name, "No packages matching '" - + stringify(*node.spec()) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '" - + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." - + stringify((*profile).status()) - + (unstable ? ".unstable" : ".stable") + ")") - .with_associated_id(id) - .with_associated_key(id, key)); - } - else - { - for (PackageIDSequence::ConstIterator i(matches->begin()), i_end(matches->end()) ; - i != i_end ; ++i) - { - /* can't use the usual masked rules here, so this gets a bit complicated... */ - if ((*i)->repository() == repo) - { - if (repo->repository_masked(**i) || (*profile).profile()->fetch()->profile_masked(**i) || ! (*i)->keywords_key()) - continue; - } - else - { - bool found_repo(false), repo_masked(false); - if (repo->params().master_repositories()) - { - for (ERepositorySequence::ConstIterator e(repo->params().master_repositories()->begin()), - e_end(repo->params().master_repositories()->end()) ; e != e_end ; ++e) - { - if ((*i)->repository()->name() == (*e)->name()) - { - if ((*e)->repository_masked(**i)) - repo_masked = true; - found_repo = true; - break; - } - } - } - - if (repo_masked) - continue; - - if (! found_repo) - { - Log::get_instance()->message("e.qa.visibility_check.no_masks", ll_warning, lc_context) - << "Probably a bug: don't know how to get masks for '" - << **i << "' from '" << *node.spec() << "' -> '" << *p << "'"; - continue; - } - } - - std::set<KeywordName> overlap; - if ((*i)->keywords_key()) - std::set_intersection(accepted_keywords.begin(), accepted_keywords.end(), - (*i)->keywords_key()->value()->begin(), (*i)->keywords_key()->value()->end(), - std::inserter(overlap, overlap.begin())); - - if (overlap.empty()) - continue; - - success = true; - break; - } - - if (! success) - if (reporter) - reporter->message(QAMessage(entry, qaml_normal, name, "No visible packages matching '" - + stringify(*node.spec()) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '" - + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status()) - + (unstable ? ".unstable" : ".stable") + ")") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - - void visit(const DependencySpecTree::NodeType<ConditionalDepSpec>::Type & node) - { - ChoiceNameWithPrefix prefixed(elike_conditional_dep_spec_flag(*node.spec())); - UnprefixedChoiceName value("x"); - std::tr1::shared_ptr<const Choice> choice; - if (id->choices_key()) - for (Choices::ConstIterator c(id->choices_key()->value()->begin()), - c_end(id->choices_key()->value()->end()) ; - c != c_end ; ++c) - { - if (0 != prefixed.data().compare(0, (*c)->prefix().data().length(), (*c)->prefix().data(), - 0, (*c)->prefix().data().length())) - continue; - - for (Choice::ConstIterator d((*c)->begin()), d_end((*c)->end()) ; - d != d_end ; ++d) - if ((*d)->name_with_prefix() == prefixed) - { - choice = *c; - value = (*d)->unprefixed_name(); - break; - } - - if (choice) - break; - } - - if (! choice) - { - viable = false; - if (reporter) - reporter->message(QAMessage(entry, qaml_normal, name, "No flag matching '" - + stringify(prefixed) + "' in dependencies key '" + stringify(key->raw_name()) + "' for profile '" - + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status()) - + (unstable ? ".unstable" : ".stable") + ")") - .with_associated_id(id) - .with_associated_key(id, key)); - } - else - viable = - ((! elike_conditional_dep_spec_is_inverse(*node.spec())) && (! (*profile).profile()->fetch()->use_masked( - id, choice, value, prefixed))) || - ((elike_conditional_dep_spec_is_inverse(*node.spec())) && (! (*profile).profile()->fetch()->use_forced( - id, choice, value, prefixed))); - - if (viable) - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - - void visit(const DependencySpecTree::NodeType<AnyDepSpec>::Type & node) - { - success = true; - viable = true; - for (DependencySpecTree::NodeType<AnyDepSpec>::Type::ConstIterator cur(node.begin()), cur_end(node.end()) ; - cur != cur_end ; ++cur) - { - Checker c(entry, 0, env, id, repo, accepted_keywords, profile, name, unstable, key); - accept_visitor(c)(**cur); - if (c.success) - { - success = true; - break; - } - else if (c.viable) - success = false; - } - - if (! success) - { - if (reporter) - { - StringifyFormatter ff; - DepSpecPrettyPrinter printer(0, std::tr1::shared_ptr<const PackageID>(), ff, 0, false, false); - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(printer)); - reporter->message(QAMessage(entry, qaml_normal, name, "No item in block '|| ( " - + stringify(printer) + " )' visible for profile '" - + stringify((*profile).path()) + "' (" + stringify((*profile).arch()) + "." + stringify((*profile).status()) - + (unstable ? ".unstable" : ".stable") + ")") - .with_associated_id(id) - .with_associated_key(id, key)); - } - } - } - - void visit(const DependencySpecTree::NodeType<AllDepSpec>::Type & node) - { - viable = true; - std::for_each(indirect_iterator(node.begin()), indirect_iterator(node.end()), accept_visitor(*this)); - } - }; -} - -bool -paludis::erepository::visibility_check( - const FSEntry & entry, - QAReporter & reporter, - const Environment * const env, - const std::tr1::shared_ptr<const ERepository> & repo, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & name) -{ - Context context("When performing check '" + name + "' using visibility_check on ID '" + stringify(*id) + "':"); - - Log::get_instance()->message("e.qa.visibility_check", ll_debug, lc_context) << "visibility_check '" - << entry << "', '" << *id << "', '" << name << "'"; - - if (repo->repository_masked(*id) || ! id->keywords_key()) - return true; - - for (ERepository::ProfilesConstIterator p(repo->begin_profiles()), p_end(repo->end_profiles()) ; - p != p_end ; ++p) - { - if ((*p).profile()->fetch()->profile_masked(*id)) - continue; - - std::set<KeywordName> accepted_keywords, overlap; - tokenise_whitespace((*p).profile()->fetch()->environment_variable( - repo->accept_keywords_variable()), create_inserter<KeywordName>(std::inserter(accepted_keywords, accepted_keywords.begin()))); - - std::set_intersection(accepted_keywords.begin(), accepted_keywords.end(), - id->keywords_key()->value()->begin(), id->keywords_key()->value()->end(), - std::inserter(overlap, overlap.begin())); - - if (! overlap.empty()) - { - if (id->build_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->build_dependencies_key()); - id->build_dependencies_key()->value()->root()->accept(c); - } - - if (id->run_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->run_dependencies_key()); - id->run_dependencies_key()->value()->root()->accept(c); - } - - if (id->post_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->post_dependencies_key()); - id->post_dependencies_key()->value()->root()->accept(c); - } - - if (id->suggested_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, false, id->suggested_dependencies_key()); - id->post_dependencies_key()->value()->root()->accept(c); - } - } - else - { - for (std::set<KeywordName>::iterator i(accepted_keywords.begin()), i_end(accepted_keywords.end()) ; - i != i_end ; ++i) - if ('~' != stringify(*i).at(0)) - accepted_keywords.insert(KeywordName("~" + stringify(*i))); - - std::set_intersection(accepted_keywords.begin(), accepted_keywords.end(), - id->keywords_key()->value()->begin(), id->keywords_key()->value()->end(), - std::inserter(overlap, overlap.begin())); - - if (! overlap.empty()) - { - if (id->build_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->build_dependencies_key()); - id->build_dependencies_key()->value()->root()->accept(c); - } - - if (id->run_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->run_dependencies_key()); - id->run_dependencies_key()->value()->root()->accept(c); - } - - if (id->post_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->post_dependencies_key()); - id->post_dependencies_key()->value()->root()->accept(c); - } - - if (id->suggested_dependencies_key()) - { - Checker c(entry, &reporter, env, id, repo, accepted_keywords, p, name, true, id->suggested_dependencies_key()); - id->post_dependencies_key()->value()->root()->accept(c); - } - } - } - } - - return true; -} - diff --git a/paludis/repositories/e/qa/visibility.hh b/paludis/repositories/e/qa/visibility.hh deleted file mode 100644 index 5950454f9..000000000 --- a/paludis/repositories/e/qa/visibility.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_VISIBILITY_HH -#define PALUDIS_GUARD_PALUDIS_PALUDIS_REPOSITORIES_E_QA_VISIBILITY_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool visibility_check( - const FSEntry &, - QAReporter &, - const Environment * const env, - const std::tr1::shared_ptr<const ERepository> &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &) PALUDIS_VISIBLE; - } -} - -#endif diff --git a/paludis/repositories/e/qa/visibility_TEST.cc b/paludis/repositories/e/qa/visibility_TEST.cc deleted file mode 100644 index 3aaac2235..000000000 --- a/paludis/repositories/e/qa/visibility_TEST.cc +++ /dev/null @@ -1,182 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "visibility.hh" -#include <paludis/repositories/e/e_repository.hh> -#include <paludis/environments/test/test_environment.hh> -#include <paludis/util/map.hh> -#include <paludis/util/wrapped_forward_iterator.hh> -#include <paludis/util/sequence.hh> -#include <paludis/util/options.hh> -#include <paludis/qa.hh> -#include <paludis/package_database.hh> -#include <paludis/user_dep_spec.hh> -#include <paludis/generator.hh> -#include <paludis/filter.hh> -#include <paludis/filtered_generator.hh> -#include <paludis/selection.hh> -#include <test/test_framework.hh> -#include <test/test_runner.hh> - -using namespace paludis; -using namespace paludis::erepository; -using namespace test; - -namespace -{ - struct TestReporter : - QAReporter - { - unsigned count; - std::string messages; - - TestReporter() : - count(0) - { - } - - void message(const QAMessage & m) - { - ++count; - if (! messages.empty()) - messages.append(", "); - messages.append(m.message()); - } - - void status(const std::string &) - { - } - }; - - std::string from_keys(const std::tr1::shared_ptr<const Map<std::string, std::string> > & m, - const std::string & k) - { - Map<std::string, std::string>::ConstIterator mm(m->find(k)); - if (m->end() == mm) - return ""; - else - return mm->second; - } -} - -namespace test_cases -{ - struct VisibilityTest : TestCase - { - VisibilityTest() : TestCase("visibility") { } - - void run() - { - TestEnvironment env; - std::tr1::shared_ptr<Map<std::string, std::string> > keys(new Map<std::string, std::string>); - keys->insert("format", "ebuild"); - keys->insert("names_cache", "/var/empty"); - keys->insert("location", stringify(FSEntry::cwd() / "visibility_TEST_dir/repo1")); - keys->insert("profiles", stringify(FSEntry::cwd() / "visibility_TEST_dir/repo1/profiles/test")); - std::tr1::shared_ptr<ERepository> repo(std::tr1::static_pointer_cast<ERepository>(ERepository::repository_factory_create(&env, - std::tr1::bind(from_keys, keys, std::tr1::placeholders::_1)))); - env.package_database()->add_repository(1, repo); - - { - std::tr1::shared_ptr<const PackageID> id1(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/visible-1", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r1; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r1, &env, repo, id1, "visibility")); - TEST_CHECK_EQUAL(r1.count, 0u); - } - - { - std::tr1::shared_ptr<const PackageID> id2(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/visible-2", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r2; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r2, &env, repo, id2, "visibility")); - TEST_CHECK_EQUAL(r2.count, 0u); - } - - { - std::tr1::shared_ptr<const PackageID> id3(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/masked-1", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r3; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r3, &env, repo, id3, "visibility")); - TEST_CHECK_EQUAL(r3.count, 0u); - } - - { - std::tr1::shared_ptr<const PackageID> id4(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/needs-masked-1", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r4; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r4, &env, repo, id4, "visibility")); - TestMessageSuffix s4(r4.messages); - TEST_CHECK_EQUAL(r4.count, 1u); - } - - { - std::tr1::shared_ptr<const PackageID> id5(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/use-masking-1", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r5; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r5, &env, repo, id5, "visibility")); - TestMessageSuffix s5(r5.messages); - TEST_CHECK_EQUAL(r5.count, 1u); - } - - { - std::tr1::shared_ptr<const PackageID> id6(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/use-masking-2", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r6; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r6, &env, repo, id6, "visibility")); - TestMessageSuffix s6(r6.messages); - TEST_CHECK_EQUAL(r6.count, 1u); - } - - { - std::tr1::shared_ptr<const PackageID> id7(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/use-masking-3", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r7; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r7, &env, repo, id7, "visibility")); - TEST_CHECK_EQUAL(r7.count, 0u); - } - - { - std::tr1::shared_ptr<const PackageID> id8(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/use-masking-4", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r8; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r8, &env, repo, id8, "visibility")); - TEST_CHECK_EQUAL(r8.count, 0u); - } - - { - std::tr1::shared_ptr<const PackageID> id9(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/use-masking-5", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r9; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r9, &env, repo, id9, "visibility")); - TEST_CHECK_EQUAL(r9.count, 0u); - } - - { - std::tr1::shared_ptr<const PackageID> id10(*env[selection::RequireExactlyOne(generator::Matches(parse_user_package_dep_spec( - "=cat-one/use-masking-6", &env, UserPackageDepSpecOptions()), MatchPackageOptions()))]->begin()); - TestReporter r10; - TEST_CHECK(visibility_check(FSEntry("/var/empty"), r10, &env, repo, id10, "visibility")); - TEST_CHECK_EQUAL(r10.count, 0u); - } - } - } test_visibility; -} - - diff --git a/paludis/repositories/e/qa/visibility_TEST_cleanup.sh b/paludis/repositories/e/qa/visibility_TEST_cleanup.sh deleted file mode 100755 index 26b426a4a..000000000 --- a/paludis/repositories/e/qa/visibility_TEST_cleanup.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -if [ -d visibility_TEST_dir ] ; then - rm -fr visibility_TEST_dir -else - true -fi - diff --git a/paludis/repositories/e/qa/visibility_TEST_setup.sh b/paludis/repositories/e/qa/visibility_TEST_setup.sh deleted file mode 100755 index bcc9e5544..000000000 --- a/paludis/repositories/e/qa/visibility_TEST_setup.sh +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env bash -# vim: set ft=sh sw=4 sts=4 et : - -mkdir visibility_TEST_dir || exit 1 -cd visibility_TEST_dir || exit 1 - -mkdir -p repo1/{eclass,distfiles,profiles/test{,64},cat-one/{visible,masked,needs-masked,use-masking}} || exit 1 -cd repo1 || exit 1 -echo "repo1" > profiles/repo_name || exit 1 -cat <<END > profiles/arch.list || exit 1 -test -test64 -END -cat <<END > profiles/categories || exit 1 -cat-one -END -cat <<END > profiles/test/make.defaults -ARCH=test -ACCEPT_KEYWORDS=test -END -cat <<END > profiles/test64/make.defaults -ARCH=test64 -ACCEPT_KEYWORDS=test64 -END -echo masked > profiles/test64/use.mask -echo forced > profiles/test64/use.force -cat <<END > profiles/profiles.desc -test test/ stable -test64 test64/ stable -END -cat <<END > cat-one/visible/visible-1.ebuild -DESCRIPTION="visible" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -END -cat <<END > cat-one/visible/visible-2.ebuild -DESCRIPTION="visible" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="~test" -END -cat <<END > cat-one/masked/masked-1.ebuild -DESCRIPTION="masked" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="monkey" -END -cat <<END > cat-one/needs-masked/needs-masked-1.ebuild -DESCRIPTION="needs masked" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="" -LICENSE="GPL-2" -KEYWORDS="test" -DEPEND="cat-one/masked" -RDEPEND="" -END -cat <<END > cat-one/use-masking/use-masking-1.ebuild -DESCRIPTION="use masking" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="foo" -LICENSE="GPL-2" -KEYWORDS="test test64" -DEPEND="foo? ( cat-one/visible )" -RDEPEND="" -END -cat <<END > cat-one/use-masking/use-masking-2.ebuild -DESCRIPTION="use masking" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="foo" -LICENSE="GPL-2" -KEYWORDS="test test64" -DEPEND="!foo? ( cat-one/visible )" -RDEPEND="" -END -cat <<END > cat-one/use-masking/use-masking-3.ebuild -DESCRIPTION="use masking" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="masked" -LICENSE="GPL-2" -KEYWORDS="test test64" -DEPEND="masked? ( cat-one/visible )" -RDEPEND="" -END -cat <<END > cat-one/use-masking/use-masking-4.ebuild -DESCRIPTION="use masking" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="forced" -LICENSE="GPL-2" -KEYWORDS="test test64" -DEPEND="!forced? ( cat-one/visible )" -RDEPEND="" -END -cat <<END > cat-one/use-masking/use-masking-5.ebuild -DESCRIPTION="use masking" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="test" -LICENSE="GPL-2" -KEYWORDS="test test64" -DEPEND="test? ( cat-one/visible )" -RDEPEND="" -END -cat <<END > cat-one/use-masking/use-masking-6.ebuild -DESCRIPTION="use masking" -HOMEPAGE="http://example.com/" -SRC_URI="" -SLOT="0" -IUSE="test64" -LICENSE="GPL-2" -KEYWORDS="test test64" -DEPEND="!test64? ( cat-one/visible )" -RDEPEND="" -END -cd .. - -cd .. - - diff --git a/paludis/repositories/e/qa/whitespace.cc b/paludis/repositories/e/qa/whitespace.cc deleted file mode 100644 index 7825f6311..000000000 --- a/paludis/repositories/e/qa/whitespace.cc +++ /dev/null @@ -1,117 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/repositories/e/qa/whitespace.hh> -#include <paludis/qa.hh> -#include <paludis/util/strip.hh> -#include <paludis/util/log.hh> -#include <list> -#include <sstream> - -using namespace paludis; - -namespace -{ - QAMessage - with_id(QAMessage m, const std::tr1::shared_ptr<const PackageID> & id) - { - return id ? m.with_associated_id(id) : m; - } -} - -bool -paludis::erepository::whitespace_check( - const FSEntry & entry, - QAReporter & reporter, - const std::tr1::shared_ptr<const PackageID> & id, - const std::string & content, - const std::string & name) -{ - Context context("When performing check '" + name + "' using whitespace_check on '" + (id ? stringify(*id) : stringify(entry)) + "':"); - - if (id) - Log::get_instance()->message("e.qa.whitespace_check", ll_debug, lc_context) << "whitespace '" - << entry << "', '" << *id << "', '" << name << "'"; - else - Log::get_instance()->message("e.qa.whitespace_check", ll_debug, lc_context) << "whitespace '" - << entry << "', '" << name << "'"; - - std::stringstream ff(content); - - std::string s; - unsigned line(0), err_count(0); - while (std::getline(ff, s)) - { - ++line; - - if (s.empty()) - continue; - - if (err_count >= 3) - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Skipping further whitespace checks"), id)); - break; - } - - if (' ' == s.at(0)) - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Spaces for indenting on line " - + stringify(line) + ": " + strip_leading(s, " \t")), id)); - ++err_count; - continue; - } - else if ('\t' == s.at(0)) - { - std::string::size_type p(s.find_first_of("\t")); - if (std::string::npos == p) - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Indent followed by no content on line " - + stringify(line) + ": " + strip_leading(s, " \t")), id)); - ++err_count; - continue; - } - else if (' ' == s.at(p)) - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Mixed tabs and spaces for indenting on line " - + stringify(line) + ": " + strip_leading(s, " \t")), id)); - ++err_count; - continue; - } - else if (std::string::npos != s.find(p, '\t')) - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Non-intent tab on line " - + stringify(line) + ": " + strip_leading(s, " \t")), id)); - ++err_count; - continue; - } - } - - if (' ' == s.at(s.length() - 1) || '\t' == s.at(s.length() - 1)) - { - reporter.message(with_id(QAMessage(entry, qaml_minor, name, "Trailing space on line " - + stringify(line) + ": " + strip_leading(s, " \t")), id)); - ++err_count; - continue; - } - } - - return true; -} - - diff --git a/paludis/repositories/e/qa/whitespace.hh b/paludis/repositories/e/qa/whitespace.hh deleted file mode 100644 index ceece860a..000000000 --- a/paludis/repositories/e/qa/whitespace.hh +++ /dev/null @@ -1,44 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007, 2008 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_WHITESPACE_HH -#define PALUDIS_GUARD_PALUDIS_REPOSITORIES_E_QA_WHITESPACE_HH 1 - -#include <paludis/qa-fwd.hh> -#include <paludis/package_id-fwd.hh> -#include <paludis/environment-fwd.hh> -#include <paludis/util/attributes.hh> -#include <paludis/util/fs_entry-fwd.hh> -#include <paludis/repositories/e/e_repository.hh> - -namespace paludis -{ - namespace erepository - { - bool whitespace_check( - const FSEntry &, - QAReporter &, - const std::tr1::shared_ptr<const PackageID> &, - const std::string &, - const std::string &) PALUDIS_VISIBLE; - } -} - - -#endif diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc index a3a1b0d0f..b85c9b4d6 100644 --- a/paludis/repositories/e/vdb_repository.cc +++ b/paludis/repositories/e/vdb_repository.cc @@ -171,7 +171,6 @@ VDBRepository::VDBRepository(const VDBRepositoryParams & p) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(this), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/fake/fake_installed_repository.cc b/paludis/repositories/fake/fake_installed_repository.cc index ad8a90f1a..2350c6bba 100644 --- a/paludis/repositories/fake/fake_installed_repository.cc +++ b/paludis/repositories/fake/fake_installed_repository.cc @@ -66,7 +66,6 @@ FakeInstalledRepository::FakeInstalledRepository(const Environment * const e, co value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(this), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/fake/fake_repository.cc b/paludis/repositories/fake/fake_repository.cc index 4e3849ed1..2d947e890 100644 --- a/paludis/repositories/fake/fake_repository.cc +++ b/paludis/repositories/fake/fake_repository.cc @@ -66,7 +66,6 @@ FakeRepository::FakeRepository(const Environment * const env, const RepositoryNa value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(this), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string( env->distribution())).support_old_style_virtuals() ? this : 0) @@ -86,7 +85,6 @@ FakeRepository::FakeRepository(const FakeRepositoryParams & params) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(this), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>((*DistributionData::get_instance()->distribution_from_string( params.environment()->distribution())).support_old_style_virtuals() ? this : 0) diff --git a/paludis/repositories/gems/gems_repository.cc b/paludis/repositories/gems/gems_repository.cc index 6113f4351..981bab2f1 100644 --- a/paludis/repositories/gems/gems_repository.cc +++ b/paludis/repositories/gems/gems_repository.cc @@ -99,7 +99,6 @@ GemsRepository::GemsRepository(const gems::RepositoryParams & params) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/gems/installed_gems_repository.cc b/paludis/repositories/gems/installed_gems_repository.cc index f86afb0ba..a59081cd9 100644 --- a/paludis/repositories/gems/installed_gems_repository.cc +++ b/paludis/repositories/gems/installed_gems_repository.cc @@ -103,7 +103,6 @@ InstalledGemsRepository::InstalledGemsRepository(const gems::InstalledRepository value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/unavailable/unavailable_repository.cc b/paludis/repositories/unavailable/unavailable_repository.cc index 2a0a3e797..3281f6c5f 100644 --- a/paludis/repositories/unavailable/unavailable_repository.cc +++ b/paludis/repositories/unavailable/unavailable_repository.cc @@ -93,7 +93,6 @@ UnavailableRepository::UnavailableRepository(const UnavailableRepositoryParams & value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(this), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc index 88fa758ce..e6bd61026 100644 --- a/paludis/repositories/unpackaged/installed_repository.cc +++ b/paludis/repositories/unpackaged/installed_repository.cc @@ -98,7 +98,6 @@ InstalledUnpackagedRepository::InstalledUnpackagedRepository( value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/unpackaged/unpackaged_repository.cc b/paludis/repositories/unpackaged/unpackaged_repository.cc index 6557dd70f..30527cb88 100644 --- a/paludis/repositories/unpackaged/unpackaged_repository.cc +++ b/paludis/repositories/unpackaged/unpackaged_repository.cc @@ -103,7 +103,6 @@ UnpackagedRepository::UnpackagedRepository(const RepositoryName & n, value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/unwritten/unwritten_repository.cc b/paludis/repositories/unwritten/unwritten_repository.cc index 3deba9700..6685f6c14 100644 --- a/paludis/repositories/unwritten/unwritten_repository.cc +++ b/paludis/repositories/unwritten/unwritten_repository.cc @@ -93,7 +93,6 @@ UnwrittenRepository::UnwrittenRepository(const UnwrittenRepositoryParams & p) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(this), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/virtuals/installed_virtuals_repository.cc b/paludis/repositories/virtuals/installed_virtuals_repository.cc index f676e6dfc..23f03183e 100644 --- a/paludis/repositories/virtuals/installed_virtuals_repository.cc +++ b/paludis/repositories/virtuals/installed_virtuals_repository.cc @@ -117,7 +117,6 @@ InstalledVirtualsRepository::InstalledVirtualsRepository(const Environment * con value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repositories/virtuals/virtuals_repository.cc b/paludis/repositories/virtuals/virtuals_repository.cc index d4dacd9f9..a2cf45a60 100644 --- a/paludis/repositories/virtuals/virtuals_repository.cc +++ b/paludis/repositories/virtuals/virtuals_repository.cc @@ -129,7 +129,6 @@ VirtualsRepository::VirtualsRepository(const Environment * const env) : value_for<n::manifest_interface>(static_cast<RepositoryManifestInterface *>(0)), value_for<n::mirrors_interface>(static_cast<RepositoryMirrorsInterface *>(0)), value_for<n::provides_interface>(static_cast<RepositoryProvidesInterface *>(0)), - value_for<n::qa_interface>(static_cast<RepositoryQAInterface *>(0)), value_for<n::syncable_interface>(static_cast<RepositorySyncableInterface *>(0)), value_for<n::virtuals_interface>(static_cast<RepositoryVirtualsInterface *>(0)) )), diff --git a/paludis/repository-fwd.hh b/paludis/repository-fwd.hh index 05e027e2a..5509a4189 100644 --- a/paludis/repository-fwd.hh +++ b/paludis/repository-fwd.hh @@ -48,7 +48,6 @@ namespace paludis class RepositoryMakeVirtualsInterface; class RepositoryDestinationInterface; class RepositoryEInterface; - class RepositoryQAInterface; class RepositoryManifestInterface; class RepositoryEInterfaceProfilesDescLine; diff --git a/paludis/repository.cc b/paludis/repository.cc index 82efaa191..6d0d3ed56 100644 --- a/paludis/repository.cc +++ b/paludis/repository.cc @@ -216,10 +216,6 @@ RepositoryMakeVirtualsInterface::~RepositoryMakeVirtualsInterface() { } -RepositoryQAInterface::~RepositoryQAInterface() -{ -} - RepositoryManifestInterface::~RepositoryManifestInterface() { } diff --git a/paludis/repository.hh b/paludis/repository.hh index 55193d134..50a1da871 100644 --- a/paludis/repository.hh +++ b/paludis/repository.hh @@ -26,7 +26,6 @@ #include <paludis/spec_tree-fwd.hh> #include <paludis/name.hh> #include <paludis/package_id-fwd.hh> -#include <paludis/qa-fwd.hh> #include <paludis/util/attributes.hh> #include <paludis/util/exception.hh> #include <paludis/util/fs_entry.hh> @@ -75,7 +74,6 @@ namespace paludis struct provided_by; struct provided_by_spec; struct provides_interface; - struct qa_interface; struct status; struct syncable_interface; struct used_this_for_config_protect; @@ -99,7 +97,6 @@ namespace paludis NamedValue<n::manifest_interface, RepositoryManifestInterface *> manifest_interface; NamedValue<n::mirrors_interface, RepositoryMirrorsInterface *> mirrors_interface; NamedValue<n::provides_interface, RepositoryProvidesInterface *> provides_interface; - NamedValue<n::qa_interface, RepositoryQAInterface *> qa_interface; NamedValue<n::syncable_interface, RepositorySyncableInterface *> syncable_interface; NamedValue<n::virtuals_interface, RepositoryVirtualsInterface *> virtuals_interface; }; @@ -661,35 +658,6 @@ namespace paludis }; /** - * Interface for handling QA tasks. - * - * \see Repository - * \ingroup g_repository - * \nosubgrouping - */ - class PALUDIS_VISIBLE RepositoryQAInterface - { - public: - /** - * Perform QA checks on the repository. - */ - virtual void check_qa( - QAReporter &, - const QACheckProperties &, - const QACheckProperties &, - const QAMessageLevel, - const FSEntry & - ) const = 0; - - ///\name Basic operations - ///\{ - - virtual ~RepositoryQAInterface(); - - ///\} - }; - - /** * Interface for making and verifying Manifest2-style manifests * * \see Repository diff --git a/python/Makefile.am b/python/Makefile.am index 444de40ea..da35e11ab 100644 --- a/python/Makefile.am +++ b/python/Makefile.am @@ -48,9 +48,6 @@ IF_PYTHON_TESTS = \ version_requirements_TEST.py \ version_spec_TEST.py -IF_PYTHON_QA_TESTS = \ - qa_TEST.py - IF_PYTHON_SOURCES = \ paludis_python.hh \ options.hh \ @@ -89,11 +86,7 @@ IF_PYTHON_SOURCES = \ BUILT_SOURCES = \ nice_names-nn.hh nice_names-nn.cc -IF_PYTHON_QA_SOURCES = \ - qa.cc - EXTRA_DIST = $(IF_PYTHON_TESTS) $(IF_PYTHON_SOURCES) \ - $(IF_PYTHON_QA_TESTS) $(IF_PYTHON_QA_SOURCES) \ paludis_python_so.cc \ additional_tests_so.cc \ choices_TEST_setup.sh choices_TEST_cleanup.sh \ @@ -126,7 +119,6 @@ TESTS_ENVIRONMENT = env \ PALUDIS_SUFFIXES_FILE="$(top_srcdir)/paludis/repositories/e/ebuild_entries_suffixes.conf" \ PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_DISTRIBUTION="gentoo" \ - PALUDIS_QA_DATA_DIR="$(top_srcdir)/paludis/repositories/e/qa/" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ PALUDIS_ENVIRONMENT_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/environments`" \ PALUDIS_ENABLE_VIRTUALS_REPOSITORY="$(PALUDIS_ENABLE_VIRTUALS_REPOSITORY_VALUE)" \ @@ -170,18 +162,9 @@ additional_tests_so.o : additional_tests_so.cc $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) -I$(PYTHON_INCLUDE_DIR) -c \ -o $@ $(srcdir)/additional_tests_so.cc ; then ln -fs .libs/addtional_tests_so.o $@ ; else rm -f $@ ; exit 1 ; fi -if ENABLE_QA - -libpaludispython_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_PYTHON_SOURCES) $(IF_PYTHON_QA_SOURCES) -TESTS = $(IF_PYTHON_TESTS) $(IF_PYTHON_QA_TESTS) - -else - libpaludispython_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_PYTHON_SOURCES) TESTS = $(IF_PYTHON_TESTS) -endif - libpaludispython_@PALUDIS_PC_SLOT@_la_LIBADD = \ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la diff --git a/python/paludis_python.hh b/python/paludis_python.hh index 01b53d305..39e1891e0 100644 --- a/python/paludis_python.hh +++ b/python/paludis_python.hh @@ -193,7 +193,6 @@ void expose_metadata_key() PALUDIS_VISIBLE; void expose_name() PALUDIS_VISIBLE; void expose_package_database() PALUDIS_VISIBLE; void expose_package_id() PALUDIS_VISIBLE; -void expose_qa() PALUDIS_VISIBLE; void expose_repository() PALUDIS_VISIBLE; void expose_selection() PALUDIS_VISIBLE; void expose_version_operator() PALUDIS_VISIBLE; diff --git a/python/paludis_python_so.cc b/python/paludis_python_so.cc index 6c8798916..adccaf935 100644 --- a/python/paludis_python_so.cc +++ b/python/paludis_python_so.cc @@ -56,8 +56,5 @@ BOOST_PYTHON_MODULE(paludis) expose_generator(); expose_selection(); expose_choices(); -#ifdef ENABLE_QA - expose_qa(); -#endif } diff --git a/python/qa.cc b/python/qa.cc deleted file mode 100644 index f28645561..000000000 --- a/python/qa.cc +++ /dev/null @@ -1,123 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Piotr JaroszyÅ„ski - * - * 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 <python/paludis_python.hh> -#include <python/exception.hh> -#include <python/options.hh> - -#include <paludis/qa.hh> -#include <paludis/util/fs_entry.hh> - -using namespace paludis; -using namespace paludis::python; -namespace bp = boost::python; - -struct QAReporterWrapper : - QAReporter, - bp::wrapper<QAReporter> -{ - void message(const QAMessage & msg) - { - Lock l(get_mutex()); - - if (bp::override f = get_override("message")) - f(msg); - else - throw PythonMethodNotImplemented("QAReporter", "message"); - } - - void status(const std::string & msg) - { - Lock l(get_mutex()); - - if (bp::override f = get_override("status")) - f(msg); - else - throw PythonMethodNotImplemented("QAReporter", "status"); - } -}; - -void expose_qa() -{ - /** - * Enums - */ - enum_auto("QAMessageLevel", last_qaml, - "The importance of a QA notice."); - enum_auto("QACheckProperty", last_qacp, - "Properties of a QA check."); - - /** - * Options - */ - class_options<QACheckProperties>("QACheckProperties", "QACheckProperty", - "A collection of properties for a QA check."); - - /** - * QAMessage - */ - bp::class_<QAMessage> - ( - "QAMessage", - "NEED_DOC", - bp::init<const FSEntry &, const QAMessageLevel, const std::string &, const std::string &>() - ) - - .add_property("entry", - &named_values_getter<QAMessage, n::entry, FSEntry, &QAMessage::entry>, - &named_values_setter<QAMessage, n::entry, FSEntry, &QAMessage::entry>, - "[rw] FSEntry" - ) - - .add_property("level", - &named_values_getter<QAMessage, n::level, QAMessageLevel, &QAMessage::level>, - "[ro] QAMessageLevel" - ) - - .add_property("name", - &named_values_getter<QAMessage, n::name, std::string, &QAMessage::name>, - "[ro] String" - ) - - .add_property("message", - &named_values_getter<QAMessage, n::message, std::string, &QAMessage::message>, - "[ro] String" - ) - ; - - /** - * QAReporter - */ - bp::class_<QAReporterWrapper, boost::noncopyable> - ( - "QAReporter", - "NEED_DOC", - bp::init<>() - ) - .def("message", bp::pure_virtual(&QAReporter::message), - "message(QAMessage)\n" - "NEED_DOC" - ) - .def("status", bp::pure_virtual(&QAReporter::status), - "status(str)\n" - "NEED_DOC" - ) - ; -} - diff --git a/python/qa_TEST.py b/python/qa_TEST.py deleted file mode 100755 index 07a86f337..000000000 --- a/python/qa_TEST.py +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/env python -# vim: set fileencoding=utf-8 sw=4 sts=4 et : - -# -# Copyright (c) 2007 Piotr JaroszyÅ„ski -# -# 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 -# - -from paludis import * -import unittest - -class TestCase_01_QACheckProperties(unittest.TestCase): - def test_01_create(self): - QACheckProperties() - - def test_02_set(self): - qcp = QACheckProperties() - - self.assert_(qcp.none) - - qcp += QACheckProperty.NEEDS_BUILD - self.assert_(qcp[QACheckProperty.NEEDS_BUILD]) - qcp += QACheckProperty.NEEDS_NETWORK - self.assert_(qcp[QACheckProperty.NEEDS_NETWORK]) - -class TestCase_02_QAMessage(unittest.TestCase): - def test_01_create(self): - qm = QAMessage("entry", QAMessageLevel.DEBUG, "name", "message") - - def test_02_data_members(self): - qm = QAMessage("entry", QAMessageLevel.DEBUG, "name", "message") - - self.assertEquals(qm.entry, "entry") - self.assertEquals(qm.level, QAMessageLevel.DEBUG) - self.assertEquals(qm.name, "name") - self.assertEquals(qm.message, "message") - -class TestCase_03_QAReporter(unittest.TestCase): - import paludis - if hasattr(paludis, "QAReporter"): - class PyQAR(QAReporter): - def __init__(self): - QAReporter.__init__(self) - - def message(self, msg): - return 1 - - def status(self, str): - return 1 - - def test_01_create(self): - QAReporter() - - def test_02_no_message(self): - self.assertRaises(Exception, QAReporter().message, QAMessageLevel.DEBUG, "foo", "foo") - - def test_03_subclass(self): - self.assert_(isinstance(self.PyQAR(), QAReporter)) - - def test_04_subclass_message(self): - self.assertEquals(self.PyQAR().message(QAMessage("foo", QAMessageLevel.DEBUG, "foo", "foo")), 1) - - -if __name__ == "__main__": - unittest.main() diff --git a/python/repository.cc b/python/repository.cc index 67df17d8a..bca8cc646 100644 --- a/python/repository.cc +++ b/python/repository.cc @@ -27,7 +27,6 @@ #include <paludis/action.hh> #include <paludis/package_id.hh> #include <paludis/environment.hh> -#include <paludis/qa.hh> #include <paludis/util/options.hh> #include <paludis/util/wrapped_forward_iterator.hh> @@ -81,12 +80,6 @@ struct RepositoryWrapper : return self.e_interface(); } - static RepositoryQAInterface * - get_qa_interface(const Repository & self) - { - return self.qa_interface(); - } - static PyObject * find_metadata(const Repository & self, const std::string & key) { @@ -246,11 +239,6 @@ void expose_repository() "[ro] RepositoryEInterface" ) - .add_property("qa_interface", bp::make_function(&RepositoryWrapper::get_qa_interface, - bp::return_internal_reference<>()), - "[ro] RepositoryQAInterface" - ) - .def("format_key", &Repository::format_key, "The format_key, if not None, holds our repository's format" ) @@ -382,21 +370,6 @@ void expose_repository() ; /** - * RepositoryQAInterface - */ - bp::class_<RepositoryQAInterface, boost::noncopyable> - ( - "RepositoryQAInterface", - "Interface for handling QA tasks.", - bp::no_init - ) - .def("check_qa", &RepositoryQAInterface::check_qa, - "check_qa(QAReporter, QACheckProperties, QACheckProperties, QAMessageLevel, path)\n" - "NEED_DOC" - ) - ; - - /** * FakeRepository */ bp::implicitly_convertible<std::tr1::shared_ptr<FakeRepository>, std::tr1::shared_ptr<Repository> >(); diff --git a/ruby/Makefile.am b/ruby/Makefile.am index aa9c5f5c2..9be1dc9d2 100644 --- a/ruby/Makefile.am +++ b/ruby/Makefile.am @@ -38,9 +38,6 @@ IF_RUBY_TESTS = \ selection_TEST.rb \ version_spec_TEST.rb -IF_RUBY_QA_TESTS = \ - qa_TEST.rb - IF_RUBY_SOURCES = \ action.cc \ choice.cc \ @@ -70,11 +67,7 @@ IF_RUBY_SOURCES = \ BUILT_SOURCES = \ nice_names-nn.hh nice_names-nn.cc -IF_RUBY_QA_SOURCES = \ - qa.cc - EXTRA_DIST = $(IF_RUBY_TESTS) $(IF_RUBY_SOURCES) \ - $(IF_RUBY_QA_TESTS) $(IF_RUBY_QA_SOURCES) \ paludis_ruby_so.cc \ choice_TEST_setup.sh choice_TEST_cleanup.sh \ dep_spec_TEST_setup.sh dep_spec_TEST_cleanup.sh \ @@ -107,7 +100,6 @@ TESTS_ENVIRONMENT = env \ PALUDIS_EXTRA_EBUILD_MODULES_DIRS="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/util/`" \ PALUDIS_EAPIS_DIR="$(top_srcdir)/paludis/repositories/e/eapis/" \ PALUDIS_SUFFIXES_FILE="$(top_srcdir)/paludis/repositories/e/ebuild_entries_suffixes.conf" \ - PALUDIS_QA_DATA_DIR="$(top_srcdir)/paludis/repositories/e/qa/" \ PALUDIS_DISTRIBUTIONS_DIR="$(top_srcdir)/paludis/distributions/" \ PALUDIS_DISTRIBUTION="gentoo" \ PALUDIS_REPOSITORY_SO_DIR="`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories`" \ @@ -122,7 +114,6 @@ TESTS_ENVIRONMENT = env \ \`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/environments/no_config/.libs\`: \ \`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/environments/test/.libs\`: \ \`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/repositories/e/.libs\`: \ - \`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/paludis/qa/.libs\`: \ \`$(top_srcdir)/paludis/repositories/e/ebuild/utils/canonicalise $(top_builddir)/ruby/.libs\`:$$LD_LIBRARY_PATH" \ | tr -d ' '` \ bash $(top_srcdir)/test/run_test.sh "$(RUBY) -I ./.libs/" @@ -139,18 +130,9 @@ paludis_ruby_so.o : paludis_ruby_so.cc $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(AM_CXXFLAGS) -I$(RUBY_HDRDIR) -I$(RUBY_HDRARCHDIR) -c \ -o $@ $(srcdir)/paludis_ruby_so.cc ; then ln -fs .libs/paludis_ruby_so.o $@ ; else rm -f $@ ; exit 1 ; fi -if ENABLE_QA - -libpaludisruby_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_RUBY_SOURCES) $(IF_RUBY_QA_SOURCES) -TESTS = $(IF_RUBY_TESTS) $(IF_RUBY_QA_TESTS) - -else - libpaludisruby_@PALUDIS_PC_SLOT@_la_SOURCES = $(IF_RUBY_SOURCES) TESTS = $(IF_RUBY_TESTS) -endif - libpaludisruby_@PALUDIS_PC_SLOT@_la_LIBADD = \ $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ diff --git a/ruby/qa.cc b/ruby/qa.cc deleted file mode 100644 index b29a7f29a..000000000 --- a/ruby/qa.cc +++ /dev/null @@ -1,338 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2007 Richard Brown - * - * 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_ruby.hh> -#include <paludis/qa.hh> -#include <paludis/util/options.hh> -#include <ruby.h> - -using namespace paludis; -using namespace paludis::ruby; - -namespace -{ - static VALUE c_qa_message_level; - static VALUE c_qa_check_property; - static VALUE c_qa_check_properties; - static VALUE c_qa_message; - static VALUE c_qa_reporter; - - VALUE - qa_check_properties_init(VALUE self) - { - return self; - } - - VALUE - qa_check_properties_new(VALUE self) - { - QACheckProperties * ptr(0); - try - { - ptr = new QACheckProperties; - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<QACheckProperties>::free, ptr)); - rb_obj_call_init(tdata, 0, &self); - return tdata; - } - catch (const std::exception & e) - { - delete ptr; - exception_to_ruby_exception(e); - } - } - - /* - * call-seq: - * each {|qa_check_property| block } -> Nil - * - * Iterate through the qa check properties. - */ - VALUE - qa_check_properties_each(VALUE self) - { - QACheckProperties * m_ptr; - Data_Get_Struct(self, QACheckProperties, m_ptr); - for (QACheckProperty i(static_cast<QACheckProperty>(0)), i_end(last_qacp) ; i != i_end ; - i = static_cast<QACheckProperty>(static_cast<int>(i) + 1)) - if ((*m_ptr)[i]) - rb_yield(INT2FIX(i)); - return Qnil; - } - - /* - * call-seq: - * empty? -> true or false - * - * Is the collection empty. - */ - VALUE - qa_check_properties_empty(VALUE self) - { - QACheckProperties * m_ptr; - Data_Get_Struct(self, QACheckProperties, m_ptr); - return m_ptr->any() ? Qfalse : Qtrue; - } - - /* - * call-seq: - * set(qa_check_property) -> Nil - * - * Add QACheckProperty to collection. - */ - VALUE - qa_check_properties_set(VALUE self, VALUE qa_check_property) - { - QACheckProperties * m_ptr; - Data_Get_Struct(self, QACheckProperties, m_ptr); - try - { - int mr = NUM2INT(qa_check_property); - if (mr < 0 || mr >= last_qacp) - rb_raise(rb_eArgError, "QACheckProperty out of range"); - *m_ptr += static_cast<QACheckProperty>(mr); - return Qnil; - - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - - /* - * call-seq: - * message(qa_message) - * - * Process a qa error message - */ - VALUE - ruby_qa_reporter_message(VALUE) - { - return Qnil; - } - - VALUE - qa_message_init(int, VALUE *, VALUE self) - { - return self; - } - - /* - * call-seq: - * QAMessage.new(fs_entry_string, qa_message_level, name_string, message_string) -> QAMessage - * - * Creates a new QAMessage. - */ - VALUE - qa_message_new(int argc, VALUE *argv, VALUE self) - { - QAMessage * ptr(0); - try - { - if (4 == argc) - { - int ml = NUM2INT(argv[1]); - if (ml < 0 || ml >= last_qaml) - rb_raise(rb_eArgError, "QAMessageLevel out of range"); - - ptr = new QAMessage(FSEntry(StringValuePtr(argv[0])), static_cast<QAMessageLevel>(ml), - StringValuePtr(argv[2]), StringValuePtr(argv[3])); - } - else - { - rb_raise(rb_eArgError, "QAMessage expects four arguments, but got %d", argc); - } - - VALUE tdata(Data_Wrap_Struct(self, 0, &Common<QAMessage>::free, ptr)); - rb_obj_call_init(tdata, argc, argv); - return tdata; - } - catch (const std::exception & e) - { - delete ptr; - exception_to_ruby_exception(e); - } - } - - - /* - * call-seq: - * level -> QAMessageLevel - * - * Fetch QAMessage level. - */ - VALUE - qa_message_level(VALUE self) - { - QAMessage * m_ptr; - Data_Get_Struct(self, QAMessage, m_ptr); - return INT2FIX(m_ptr->level()); - } - - /* - * call-seq: - * level= - * - * Set QAMessage level. - */ - VALUE - qa_message_level_set(VALUE self, VALUE qa_message_level) - { - QAMessage * m_ptr; - Data_Get_Struct(self, QAMessage, m_ptr); - try - { - int ml = NUM2INT(qa_message_level); - if (ml < 0 || ml >= last_qaml) - rb_raise(rb_eArgError, "QAMessageLevel out of range"); - m_ptr->level() = static_cast<QAMessageLevel>(ml); - return Qnil; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - - template <typename T_, typename M_, M_ T_::*m_> - struct FetchSetString - { - static VALUE - fetch(VALUE self) - { - T_ * p; - Data_Get_Struct(self, T_, p); - return rb_str_new2(stringify((p->*m_)()).c_str()); - } - - static VALUE - set(VALUE self, VALUE str) - { - try - { - T_ * p; - Data_Get_Struct(self, T_, p); - (p->*m_)() = typename M_::ValueType(stringify((StringValuePtr(str)))); - return Qnil; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - }; - - void do_register_qa() - { - /* - * Document-classs: Paludis::QAReporter - * - * Base class for QAReporter, create a new subclass that implements a message function. - */ - c_qa_reporter = rb_define_class_under(paludis_module(), "QAReporter", rb_cObject); - rb_define_method(c_qa_reporter, "message", RUBY_FUNC_CAST(&ruby_qa_reporter_message), 1); - - /* - * Document-class: Paludis::QACheckProperties - * - * A collection of properties for a QACheck. Includes - * Enumerable[http://www.ruby-doc.org/core/classes/Enumerable.html] - * but not Comparable. - */ - c_qa_check_properties = rb_define_class_under(paludis_module(), "QACheckProperties", rb_cObject); - rb_define_singleton_method(c_qa_check_properties, "new", RUBY_FUNC_CAST(&qa_check_properties_new), 0); - rb_define_method(c_qa_check_properties, "initialize", RUBY_FUNC_CAST(&qa_check_properties_init), 0); - rb_define_method(c_qa_check_properties, "each", RUBY_FUNC_CAST(&qa_check_properties_each), 0); - rb_include_module(c_qa_check_properties, rb_mEnumerable); - rb_define_method(c_qa_check_properties, "empty?", RUBY_FUNC_CAST(&qa_check_properties_empty), 0); - rb_define_method(c_qa_check_properties, "set", RUBY_FUNC_CAST(&qa_check_properties_set), 1); - rb_define_method(c_qa_check_properties, "add", RUBY_FUNC_CAST(&qa_check_properties_set), 1); - - /* - * Document-module: Paludis::QAMessageLevel - * - * The importance of a QA notice. - * - */ - c_qa_message_level = rb_define_module_under(paludis_module(), "QAMessageLevel"); - for (QAMessageLevel l(static_cast<QAMessageLevel>(0)), l_end(last_qaml) ; l != l_end ; - l = static_cast<QAMessageLevel>(static_cast<int>(l) + 1)) - rb_define_const(c_qa_message_level, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l)); - - /* - * Document-module: Paludis::QACheckProperty - * - * Properties of a QA check. - * - */ - c_qa_check_property = rb_define_module_under(paludis_module(), "QACheckProperty"); - for (QACheckProperty l(static_cast<QACheckProperty>(0)), l_end(last_qacp) ; l != l_end ; - l = static_cast<QACheckProperty>(static_cast<int>(l) + 1)) - rb_define_const(c_qa_check_property, value_case_to_RubyCase(stringify(l)).c_str(), INT2FIX(l)); - - /* - * Document-class: Paludis::QAMessage - * - * QA message. - * - */ - c_qa_message = rb_define_class_under(paludis_module(), "QAMessage", rb_cObject); - rb_define_singleton_method(c_qa_message, "new", RUBY_FUNC_CAST(&qa_message_new), -1); - rb_define_method(c_qa_message, "initialize", RUBY_FUNC_CAST(&qa_message_init), -1); - rb_define_method(c_qa_message, "entry", - RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::entry, FSEntry>, &QAMessage::entry>::fetch)), 0); - rb_define_method(c_qa_message, "entry=", - RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::entry, FSEntry>, &QAMessage::entry>::set)), 1); - rb_define_method(c_qa_message, "level", RUBY_FUNC_CAST(&qa_message_level), 0); - rb_define_method(c_qa_message, "level=", RUBY_FUNC_CAST(&qa_message_level_set), 1); - rb_define_method(c_qa_message, "name", - RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::name, std::string>, &QAMessage::name>::fetch)), 0); - rb_define_method(c_qa_message, "name=", - RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::name, std::string>, &QAMessage::name>::set)), 1); - rb_define_method(c_qa_message, "message", - RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::message, std::string>, &QAMessage::message>::fetch)), 0); - rb_define_method(c_qa_message, "message=", - RUBY_FUNC_CAST((&FetchSetString<QAMessage, NamedValue<n::message, std::string>, &QAMessage::message>::set)), 1); - } -} - -RegisterRubyClass::Register paludis_ruby_register_qa PALUDIS_ATTRIBUTE((used)) - (&do_register_qa); - -QACheckProperties -paludis::ruby::value_to_qa_check_properties(VALUE v) -{ - if (rb_obj_is_kind_of(v, c_qa_check_properties)) - { - QACheckProperties * v_ptr; - Data_Get_Struct(v, QACheckProperties, v_ptr); - return *v_ptr; - } - else - { - rb_raise(rb_eTypeError, "Can't convert %s into QACheckProperties", rb_obj_classname(v)); - } -} - -VALUE -paludis::ruby::qa_message_to_value(const QAMessage & qamsg) -{ - QAMessage * qamsg2(new QAMessage(qamsg)); - return Data_Wrap_Struct(c_qa_message, 0, &Common<QAMessage>::free, qamsg2); -} diff --git a/ruby/qa_TEST.rb b/ruby/qa_TEST.rb deleted file mode 100644 index b97329ee9..000000000 --- a/ruby/qa_TEST.rb +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env ruby -# vim: set sw=4 sts=4 et tw=80 : - -# -# Copyright (c) 2006 Ciaran McCreesh -# -# This file is part of the Paludis package manager. Paludis is free software; -# you can redistribute it and/or modify it under the terms of the GNU General -# Public License version 2, as published by the Free Software Foundation. -# -# Paludis is distributed in the hope that it will be useful, but WITHOUT ANY -# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more -# details. -# -# You should have received a copy of the GNU General Public License along with -# this program; if not, write to the Free Software Foundation, Inc., 59 Temple -# Place, Suite 330, Boston, MA 02111-1307 USA -# - -require 'test/unit' -require 'Paludis' - -module Paludis - class TestCase_QACheckProperties < Test::Unit::TestCase - def test_create - m = QACheckProperties.new - end - - def test_each - m = QACheckProperties.new - assert_equal [], m.to_a - end - - def test_empty - m = QACheckProperties.new - assert m.empty? - end - - def test_set - m = QACheckProperties.new - m.set QACheckProperty::NeedsBuild - m.set QACheckProperty::NeedsNetwork - :qa - - assert ! m.empty? - - assert m.include?(QACheckProperty::NeedsBuild) - assert m.include?(QACheckProperty::NeedsNetwork) - end - end - - class TestCase_QAReporter < Test::Unit::TestCase - def test_respond - assert_respond_to QAReporter.new, :message - end - end - - class TestCase_QAMessage < Test::Unit::TestCase - def qm - unless @qm - @qm = QAMessage.new('/entry', QAMessageLevel::Debug, 'name', 'message') - end - @qm - end - - def test_create - qm - end - - def test_respond - assert_respond_to qm, :entry - assert_respond_to qm, :entry= - assert_respond_to qm, :level - assert_respond_to qm, :level= - assert_respond_to qm, :name - assert_respond_to qm, :name= - assert_respond_to qm, :message - assert_respond_to qm, :message= - end - - def test_data_members - assert_equal '/entry', qm.entry - qm.entry = '/new_entry' - assert_equal '/new_entry', qm.entry - - assert_equal QAMessageLevel::Debug, qm.level - qm.level = QAMessageLevel::Maybe - assert_equal QAMessageLevel::Maybe, qm.level - - assert_equal 'name', qm.name - qm.name = 'new_name' - assert_equal 'new_name', qm.name - - assert_equal 'message', qm.message - qm.message = 'new_message' - assert_equal 'new_message', qm.message - end - - end -end - diff --git a/ruby/repository.cc b/ruby/repository.cc index dbdc6a8d9..f6433eab5 100644 --- a/ruby/repository.cc +++ b/ruby/repository.cc @@ -366,14 +366,6 @@ namespace * * Returns self if the repository supports the interface, otherwise Nil. */ - /* - * Document-method: qa_interface - * - * call-seq: - * qa_interface -> self or Nil - * - * Returns self if the repository supports the interface, otherwise Nil. - */ template <typename T_, typename R_, NamedValue<T_, R_ *> (RepositoryCapabilities::* f_)> struct Interface { @@ -552,114 +544,6 @@ namespace } }; -#ifdef ENABLE_RUBY_QA - struct HackyReporter : - QAReporter - { - RubyQAReporter * const qar; - std::list<std::tr1::function<void ()> > & pending; - Mutex & mutex; - ConditionVariable & cond; - - void message(const QAMessage & m) - { - Lock lock(mutex); - pending.push_back(std::tr1::bind(&RubyQAReporter::message, qar, m)); - cond.signal(); - } - - void status(const std::string & s) - { - Lock lock(mutex); - pending.push_back(std::tr1::bind(&RubyQAReporter::status, qar, s)); - cond.signal(); - } - - HackyReporter(RubyQAReporter * const q, - std::list<std::tr1::function<void ()> > & p, - Mutex & m, ConditionVariable & c) : - qar(q), - pending(p), - mutex(m), - cond(c) - { - } - }; - - void repository_check_qa_thread(RubyQAReporter * const qar, bool & done, - std::list<std::tr1::function<void ()> > & pending, - Mutex & mutex, ConditionVariable & cond, - const QACheckProperties & ignore_if, - const QACheckProperties & ignore_unless, - const QAMessageLevel minimum_level, - const FSEntry & base_dir, - Repository * repo) - { - HackyReporter tr(qar, pending, mutex, cond); - repo->qa_interface()->check_qa(tr, ignore_if, ignore_unless, minimum_level, base_dir); - Lock lock(mutex); - done = true; - cond.signal(); - } -#endif - - /* - * call-seq: - * check_qa(qa_reporter, qa_check_properties_ignore_if, qa_check_properties_ignore_unless, qa_message_minimum_level, dir) -> Qnil - * - * Check qa in the specified dir. qa_reporter.message (QAReporter) will be called for each error found. - * - */ - VALUE - repository_check_qa(VALUE self, VALUE reporter, VALUE ignore_if, VALUE ignore_unless, VALUE minumum_level, VALUE dir) - { - try - { - std::tr1::shared_ptr<Repository> * self_ptr; - Data_Get_Struct(self, std::tr1::shared_ptr<Repository>, self_ptr); -#ifdef ENABLE_RUBY_QA - if ((**self_ptr).qa_interface()) - { - RubyQAReporter qar(&reporter); - /* have to call ruby code in the original thread. icky. */ - bool done(false); - std::list<std::tr1::function<void ()> > pending; - Mutex mutex; - ConditionVariable cond; - { - Thread t(std::tr1::bind(&repository_check_qa_thread, &qar, std::tr1::ref(done), - std::tr1::ref(pending), std::tr1::ref(mutex), std::tr1::ref(cond), - value_to_qa_check_properties(ignore_if), - value_to_qa_check_properties(ignore_unless), - static_cast<QAMessageLevel>(NUM2INT(minumum_level)), - FSEntry(StringValuePtr(dir)), - self_ptr->get())); - - while (true) - { - Lock lock(mutex); - while (! pending.empty()) - { - (*pending.begin())(); - pending.pop_front(); - } - - if (done) - break; - - cond.wait(mutex); - } - } - } -#endif - return Qnil; - } - catch (const std::exception & e) - { - exception_to_ruby_exception(e); - } - } - /* * call-seq: * add_category(category_name) -> Nil @@ -955,8 +839,6 @@ namespace n::virtuals_interface, RepositoryVirtualsInterface, &Repository::virtuals_interface>::fetch)), 0); rb_define_method(c_repository, "e_interface", RUBY_FUNC_CAST((&Interface< n::e_interface, RepositoryEInterface, &Repository::e_interface>::fetch)), 0); - rb_define_method(c_repository, "qa_interface", RUBY_FUNC_CAST((&Interface< - n::qa_interface, RepositoryQAInterface, &Repository::qa_interface>::fetch)), 0); rb_define_method(c_repository, "some_ids_might_support_action", RUBY_FUNC_CAST(&repository_some_ids_might_support_action), 1); @@ -965,8 +847,6 @@ namespace rb_define_method(c_repository, "profile_variable", RUBY_FUNC_CAST(&repository_profile_variable),1); rb_define_method(c_repository, "set_profile", RUBY_FUNC_CAST(&repository_set_profile),1); - rb_define_method(c_repository, "check_qa", RUBY_FUNC_CAST(&repository_check_qa),5); - rb_define_method(c_repository, "[]", RUBY_FUNC_CAST(&repository_subscript), 1); rb_define_method(c_repository, "each_metadata", RUBY_FUNC_CAST(&repository_each_metadata), 0); rb_define_method(c_repository, "format_key", diff --git a/ruby/repository_TEST.rb b/ruby/repository_TEST.rb index 1ec084f79..066057f00 100644 --- a/ruby/repository_TEST.rb +++ b/ruby/repository_TEST.rb @@ -167,8 +167,7 @@ module Paludis repo = no_config_testrepo.main_repository [:syncable_interface, :mirrors_interface, :environment_variable_interface, - :provides_interface, :virtuals_interface, :e_interface, - :qa_interface].each do |sym| + :provides_interface, :virtuals_interface, :e_interface].each do |sym| assert_respond_to repo, sym end end @@ -190,52 +189,6 @@ module Paludis end end - class TestCase_RepositoryCheckQA < Test::Unit::TestCase - include RepositoryTestCase - - def test_responds - assert_respond_to(no_config_testrepo.main_repository, :check_qa) - end - - if Paludis.const_defined? :QAReporter - class TestQAReporter < QAReporter - @messages - - def message(qa_msg) - @messages+=1 - end - - def messages - @messages||=0 - return @messages - end - end - - def test_check_qa - repo = no_config_testrepo.main_repository - assert_equal repo, repo.qa_interface - dir = Dir.getwd().to_s + "/repository_TEST_dir/testrepo" - assert_nil repo.check_qa(QAReporter.new, QACheckProperties.new, QACheckProperties.new, 0, dir) - end - - def test_message - repo = no_config_testrepo.main_repository - dir = Dir.getwd().to_s + "/repository_TEST_dir/testrepo" - reporter = TestQAReporter.new - assert_equal 0, reporter.messages - assert_nothing_raised do - repo.check_qa(reporter, QACheckProperties.new, QACheckProperties.new, 0, dir) - end - assert reporter.messages > 0 - end - else - def test_check_qa - repo = no_config_testrepo.main_repository - assert_nil repo.qa_interface - end - end - end - class TestCase_RepositoryContents < Test::Unit::TestCase include RepositoryTestCase diff --git a/src/clients/qualudis/Makefile.am b/src/clients/qualudis/Makefile.am deleted file mode 100644 index 1793ddc65..000000000 --- a/src/clients/qualudis/Makefile.am +++ /dev/null @@ -1,70 +0,0 @@ -AM_CXXFLAGS = -I$(top_srcdir) -I$(top_srcdir)/src @PALUDIS_CXXFLAGS@ @PALUDIS_CXXFLAGS_VISIBILITY@ -DEFS= \ - -DSYSCONFDIR=\"$(sysconfdir)\" \ - -DLIBEXECDIR=\"$(libexecdir)\" \ - -DBIGTEMPDIR=\"/var/tmp\" -SUBDIRS = . - -man_pages = qualudis.1 - -if ENABLE_QA - -bin_PROGRAMS = qualudis -noinst_PROGRAMS = man-qualudis -man_MANS = $(man_pages) - -qualudis_SOURCES = \ - qualudis_command_line.hh qualudis_command_line.cc \ - qualudis.cc - -qualudis_LDADD = \ - $(top_builddir)/paludis/libpaludis_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/selinux/libpaludisselinux_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/src/output/liboutput.a \ - $(PCRECPPDEPS_LIBS) \ - $(LIBXML2DEPS_LIBS) \ - $(DYNAMIC_LD_LIBS) - -INCLUDES = $(PCRECPPDEPS_CFLAGS) $(LIBXML2DEPS_CFLAGS) - -TESTS_ENVIRONMENT = env \ - TEST_SCRIPT_DIR="$(srcdir)/" \ - PALUDIS_REPOSITORY_SO_DIR="$(top_builddir)/paludis/repositories" \ - PALUDIS_NO_XTERM_TITLES="yes" \ - PALUDIS_OPTIONS="" \ - QUALUDIS_OPTIONS="" \ - bash $(top_srcdir)/test/run_test.sh bash - -TESTS = version_TEST - -version_TEST : - echo -e "#!/bin/sh\n./qualudis --version" > $@ - -endif - -qualudis.1 : man-qualudis - ./man-qualudis > $@ - -man_qualudis_SOURCES = \ - man_qualudis.cc \ - qualudis_command_line.hh \ - qualudis_command_line.cc - -man_qualudis_LDADD = \ - $(top_builddir)/paludis/args/libpaludisargs_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/args/libpaludisman_@PALUDIS_PC_SLOT@.a \ - $(top_builddir)/paludis/util/libpaludisutil_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/paludis/libpaludismanpagethings_@PALUDIS_PC_SLOT@.la \ - $(top_builddir)/src/output/liboutput.a \ - $(DYNAMIC_LD_LIBS) - -CLEANFILES = *~ version_TEST gmon.out *.gcov *.gcno *.gcda *.loT *.epicfail -DISTCLEANFILES = $(man_pages) $(noinst_DATA) -MAINTAINERCLEANFILES = Makefile.in -EXTRA_DIST = $(man_pages) - -built-sources : $(BUILT_SOURCES) - for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done - diff --git a/src/clients/qualudis/man_qualudis.cc b/src/clients/qualudis/man_qualudis.cc deleted file mode 100644 index c21a1761e..000000000 --- a/src/clients/qualudis/man_qualudis.cc +++ /dev/null @@ -1,78 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "qualudis_command_line.hh" -#include <paludis/args/man.hh> - -#include <iostream> -#include <cstdlib> - -using std::cout; -using std::endl; - -namespace -{ - struct ManCommandLine : - paludis::args::ArgsHandler - { - paludis::args::ArgsGroup group; - paludis::args::SwitchArg a_html; - - ManCommandLine() : - group(main_options_section(), "", ""), - a_html(&group, "html", '\0', "", false) - { - } - - virtual std::string app_name() const - { - return ""; - } - - virtual std::string app_description() const - { - return ""; - } - - virtual std::string app_synopsis() const - { - return ""; - } - }; -} - -int -main(int argc, char * argv[]) -{ - ManCommandLine cmdline; - cmdline.run(argc, argv, "", "", ""); - - if (cmdline.a_html.specified()) - { - paludis::args::HtmlWriter hw(cout); - paludis::args::generate_doc(hw, QualudisCommandLine::get_instance()); - } - else - { - paludis::args::ManWriter mw(cout); - paludis::args::generate_doc(mw, QualudisCommandLine::get_instance()); - } - - return EXIT_SUCCESS; -} diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc deleted file mode 100644 index 3ccfb5f76..000000000 --- a/src/clients/qualudis/qualudis.cc +++ /dev/null @@ -1,439 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include <paludis/args/args.hh> -#include <paludis/paludis.hh> -#include <paludis/qa.hh> -#include <paludis/util/system.hh> -#include <paludis/util/join.hh> -#include <paludis/util/dir_iterator.hh> -#include <paludis/util/log.hh> -#include <paludis/util/is_file_with_extension.hh> -#include <paludis/util/strip.hh> -#include <paludis/stringify_formatter.hh> -#include <paludis/environments/no_config/no_config_environment.hh> -#include <tr1/functional> -#include <cstdlib> -#include <iostream> -#include <algorithm> -#include <map> -#include <set> - -#include "qualudis_command_line.hh" -#include <src/output/colour.hh> -#include <paludis/args/do_help.hh> - -#include "config.h" - -using namespace paludis; -using std::cout; -using std::cerr; -using std::endl; - -namespace -{ - struct DoVersion - { - }; - - FSEntry - get_location() - { - Context context("When determining tree location:"); - - if (QualudisCommandLine::get_instance()->a_repository_directory.specified()) - return FSEntry(QualudisCommandLine::get_instance()->a_repository_directory.argument()); - - if ((FSEntry::cwd() / "profiles").is_directory()) - return FSEntry::cwd(); - if ((FSEntry::cwd().dirname() / "profiles").is_directory()) - return FSEntry::cwd().dirname(); - if ((FSEntry::cwd().dirname().dirname() / "profiles").is_directory()) - return FSEntry::cwd().dirname().dirname(); - - throw ConfigurationError("Cannot find tree location (try specifying --repository-dir)"); - } - - struct MetadataKeyPrettyPrinter - { - std::ostringstream stream; - StringifyFormatter formatter; - - void visit(const MetadataCollectionKey<Set<std::string> > & k) - { - stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n"; - } - - void visit(const MetadataCollectionKey<Sequence<std::string> > & k) - { - stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n"; - } - - void visit(const MetadataCollectionKey<FSEntrySequence> & k) - { - stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n"; - } - - void visit(const MetadataCollectionKey<KeywordNameSet> & k) - { - stream << k.raw_name() << ": " << join(k.value()->begin(), k.value()->end(), " ") << "\n"; - } - - void visit(const MetadataSpecTreeKey<DependencySpecTree> & k) - { - stream << k.raw_name() << ": " << k.pretty_print_flat(formatter) << "\n"; - } - - void visit(const MetadataSpecTreeKey<FetchableURISpecTree> & k) - { - stream << k.raw_name() << ": " << k.pretty_print_flat(formatter) << "\n"; - } - - void visit(const MetadataSpecTreeKey<SimpleURISpecTree> & k) - { - stream << k.raw_name() << ": " << k.pretty_print_flat(formatter) << "\n"; - } - - void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k) - { - stream << k.raw_name() << ": " << k.pretty_print_flat(formatter) << "\n"; - } - - void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k) - { - stream << k.raw_name() << ": " << k.pretty_print_flat(formatter) << "\n"; - } - - void visit(const MetadataSpecTreeKey<PlainTextSpecTree> & k) - { - stream << k.raw_name() << ": " << k.pretty_print_flat(formatter) << "\n"; - } - - void visit(const MetadataCollectionKey<PackageIDSequence> & k) - { - stream << k.raw_name() << ": " - << join(indirect_iterator(k.value()->begin()), indirect_iterator(k.value()->end()), " ") << "\n"; - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const PackageID> > & k) - { - stream << k.raw_name() << ": " << stringify(*k.value()) << "\n"; - } - - void visit(const MetadataValueKey<std::string> & k) - { - stream << k.raw_name() << ": " << k.value() << "\n"; - } - - void visit(const MetadataValueKey<SlotName> & k) - { - stream << k.raw_name() << ": " << k.value() << "\n"; - } - - void visit(const MetadataValueKey<long> & k) - { - stream << k.raw_name() << ": " << k.value() << "\n"; - } - - void visit(const MetadataValueKey<bool> & k) - { - stream << k.raw_name() << ": " << k.value() << "\n"; - } - - void visit(const MetadataTimeKey & k) - { - stream << k.raw_name() << ": " << k.value() << "\n"; - } - - void visit(const MetadataValueKey<FSEntry> & k) - { - stream << k.raw_name() << ": " << k.value() << "\n"; - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const RepositoryMaskInfo> > & k) - { - if (k.value()) - stream << k.raw_name() << ": " << (*k.value()).mask_file() << ": " - << join((*k.value()).comment()->begin(), (*k.value()).comment()->end(), " ") << "\n"; - else - stream << k.raw_name() << "\n"; - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const Contents> > & k) - { - stream << k.raw_name() << "\n"; - } - - void visit(const MetadataValueKey<std::tr1::shared_ptr<const Choices> > & k) - { - stream << k.raw_name() << "\n"; - } - - void visit(const MetadataSectionKey & k) - { - stream << k.raw_name() << "\n"; - } - }; - - struct QualudisReporter : - QAReporter - { - FSEntry previous_entry; - - bool show_keys, show_keys_once; - std::map<std::tr1::shared_ptr<const PackageID>, std::set<std::string>, PackageIDSetComparator> printed_keys; - - QualudisReporter(const std::string & show_associated_keys) : - previous_entry("/NONE"), - show_keys("never" != show_associated_keys), - show_keys_once("once" == show_associated_keys) - { - } - - void message(const QAMessage & msg) - { - if (previous_entry != msg.entry()) - { - if (FSEntry("/NONE") != previous_entry) - std::cout << std::endl; - - std::string filename(strip_leading_string(stringify(msg.entry().strip_leading(FSEntry::cwd())), "/")); - std::cout << colour(cl_package_name, filename.length() > 0 ? filename : ".") - << ":" << std::endl; - previous_entry = msg.entry(); - } - - std::cout << " ["; - switch (msg.level()) - { - case qaml_maybe: - std::cout << "?"; - break; - - case qaml_debug: - std::cout << "-"; - break; - - case qaml_minor: - std::cout << "*"; - break; - - case qaml_normal: - std::cout << colour(cl_error, "*"); - break; - - case qaml_severe: - std::cout << colour(cl_error, "!"); - break; - - case last_qaml: - break; - } - - std::cout << "] " + msg.name() + ": " << msg.message() << std::endl; - - if (! msg.associated_ids()->empty()) - { - for (PackageIDSet::ConstIterator i(msg.associated_ids()->begin()), - i_end(msg.associated_ids()->end()) ; i != i_end ; ++i) - if (! (*i)->fs_location_key() || (*i)->fs_location_key()->value() != msg.entry()) - std::cout << " " << stringify(**i) << std::endl; - } - - if (show_keys && ! msg.associated_keys()->empty()) - { - for (QAMessage::KeysSequence::ConstIterator i(msg.associated_keys()->begin()), - i_end(msg.associated_keys()->end()) ; i != i_end ; ++i) - { - if (show_keys_once && ! printed_keys[i->first].insert(i->second->raw_name()).second) - continue; - - try - { - MetadataKeyPrettyPrinter pp; - i->second->accept(pp); - std::cout << " " << pp.stream.str(); - } - catch (const InternalError &) - { - throw; - } - catch (const Exception &) - { - // assume one of the QA checks already - // printed a suitable error - } - } - } - } - - void status(const std::string & s) - { - std::cerr << xterm_title(s); - } - }; -} - -int main(int argc, char *argv[]) -{ - std::string options(paludis::getenv_with_default("QUALUDIS_OPTIONS", "")); - if (! options.empty()) - options = "(" + options + ") "; - options += join(argv + 1, argv + argc, " "); - - Context context(std::string("In program ") + argv[0] + " " + options + ":"); - - try - { - QualudisCommandLine::get_instance()->run(argc, argv, "qualudis", "QUALUDIS_OPTIONS", - "QUALUDIS_CMDLINE"); - - if (QualudisCommandLine::get_instance()->a_help.specified()) - throw args::DoHelp(); - - if (QualudisCommandLine::get_instance()->a_log_level.specified()) - Log::get_instance()->set_log_level(QualudisCommandLine::get_instance()->a_log_level.option()); - else - Log::get_instance()->set_log_level(ll_qa); - - if (! QualudisCommandLine::get_instance()->a_message_level.specified()) - QualudisCommandLine::get_instance()->message_level = qaml_maybe; - else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "debug") - QualudisCommandLine::get_instance()->message_level = qaml_debug; - else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "maybe") - QualudisCommandLine::get_instance()->message_level = qaml_maybe; - else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "minor") - QualudisCommandLine::get_instance()->message_level = qaml_minor; - else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "normal") - QualudisCommandLine::get_instance()->message_level = qaml_normal; - else if (QualudisCommandLine::get_instance()->a_message_level.argument() == "severe") - QualudisCommandLine::get_instance()->message_level = qaml_severe; - else - throw args::DoHelp("bad value for --message-level"); - - if (QualudisCommandLine::get_instance()->a_version.specified()) - throw DoVersion(); - - if (! QualudisCommandLine::get_instance()->a_write_cache_dir.specified()) - QualudisCommandLine::get_instance()->a_write_cache_dir.set_argument("/var/empty"); - - std::tr1::shared_ptr<FSEntrySequence> extra_repository_dirs(new FSEntrySequence); - for (args::StringSequenceArg::ConstIterator d(QualudisCommandLine::get_instance()->a_extra_repository_dir.begin_args()), - d_end(QualudisCommandLine::get_instance()->a_extra_repository_dir.end_args()) ; - d != d_end ; ++d) - extra_repository_dirs->push_back(*d); - - std::tr1::shared_ptr<NoConfigEnvironment> env(new NoConfigEnvironment(make_named_values<no_config_environment::Params>( - value_for<n::accept_unstable>(false), - value_for<n::disable_metadata_cache>(! QualudisCommandLine::get_instance()->a_use_repository_cache.specified()), - value_for<n::extra_accept_keywords>(""), - value_for<n::extra_params>(std::tr1::shared_ptr<Map<std::string, std::string> >()), - value_for<n::extra_repository_dirs>(extra_repository_dirs), - value_for<n::master_repository_name>(QualudisCommandLine::get_instance()->a_master_repository_name.argument()), - value_for<n::repository_dir>(get_location()), - value_for<n::repository_type>(no_config_environment::ncer_ebuild), - value_for<n::write_cache>(QualudisCommandLine::get_instance()->a_write_cache_dir.argument()) - ))); - - if (! (*env->main_repository()).qa_interface()) - throw ConfigurationError("Repository '" + stringify(env->main_repository()->name()) + "' does not support QA checks"); - - QualudisReporter r(QualudisCommandLine::get_instance()->a_show_associated_keys.argument()); - if (QualudisCommandLine::get_instance()->empty()) - { - (*env->main_repository()).qa_interface()->check_qa( - r, - QACheckProperties(), - QACheckProperties(), - QualudisCommandLine::get_instance()->message_level, - FSEntry::cwd()); - } - else - { - for (QualudisCommandLine::ParametersConstIterator c(QualudisCommandLine::get_instance()->begin_parameters()), - c_end(QualudisCommandLine::get_instance()->end_parameters()) ; - c != c_end ; ++c) - (*env->main_repository()).qa_interface()->check_qa( - r, - QACheckProperties(), - QACheckProperties(), - QualudisCommandLine::get_instance()->message_level, - FSEntry(*c)); - } - } - catch (const DoVersion &) - { - cout << "qualudis, part of " << PALUDIS_PACKAGE << " " << PALUDIS_VERSION_MAJOR << "." - << PALUDIS_VERSION_MINOR << "." << PALUDIS_VERSION_MICRO << PALUDIS_VERSION_SUFFIX; - if (! std::string(PALUDIS_GIT_HEAD).empty()) - cout << " git " << PALUDIS_GIT_HEAD; - cout << endl << endl; - cout << "Paludis comes with ABSOLUTELY NO WARRANTY. Paludis is free software, and you" << endl; - cout << "are welcome to redistribute it under the terms of the GNU General Public" << endl; - cout << "License, version 2." << endl; - - return EXIT_SUCCESS; - } - catch (const paludis::args::ArgsError & e) - { - cerr << "Usage error: " << e.message() << endl; - cerr << "Try " << argv[0] << " --help" << endl; - return EXIT_FAILURE; - } - catch (const args::DoHelp & h) - { - if (h.message.empty()) - { - cout << "Usage: " << argv[0] << " [options]" << endl; - cout << " or: " << argv[0] << " [package/category ..]" << endl; - cout << endl; - cout << *QualudisCommandLine::get_instance(); - return EXIT_SUCCESS; - } - else - { - cerr << "Usage error: " << h.message << endl; - cerr << "Try " << argv[0] << " --help" << endl; - return EXIT_FAILURE; - } - } - catch (const Exception & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.backtrace("\n * ") - << e.message() << " (" << e.what() << ")" << endl; - return EXIT_FAILURE; - } - catch (const std::exception & e) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * " << e.what() << endl; - return EXIT_FAILURE; - } - catch (...) - { - cout << endl; - cerr << "Unhandled exception:" << endl - << " * Unknown exception type. Ouch..." << endl; - return EXIT_FAILURE; - } -} - diff --git a/src/clients/qualudis/qualudis_command_line.cc b/src/clients/qualudis/qualudis_command_line.cc deleted file mode 100644 index 9b0d690f1..000000000 --- a/src/clients/qualudis/qualudis_command_line.cc +++ /dev/null @@ -1,102 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -/* - * Copyright (c) 2006, 2007, 2008, 2009 Ciaran McCreesh - * - * This file is part of the Paludis package manager. Paludis is free software; - * you can redistribute it and/or modify it under the terms of the GNU General - * Public License version 2, as published by the Free Software Foundation. - * - * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY - * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS - * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more - * details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 59 Temple - * Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "qualudis_command_line.hh" -#include <paludis/util/instantiation_policy-impl.hh> - -template class paludis::InstantiationPolicy<QualudisCommandLine, paludis::instantiation_method::SingletonTag>; - -QualudisCommandLine::QualudisCommandLine() : - ArgsHandler(), - - action_args(main_options_section(), "Actions", - "Selects which basic action to perform. Up to one action should " - "be specified. If no action is specified, the directories specifed " - "on the command line (or, if none, the current directory) are " - "checked."), - a_version(&action_args, "version", 'V', "Display program version", false), - a_help(&action_args, "help", 'h', "Display program help", false), - - check_options(main_options_section(), "Options for general checks", - "Options relevant for the --owner actions."), - a_log_level(&check_options, "log-level", 'L'), - - a_message_level(&check_options, "message-level", 'M', "Specify the message level", - paludis::args::EnumArg::EnumArgOptions - ("debug", "Show debug and upwards") - ("maybe", "Show maybe and upwards") - ("minor", "Show minor and upwards") - ("normal", "Show normal and upwards") - ("severe", "Show severe and upwards"), - "maybe"), - message_level(paludis::qaml_maybe), - - a_show_associated_keys(&check_options, "show-associated-keys", '\0', "Show the contents of relevant metadata keys", - paludis::args::EnumArg::EnumArgOptions - ("never", "Never show metadata keys") - ("once", "Show each metadata key at most once") - ("always", "Always show metadata keys"), - "once"), - - a_repository_directory(&check_options, "repository-dir", 'D', - "Where to find the repository (default: detected from ./ or ../ or ../..)"), - - configuration_options(main_options_section(), "Configuration options", - "Options that control general configuration."), - a_write_cache_dir(&configuration_options, "write-cache-dir", '\0', - "Use a subdirectory named for the repository name under the specified directory for repository write cache"), - a_master_repository_name(&configuration_options, "master-repository-name", '\0', - "Use the specified name for the master repository. Specify the location using --extra-repository-dir. " - "Only for repositories with no metadata/layout.conf."), - a_extra_repository_dir(&configuration_options, "extra-repository-dir", '\0', - "Also include the repository at this location. May be specified multiple times, in creation order."), - a_use_repository_cache(&configuration_options, "use-repository-cache", '\0', - "Use the repository's metadata cache, if available (faster, but may miss certain errors)", true) -{ - add_usage_line("[ options ] [ directories ... ]"); - - add_description_line("qualudis is configured purely from the command line. It does not use any user " - "configuration files."); - - add_environment_variable("QUALUDIS_OPTIONS", "Default command-line options."); -} - -QualudisCommandLine::~QualudisCommandLine() -{ -} - -std::string -QualudisCommandLine::app_name() const -{ - return "qualudis"; -} - -std::string -QualudisCommandLine::app_synopsis() const -{ - return "A QA tool for ebuilds"; -} - -std::string -QualudisCommandLine::app_description() const -{ - return - "qualudis is a QA assistant for ebuilds and ebuild repositories. It checks for " - "many common and potential mistakes and displays a summary of its findings."; -} diff --git a/src/clients/qualudis/qualudis_command_line.hh b/src/clients/qualudis/qualudis_command_line.hh deleted file mode 100644 index 5b02ce5ad..000000000 --- a/src/clients/qualudis/qualudis_command_line.hh +++ /dev/null @@ -1,84 +0,0 @@ -/* vim: set sw=4 sts=4 et foldmethod=syntax : */ - -#ifndef PALUDIS_GUARD_SRC_QUALUDIS_QUALUDIS_COMMAND_LINE_HH -#define PALUDIS_GUARD_SRC_QUALUDIS_QUALUDIS_COMMAND_LINE_HH 1 - -#include <paludis/args/args.hh> -#include <paludis/qa-fwd.hh> -#include <paludis/util/instantiation_policy.hh> -#include <paludis/args/log_level_arg.hh> - -class QualudisCommandLine : - public paludis::args::ArgsHandler, - public paludis::InstantiationPolicy<QualudisCommandLine, paludis::instantiation_method::SingletonTag> -{ - friend class paludis::InstantiationPolicy<QualudisCommandLine, paludis::instantiation_method::SingletonTag>; - - private: - /// Constructor. - QualudisCommandLine(); - - /// Destructor. - ~QualudisCommandLine(); - - public: - ///\name Program information - ///\{ - - virtual std::string app_name() const; - virtual std::string app_synopsis() const; - virtual std::string app_description() const; - - ///\} - - ///\name Action arguments - ///\{ - - /// Action arguments. - paludis::args::ArgsGroup action_args; - - /// --version - paludis::args::SwitchArg a_version; - - /// --help - paludis::args::SwitchArg a_help; - - ///\} - - ///\name Check options - ///\{ - - /// Check options. - paludis::args::ArgsGroup check_options; - - /// --log-level - paludis::args::LogLevelArg a_log_level; - - /// --message-level - paludis::args::EnumArg a_message_level; - - paludis::QAMessageLevel message_level; - - /// --show-associated-keys - paludis::args::EnumArg a_show_associated_keys; - - /// --repository-dir - paludis::args::StringArg a_repository_directory; - - ///\} - - ///\name Configuration options - ///\{ - - paludis::args::ArgsGroup configuration_options; - - paludis::args::StringArg a_write_cache_dir; - paludis::args::StringArg a_master_repository_name; - paludis::args::StringSequenceArg a_extra_repository_dir; - paludis::args::SwitchArg a_use_repository_cache; - - ///\} -}; - - -#endif |