aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-15 14:09:31 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-15 14:09:31 +0000
commit566ed28372bd3e29d5ee3eb263ec9f155fee91b4 (patch)
tree8973f99441ad3ced9b267246e5990b17f3197d38
parentdd285fe535fd4c3c63c5f28cde68e82791d32c93 (diff)
downloadpaludis-566ed28372bd3e29d5ee3eb263ec9f155fee91b4.tar.gz
paludis-566ed28372bd3e29d5ee3eb263ec9f155fee91b4.tar.xz
Also check for DEPEND overlap with PDEPEND
-rw-r--r--paludis/qa/dep_any_check.cc6
-rw-r--r--paludis/qa/files.m42
-rw-r--r--paludis/qa/pdepend_overlap_check.cc (renamed from paludis/qa/rdepend_pdepend_overlap_check.cc)50
-rw-r--r--paludis/qa/pdepend_overlap_check.hh (renamed from paludis/qa/rdepend_pdepend_overlap_check.hh)10
4 files changed, 46 insertions, 22 deletions
diff --git a/paludis/qa/dep_any_check.cc b/paludis/qa/dep_any_check.cc
index dc8bb51..dcd79a0 100644
--- a/paludis/qa/dep_any_check.cc
+++ b/paludis/qa/dep_any_check.cc
@@ -26,6 +26,7 @@
#include <paludis/package_dep_atom.hh>
#include <paludis/block_dep_atom.hh>
#include <paludis/use_dep_atom.hh>
+#include <paludis/iterator_utilities.hh>
#include <paludis/save.hh>
using namespace paludis;
@@ -64,7 +65,12 @@ namespace
if (a->begin() == a->end())
result << Message(qal_minor, "Empty || ( ) block in " + role);
else
+ {
+ if (a->end() == next(a->begin()))
+ result << Message(qal_minor, "One item in || ( ) block in " + role);
+
std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
}
void visit(const UseDepAtom * const u)
diff --git a/paludis/qa/files.m4 b/paludis/qa/files.m4
index d5b500c..16ea902 100644
--- a/paludis/qa/files.m4
+++ b/paludis/qa/files.m4
@@ -33,7 +33,7 @@ add(`package_dir_check', `hh', `cc')
add(`package_name_check', `hh', `cc', `test', `testscript')
add(`parse_deps_check', `hh', `cc')
add(`rdepend_packages_check', `hh', `cc')
-add(`rdepend_pdepend_overlap_check', `hh', `cc')
+add(`pdepend_overlap_check', `hh', `cc')
add(`qa', `hh', `cc')
add(`slot_check', `hh', `cc')
diff --git a/paludis/qa/rdepend_pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index a31ae17..1fdd862 100644
--- a/paludis/qa/rdepend_pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -17,7 +17,7 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "rdepend_pdepend_overlap_check.hh"
+#include "pdepend_overlap_check.hh"
#include <paludis/dep_parser.hh>
#include <paludis/dep_atom_visitor.hh>
#include <paludis/any_dep_atom.hh>
@@ -67,12 +67,12 @@ namespace
};
}
-RdependPdependOverlapCheck::RdependPdependOverlapCheck()
+PdependOverlapCheck::PdependOverlapCheck()
{
}
CheckResult
-RdependPdependOverlapCheck::operator() (const EbuildCheckData & e) const
+PdependOverlapCheck::operator() (const EbuildCheckData & e) const
{
CheckResult result(stringify(e.get<ecd_name>()) + "-" + stringify(e.get<ecd_version>()),
identifier());
@@ -84,22 +84,40 @@ RdependPdependOverlapCheck::operator() (const EbuildCheckData & e) const
VersionMetadata::ConstPointer metadata(
e.get<ecd_environment>()->package_database()->fetch_metadata(ee));
- Collector rdepend_collector;
- std::string rdepend(metadata->get(vmk_rdepend));
- DepParser::parse(rdepend)->accept(&rdepend_collector);
-
Collector pdepend_collector;
std::string pdepend(metadata->get(vmk_pdepend));
DepParser::parse(pdepend)->accept(&pdepend_collector);
- std::set<QualifiedPackageName> overlap;
- std::set_intersection(rdepend_collector.result.begin(), rdepend_collector.result.end(),
- pdepend_collector.result.begin(), pdepend_collector.result.end(),
- std::inserter(overlap, overlap.begin()));
+ {
+ Collector depend_collector;
+ std::string depend(metadata->get(vmk_depend));
+ DepParser::parse(depend)->accept(&depend_collector);
+
+ std::set<QualifiedPackageName> overlap;
+ std::set_intersection(depend_collector.result.begin(), depend_collector.result.end(),
+ pdepend_collector.result.begin(), pdepend_collector.result.end(),
+ std::inserter(overlap, overlap.begin()));
+
+ if (! overlap.empty())
+ result << Message(qal_major, "Overlap between DEPEND and PDEPEND: '" +
+ join(overlap.begin(), overlap.end(), "', ") + "'");
+ }
+
+ {
+ Collector rdepend_collector;
+ std::string rdepend(metadata->get(vmk_rdepend));
+ DepParser::parse(rdepend)->accept(&rdepend_collector);
+
+ std::set<QualifiedPackageName> overlap;
+ std::set_intersection(rdepend_collector.result.begin(), rdepend_collector.result.end(),
+ pdepend_collector.result.begin(), pdepend_collector.result.end(),
+ std::inserter(overlap, overlap.begin()));
+
+ if (! overlap.empty())
+ result << Message(qal_major, "Overlap between RDEPEND and PDEPEND: '" +
+ join(overlap.begin(), overlap.end(), "', ") + "'");
+ }
- if (! overlap.empty())
- result << Message(qal_major, "Overlap between RDEPEND and PDEPEND: '" +
- join(overlap.begin(), overlap.end(), "', ") + "'");
}
catch (const InternalError &)
{
@@ -115,9 +133,9 @@ RdependPdependOverlapCheck::operator() (const EbuildCheckData & e) const
}
const std::string &
-RdependPdependOverlapCheck::identifier()
+PdependOverlapCheck::identifier()
{
- static const std::string id("rdepend pdepend overlap");
+ static const std::string id("pdepend overlap");
return id;
}
diff --git a/paludis/qa/rdepend_pdepend_overlap_check.hh b/paludis/qa/pdepend_overlap_check.hh
index 547c712..9a745c0 100644
--- a/paludis/qa/rdepend_pdepend_overlap_check.hh
+++ b/paludis/qa/pdepend_overlap_check.hh
@@ -27,11 +27,11 @@ namespace paludis
{
namespace qa
{
- class RdependPdependOverlapCheck :
+ class PdependOverlapCheck :
public EbuildCheck
{
public:
- RdependPdependOverlapCheck();
+ PdependOverlapCheck();
CheckResult operator() (const EbuildCheckData &) const;
@@ -39,12 +39,12 @@ namespace paludis
virtual std::string describe() const
{
- return "Checks for RDEPEND/PDEPEND overlap";
+ return "Checks for PDEPEND overlap";
}
};
- static const EbuildCheckMaker::RegisterMaker register_rdepend_pdepend_overlap_check(
- RdependPdependOverlapCheck::identifier(), &make_ebuild_check<RdependPdependOverlapCheck>);
+ static const EbuildCheckMaker::RegisterMaker register_pdepend_overlap_check(
+ PdependOverlapCheck::identifier(), &make_ebuild_check<PdependOverlapCheck>);
}
}