aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-21 13:40:35 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2006-02-21 13:40:35 +0000
commit397867bd1f2115abdde232e2f12afbfa025ae96a (patch)
treef7311680a36ae3d2a2b7116daf74e519eb9f7d1a
parent4c5020c46f1a66b590bbd0846907e14fe9ced3e0 (diff)
downloadpaludis-397867bd1f2115abdde232e2f12afbfa025ae96a.tar.gz
paludis-397867bd1f2115abdde232e2f12afbfa025ae96a.tar.xz
Kill the nest stuff, and make Dep more flexible instead. Make || in LICENSE work.
-rw-r--r--paludis/dep_atom.cc25
-rw-r--r--paludis/dep_atom.hh55
-rw-r--r--paludis/dep_atom_dumper.cc6
-rw-r--r--paludis/dep_atom_dumper.hh2
-rw-r--r--paludis/dep_atom_flattener.cc (renamed from paludis/nest_atom_flattener.cc)41
-rw-r--r--paludis/dep_atom_flattener.hh (renamed from paludis/nest_atom_flattener.hh)35
-rw-r--r--paludis/dep_atom_pretty_printer.cc6
-rw-r--r--paludis/dep_atom_pretty_printer.hh2
-rw-r--r--paludis/dep_list.cc27
-rw-r--r--paludis/dep_list.hh1
-rw-r--r--paludis/dep_parser.cc18
-rw-r--r--paludis/dep_parser.hh69
-rw-r--r--paludis/files.m44
-rw-r--r--paludis/nest_atom.cc72
-rw-r--r--paludis/nest_atom.hh215
-rw-r--r--paludis/nest_parser.cc212
-rw-r--r--paludis/nest_parser.hh85
-rw-r--r--paludis/qa/dep_any_check.cc8
-rw-r--r--paludis/qa/dep_flags_check.cc51
-rw-r--r--paludis/qa/dep_packages_check.cc4
-rw-r--r--paludis/qa/deps_exist_check.cc4
-rw-r--r--paludis/qa/deps_visible_check.cc4
-rw-r--r--paludis/qa/license_check.cc37
-rw-r--r--paludis/qa/pdepend_overlap_check.cc4
-rw-r--r--paludis/qa/src_uri_check.cc38
25 files changed, 312 insertions, 713 deletions
diff --git a/paludis/dep_atom.cc b/paludis/dep_atom.cc
index b64adc0..6b93920 100644
--- a/paludis/dep_atom.cc
+++ b/paludis/dep_atom.cc
@@ -66,11 +66,13 @@ UseDepAtom::as_use_dep_atom() const
}
BlockDepAtom::BlockDepAtom(PackageDepAtom::ConstPointer a) :
+ StringDepAtom("!" + a->text()),
_atom(a)
{
}
PackageDepAtom::PackageDepAtom(const QualifiedPackageName & package) :
+ StringDepAtom(stringify(package)),
_package(package),
_version_operator("="),
_version_spec(0),
@@ -78,19 +80,8 @@ PackageDepAtom::PackageDepAtom(const QualifiedPackageName & package) :
{
}
-PackageDepAtom::PackageDepAtom(
- const QualifiedPackageName & package,
- VersionOperator version_operator,
- CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec_ptr,
- CountedPtr<SlotName, count_policy::ExternalCountTag> slot_ptr) :
- _package(package),
- _version_operator(version_operator),
- _version_spec(version_spec_ptr),
- _slot(slot_ptr)
-{
-}
-
PackageDepAtom::PackageDepAtom(const std::string & ss) :
+ StringDepAtom(ss),
_package(CategoryNamePart("later"), PackageNamePart("later")),
_version_operator("="),
_version_spec(0),
@@ -193,3 +184,13 @@ PackageDepAtomError::PackageDepAtomError(const std::string & msg) throw () :
{
}
+StringDepAtom::StringDepAtom(const std::string & s) :
+ _str(s)
+{
+}
+
+PlainTextDepAtom::PlainTextDepAtom(const std::string & s) :
+ StringDepAtom(s)
+{
+}
+
diff --git a/paludis/dep_atom.hh b/paludis/dep_atom.hh
index d78d667..389bd1b 100644
--- a/paludis/dep_atom.hh
+++ b/paludis/dep_atom.hh
@@ -43,6 +43,7 @@ namespace paludis
class DepAtom;
class CompositeDepAtom;
class PackageDepAtom;
+ class PlainTextDepAtom;
class AllDepAtom;
class AnyDepAtom;
class UseDepAtom;
@@ -51,7 +52,7 @@ namespace paludis
/**
* Visitor types for a visitor that can visit a DepAtom heirarchy.
*/
- typedef VisitorTypes<PackageDepAtom *, AllDepAtom *, AnyDepAtom *,
+ typedef VisitorTypes<PackageDepAtom *, PlainTextDepAtom *, AllDepAtom *, AnyDepAtom *,
UseDepAtom *, BlockDepAtom *> DepAtomVisitorTypes;
/**
@@ -200,6 +201,26 @@ namespace paludis
};
/**
+ * A StringDepAtom represents a non-composite dep atom with an associated
+ * piece of text.
+ */
+ class StringDepAtom :
+ public DepAtom
+ {
+ private:
+ const std::string _str;
+
+ protected:
+ StringDepAtom(const std::string &);
+
+ public:
+ const std::string & text() const
+ {
+ return _str;
+ }
+ };
+
+ /**
* A PackageDepAtom represents a package name (for example,
* 'app-editors/vim'), possibly with associated version and SLOT
* restrictions.
@@ -207,7 +228,7 @@ namespace paludis
* \ingroup DepResolver
*/
class PackageDepAtom :
- public DepAtom,
+ public StringDepAtom,
public Visitable<PackageDepAtom, DepAtomVisitorTypes>
{
private:
@@ -223,14 +244,6 @@ namespace paludis
PackageDepAtom(const QualifiedPackageName & package);
/**
- * Constructor, with restrictions.
- */
- PackageDepAtom(const QualifiedPackageName & package,
- VersionOperator version_operator,
- CountedPtr<VersionSpec, count_policy::ExternalCountTag> version_spec,
- CountedPtr<SlotName, count_policy::ExternalCountTag> slot);
-
- /**
* Constructor, parse restrictions ourself.
*/
PackageDepAtom(const std::string &);
@@ -276,6 +289,26 @@ namespace paludis
typedef CountedPtr<const PackageDepAtom, count_policy::InternalCountTag> ConstPointer;
};
+ /**
+ * A PlainTextDepAtom represents a plain text entry (for example,
+ * a URI in SRC_URI).
+ *
+ * \ingroup DepResolver
+ */
+ class PlainTextDepAtom :
+ public StringDepAtom,
+ public Visitable<PlainTextDepAtom, DepAtomVisitorTypes>
+ {
+ public:
+ /**
+ * Constructor.
+ */
+ PlainTextDepAtom(const std::string &);
+
+ typedef CountedPtr<PlainTextDepAtom, count_policy::InternalCountTag> Pointer;
+ typedef CountedPtr<const PlainTextDepAtom, count_policy::InternalCountTag> ConstPointer;
+ };
+
class PackageDepAtomError :
public Exception
{
@@ -296,7 +329,7 @@ namespace paludis
* \ingroup DepResolver
*/
class BlockDepAtom :
- public DepAtom,
+ public StringDepAtom,
public Visitable<BlockDepAtom, DepAtomVisitorTypes>
{
private:
diff --git a/paludis/dep_atom_dumper.cc b/paludis/dep_atom_dumper.cc
index 2c87977..f066fd8 100644
--- a/paludis/dep_atom_dumper.cc
+++ b/paludis/dep_atom_dumper.cc
@@ -65,6 +65,12 @@ DepAtomDumper::visit(const PackageDepAtom * const p)
}
void
+DepAtomDumper::visit(const PlainTextDepAtom * const t)
+{
+ *_o << "<text>" << t->text() << "</text>";
+}
+
+void
DepAtomDumper::visit(const BlockDepAtom * const b)
{
*_o << "<block>";
diff --git a/paludis/dep_atom_dumper.hh b/paludis/dep_atom_dumper.hh
index 55f422f..cefbe9b 100644
--- a/paludis/dep_atom_dumper.hh
+++ b/paludis/dep_atom_dumper.hh
@@ -55,6 +55,8 @@ namespace paludis
void visit(const PackageDepAtom * const);
+ void visit(const PlainTextDepAtom * const);
+
void visit(const BlockDepAtom * const);
///}
};
diff --git a/paludis/nest_atom_flattener.cc b/paludis/dep_atom_flattener.cc
index 5943654..1685093 100644
--- a/paludis/nest_atom_flattener.cc
+++ b/paludis/dep_atom_flattener.cc
@@ -17,15 +17,15 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "nest_atom_flattener.hh"
-#include "nest_atom.hh"
+#include "dep_atom_flattener.hh"
+#include "dep_atom.hh"
using namespace paludis;
-NestAtomFlattener::NestAtomFlattener(
+DepAtomFlattener::DepAtomFlattener(
const Environment * const env,
const PackageDatabaseEntry * const pkg,
- NestAtom::ConstPointer a) :
+ DepAtom::ConstPointer a) :
_env(env),
_pkg(pkg),
_a(a),
@@ -33,36 +33,51 @@ NestAtomFlattener::NestAtomFlattener(
{
}
-NestAtomFlattener::~NestAtomFlattener()
+DepAtomFlattener::~DepAtomFlattener()
{
}
-NestAtomFlattener::Iterator
-NestAtomFlattener::begin()
+DepAtomFlattener::Iterator
+DepAtomFlattener::begin()
{
if (! _done)
{
- _a->accept(static_cast<NestAtomVisitorTypes::ConstVisitor *>(this));
+ _a->accept(static_cast<DepAtomVisitorTypes::ConstVisitor *>(this));
_done = true;
}
return _atoms.begin();
}
-void NestAtomFlattener::visit(const AllNestAtom * a)
+void DepAtomFlattener::visit(const AllDepAtom * a)
{
std::for_each(a->begin(), a->end(), accept_visitor(
- static_cast<NestAtomVisitorTypes::ConstVisitor *>(this)));
+ static_cast<DepAtomVisitorTypes::ConstVisitor *>(this)));
}
-void NestAtomFlattener::visit(const UseNestAtom * u)
+void DepAtomFlattener::visit(const AnyDepAtom *)
+{
+ throw InternalError(PALUDIS_HERE, "Found unexpected AnyDepAtom");
+}
+
+void DepAtomFlattener::visit(const UseDepAtom * u)
{
if (_env->query_use(u->flag(), _pkg) ^ u->inverse())
std::for_each(u->begin(), u->end(), accept_visitor(
- static_cast<NestAtomVisitorTypes::ConstVisitor *>(this)));
+ static_cast<DepAtomVisitorTypes::ConstVisitor *>(this)));
+}
+
+void DepAtomFlattener::visit(const PlainTextDepAtom * p)
+{
+ _atoms.push_back(p);
+}
+
+void DepAtomFlattener::visit(const PackageDepAtom * p)
+{
+ _atoms.push_back(p);
}
-void NestAtomFlattener::visit(const TextNestAtom * p)
+void DepAtomFlattener::visit(const BlockDepAtom * p)
{
_atoms.push_back(p);
}
diff --git a/paludis/nest_atom_flattener.hh b/paludis/dep_atom_flattener.hh
index 107a6ea..60956dc 100644
--- a/paludis/nest_atom_flattener.hh
+++ b/paludis/dep_atom_flattener.hh
@@ -17,11 +17,11 @@
* Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#ifndef PALUDIS_GUARD_PALUDIS_NEST_ATOM_FLATTENER_HH
-#define PALUDIS_GUARD_PALUDIS_NEST_ATOM_FLATTENER_HH 1
+#ifndef PALUDIS_GUARD_PALUDIS_DEP_ATOM_FLATTENER_HH
+#define PALUDIS_GUARD_PALUDIS_DEP_ATOM_FLATTENER_HH 1
#include <paludis/attributes.hh>
-#include <paludis/nest_atom.hh>
+#include <paludis/dep_atom.hh>
#include <paludis/environment.hh>
#include <paludis/instantiation_policy.hh>
#include <paludis/package_database.hh>
@@ -30,49 +30,52 @@
namespace paludis
{
/**
- * Extract the enabled components of a nest heirarchy for a particular
+ * Extract the enabled components of a dep heirarchy for a particular
* package.
*/
- class NestAtomFlattener :
- private InstantiationPolicy<NestAtomFlattener, instantiation_method::NonCopyableTag>,
- protected NestAtomVisitorTypes::ConstVisitor
+ class DepAtomFlattener :
+ private InstantiationPolicy<DepAtomFlattener, instantiation_method::NonCopyableTag>,
+ protected DepAtomVisitorTypes::ConstVisitor
{
private:
const Environment * const _env;
const PackageDatabaseEntry * const _pkg;
- NestAtom::ConstPointer _a;
+ DepAtom::ConstPointer _a;
- mutable std::list<const TextNestAtom *> _atoms;
+ mutable std::list<const StringDepAtom *> _atoms;
mutable bool _done;
protected:
///\name Visit methods
///{
- void visit(const AllNestAtom *);
- void visit(const UseNestAtom *);
- void visit(const TextNestAtom *);
+ void visit(const AllDepAtom *);
+ void visit(const AnyDepAtom *) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const UseDepAtom *);
+ void visit(const PlainTextDepAtom *);
+ void visit(const PackageDepAtom *);
+ void visit(const BlockDepAtom *);
///}
public:
/**
* Constructor.
*/
- NestAtomFlattener(const Environment * const,
+ DepAtomFlattener(const Environment * const,
const PackageDatabaseEntry * const,
- const NestAtom::ConstPointer);
+ const DepAtom::ConstPointer);
/**
* Destructor.
*/
- ~NestAtomFlattener();
+ ~DepAtomFlattener();
/**
* Iterate over our dep atoms.
*/
- typedef std::list<const TextNestAtom *>::const_iterator Iterator;
+ typedef std::list<const StringDepAtom *>::const_iterator Iterator;
/**
* Iterator to the start of our dep atoms.
diff --git a/paludis/dep_atom_pretty_printer.cc b/paludis/dep_atom_pretty_printer.cc
index 4ffe757..2afa38b 100644
--- a/paludis/dep_atom_pretty_printer.cc
+++ b/paludis/dep_atom_pretty_printer.cc
@@ -72,6 +72,12 @@ DepAtomPrettyPrinter::visit(const PackageDepAtom * const p)
}
void
+DepAtomPrettyPrinter::visit(const PlainTextDepAtom * const p)
+{
+ _s << std::string(_indent, ' ') << p->text() << std::endl;
+}
+
+void
DepAtomPrettyPrinter::visit(const BlockDepAtom * const b)
{
_s << std::string(_indent, ' ') << "!" << *b->blocked_atom() << std::endl;
diff --git a/paludis/dep_atom_pretty_printer.hh b/paludis/dep_atom_pretty_printer.hh
index 919e8ed..b9402c4 100644
--- a/paludis/dep_atom_pretty_printer.hh
+++ b/paludis/dep_atom_pretty_printer.hh
@@ -57,6 +57,8 @@ namespace paludis
void visit(const PackageDepAtom * const);
+ void visit(const PlainTextDepAtom * const);
+
void visit(const BlockDepAtom * const);
///}
};
diff --git a/paludis/dep_list.cc b/paludis/dep_list.cc
index f22e667..920725d 100644
--- a/paludis/dep_list.cc
+++ b/paludis/dep_list.cc
@@ -19,7 +19,7 @@
#include "container_entry.hh"
#include "dep_atom.hh"
-#include "nest_atom_flattener.hh"
+#include "dep_atom_flattener.hh"
#include "dep_list.hh"
#include "dep_parser.hh"
#include "filter_insert_iterator.hh"
@@ -28,9 +28,6 @@
#include "join.hh"
#include "log.hh"
#include "match_package.hh"
-#include "nest_parser.hh"
-#include "nest_atom.hh"
-#include "nest_atom_flattener.hh"
#include "save.hh"
#include "stringify.hh"
@@ -385,7 +382,8 @@ DepList::visit(const PackageDepAtom * const p)
/// \bug PROVIDE can contain use? blocks.
if (! metadata->get(vmk_provide).empty())
{
- NestAtom::ConstPointer provide(NestParser::parse(metadata->get(vmk_provide)));
+ DepAtom::ConstPointer provide(DepParser::parse(metadata->get(vmk_provide),
+ DepParserPolicy<PackageDepAtom, false>::get_instance()));
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
@@ -396,9 +394,9 @@ DepList::visit(const PackageDepAtom * const p)
_implementation->current_package->get<dle_version>(),
_implementation->current_package->get<dle_repository>()));
- NestAtomFlattener f(_implementation->environment, e.raw_pointer(), provide);
+ DepAtomFlattener f(_implementation->environment, e.raw_pointer(), provide);
- for (NestAtomFlattener::Iterator p(f.begin()), p_end(f.end()) ; p != p_end ; ++p)
+ for (DepAtomFlattener::Iterator p(f.begin()), p_end(f.end()) ; p != p_end ; ++p)
{
PackageDepAtom pp(QualifiedPackageName((*p)->text()));
if (_implementation->merge_list.end() != std::find_if(
@@ -598,8 +596,9 @@ DepList::visit(const BlockDepAtom * const d)
continue;
}
- NestAtom::ConstPointer provide(NestParser::parse(
- _implementation->current_package->get<dle_metadata>()->get(vmk_provide)));
+ DepAtom::ConstPointer provide(DepParser::parse(
+ _implementation->current_package->get<dle_metadata>()->get(vmk_provide),
+ DepParserPolicy<PackageDepAtom, false>::get_instance()));
CountedPtr<PackageDatabaseEntry, count_policy::ExternalCountTag> e(0);
@@ -610,10 +609,10 @@ DepList::visit(const BlockDepAtom * const d)
_implementation->current_package->get<dle_version>(),
_implementation->current_package->get<dle_repository>()));
- NestAtomFlattener f(_implementation->environment, e.raw_pointer(), provide);
+ DepAtomFlattener f(_implementation->environment, e.raw_pointer(), provide);
bool skip(false);
- for (IndirectIterator<NestAtomFlattener::Iterator, const TextNestAtom> i(f.begin()),
+ for (IndirectIterator<DepAtomFlattener::Iterator, const StringDepAtom> i(f.begin()),
i_end(f.end()) ; i != i_end ; ++i)
if (QualifiedPackageName(i->text()) == d->blocked_atom()->package())
{
@@ -678,3 +677,9 @@ DepList::set_max_stack_depth(const int value)
_implementation->max_stack_depth = value;
}
+void
+DepList::visit(const PlainTextDepAtom * const t)
+{
+ throw InternalError(PALUDIS_HERE, "Got unexpected PlainTextDepAtom '" + t->text() + "'");
+}
+
diff --git a/paludis/dep_list.hh b/paludis/dep_list.hh
index 3f34e67..490a48a 100644
--- a/paludis/dep_list.hh
+++ b/paludis/dep_list.hh
@@ -221,6 +221,7 @@ namespace paludis
protected:
///\name Visit functions
///{
+ void visit(const PlainTextDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
void visit(const PackageDepAtom * const);
void visit(const UseDepAtom * const);
void visit(const AnyDepAtom * const);
diff --git a/paludis/dep_parser.cc b/paludis/dep_parser.cc
index c7fc225..2e04c0d 100644
--- a/paludis/dep_parser.cc
+++ b/paludis/dep_parser.cc
@@ -48,7 +48,7 @@ enum DepParserState
};
CompositeDepAtom::ConstPointer
-DepParser::parse(const std::string & s)
+DepParser::parse(const std::string & s, const DepParserPolicyInterface * const policy)
{
Context context("When parsing dependency string '" + s + "':");
@@ -76,17 +76,11 @@ DepParser::parse(const std::string & s)
continue;
case dpl_text:
+ /// \bug VV policy
{
if (i->second.empty())
- throw DepStringParseError(i->second, "Empty package name");
- if ('!' == i->second.at(0))
- stack.top()->add_child(DepAtom::Pointer(
- new BlockDepAtom(
- PackageDepAtom::Pointer(new PackageDepAtom(
- i->second.substr(1))))));
- else
- stack.top()->add_child(DepAtom::Pointer(
- new PackageDepAtom(i->second)));
+ throw DepStringParseError(i->second, "Empty text entry");
+ stack.top()->add_child(policy->new_text_atom(i->second));
}
continue;
@@ -109,12 +103,16 @@ DepParser::parse(const std::string & s)
continue;
case dpl_double_bar:
+ if (policy->permit_any_deps())
{
CompositeDepAtom::Pointer a(new AnyDepAtom);
stack.top()->add_child(a);
stack.push(a);
state = dps_had_double_bar;
}
+ else
+ throw DepStringParseError(s, "|| is not allowed here");
+
continue;
case dpl_use_flag:
diff --git a/paludis/dep_parser.hh b/paludis/dep_parser.hh
index 2114a26..56a8579 100644
--- a/paludis/dep_parser.hh
+++ b/paludis/dep_parser.hh
@@ -66,6 +66,69 @@ namespace paludis
DepStringNestingError(const std::string & dep_string) throw ();
};
+ struct DepParserPolicyInterface
+ {
+ virtual CountedPtr<DepAtom> new_text_atom(const std::string &) const = 0;
+
+ virtual bool permit_any_deps() const = 0;
+ };
+
+ template <typename TextAtom_, bool permit_any_>
+ class DepParserPolicy :
+ public DepParserPolicyInterface,
+ public InstantiationPolicy<DepParserPolicy<TextAtom_, permit_any_>,
+ instantiation_method::SingletonAsNeededTag>
+ {
+ friend class InstantiationPolicy<DepParserPolicy<TextAtom_, permit_any_>,
+ instantiation_method::SingletonAsNeededTag>;
+
+ private:
+ DepParserPolicy()
+ {
+ }
+
+ public:
+ virtual CountedPtr<DepAtom> new_text_atom(const std::string & s) const
+ {
+ return CountedPtr<DepAtom>(new TextAtom_(s));
+ }
+
+ virtual bool permit_any_deps() const
+ {
+ return permit_any_;
+ }
+ };
+
+ template <bool permit_any_>
+ class DepParserPolicy<PackageDepAtom, permit_any_> :
+ public DepParserPolicyInterface,
+ public InstantiationPolicy<DepParserPolicy<PackageDepAtom, permit_any_>,
+ instantiation_method::SingletonAsNeededTag>
+ {
+ friend class InstantiationPolicy<DepParserPolicy<PackageDepAtom, permit_any_>,
+ instantiation_method::SingletonAsNeededTag>;
+
+ private:
+ DepParserPolicy()
+ {
+ }
+
+ public:
+ virtual CountedPtr<DepAtom> new_text_atom(const std::string & s) const
+ {
+ if ((! s.empty()) && ('!' == s.at(0)))
+ return CountedPtr<DepAtom>(new BlockDepAtom(
+ CountedPtr<PackageDepAtom>(new PackageDepAtom(s.substr(1)))));
+ else
+ return CountedPtr<DepAtom>(new PackageDepAtom(s));
+ }
+
+ virtual bool permit_any_deps() const
+ {
+ return permit_any_;
+ }
+ };
+
/**
* The DepParser converts string representations of a dependency
* specification into a DepAtom instance.
@@ -73,12 +136,16 @@ namespace paludis
class DepParser :
private InstantiationPolicy<DepParser, instantiation_method::NonInstantiableTag>
{
+ private:
+ typedef DepParserPolicy<PackageDepAtom, true> DefaultPolicy;
+
public:
/**
* Parse a given dependency string, and return an appropriate
* DepAtom tree.
*/
- static CompositeDepAtom::ConstPointer parse(const std::string & s);
+ static CompositeDepAtom::ConstPointer parse(const std::string & s,
+ const DepParserPolicyInterface * const policy = DefaultPolicy::get_instance());
};
}
diff --git a/paludis/files.m4 b/paludis/files.m4
index 50e29c7..3e9de75 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -23,6 +23,7 @@ add(`default_environment', `hh', `cc')
add(`deleter', `hh', `cc', `test')
add(`dep_atom', `hh', `cc', `test')
add(`dep_atom_dumper', `hh', `cc', `test')
+add(`dep_atom_flattener', `hh', `cc')
add(`dep_atom_pretty_printer', `hh', `cc')
add(`dep_lexer', `hh', `cc', `test')
add(`dep_list', `hh', `cc', `test')
@@ -48,9 +49,6 @@ add(`line_config_file', `hh', `cc', `test')
add(`log', `hh', `cc', `test')
add(`mask_reasons', `hh', `cc')
add(`match_package', `hh', `cc')
-add(`nest_atom', `hh', `cc')
-add(`nest_atom_flattener', `hh', `cc')
-add(`nest_parser', `hh', `cc')
add(`package_database', `hh', `cc', `test')
add(`package_name_part', `hh', `cc', `test')
add(`paludis', `hh', `cc')
diff --git a/paludis/nest_atom.cc b/paludis/nest_atom.cc
deleted file mode 100644
index 7ed4184..0000000
--- a/paludis/nest_atom.cc
+++ /dev/null
@@ -1,72 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "nest_atom.hh"
-
-using namespace paludis;
-
-NestAtom::NestAtom()
-{
-}
-
-NestAtom::~NestAtom()
-{
-}
-
-const UseNestAtom *
-NestAtom::as_use_nest_atom() const
-{
- return 0;
-}
-
-CompositeNestAtom::CompositeNestAtom()
-{
-}
-
-void
-CompositeNestAtom::add_child(NestAtom::ConstPointer c)
-{
- _children.push_back(c);
-}
-
-AllNestAtom::AllNestAtom()
-{
-}
-
-UseNestAtom::UseNestAtom(const UseFlagName & flag, bool inverse) :
- _flag(flag),
- _inverse(inverse)
-{
-}
-
-const UseNestAtom *
-UseNestAtom::as_use_nest_atom() const
-{
- return this;
-}
-
-TextNestAtom::TextNestAtom(const std::string & text) :
- _text(text)
-{
-}
-
-TextNestAtom::~TextNestAtom()
-{
-}
-
diff --git a/paludis/nest_atom.hh b/paludis/nest_atom.hh
deleted file mode 100644
index c44a02a..0000000
--- a/paludis/nest_atom.hh
+++ /dev/null
@@ -1,215 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_NEST_ATOM_HH
-#define PALUDIS_GUARD_PALUDIS_NEST_ATOM_HH 1
-
-#include <paludis/attributes.hh>
-#include <paludis/composite_pattern.hh>
-#include <paludis/counted_ptr.hh>
-#include <paludis/instantiation_policy.hh>
-#include <paludis/slot_name.hh>
-#include <paludis/use_flag_name.hh>
-#include <paludis/visitor.hh>
-#include <list>
-
-/** \file
- * Declarations for the NestAtom classes.
- *
- * \ingroup DepResolver
- */
-
-namespace paludis
-{
- class NestAtom;
- class CompositeNestAtom;
- class TextNestAtom;
- class AllNestAtom;
- class UseNestAtom;
-
- /**
- * Visitor types for a visitor that can visit a NestAtom heirarchy.
- */
- typedef VisitorTypes<TextNestAtom *, AllNestAtom *, UseNestAtom *> NestAtomVisitorTypes;
-
- /**
- * Base class for a dependency atom.
- *
- * \ingroup DepResolver
- */
- class NestAtom :
- public virtual VisitableInterface<NestAtomVisitorTypes>,
- public virtual Composite<NestAtom, CompositeNestAtom>,
- private InstantiationPolicy<NestAtom, instantiation_method::NonCopyableTag>,
- public InternalCounted<NestAtom>
- {
- protected:
- NestAtom();
-
- public:
- virtual ~NestAtom();
-
- /**
- * Return us as a UseNestAtom, or 0 if we are not a
- * UseNestAtom.
- */
- virtual const UseNestAtom * as_use_nest_atom() const PALUDIS_ATTRIBUTE((pure));
- };
-
- /**
- * Class for nest atoms that have a number of child nest
- * atoms.
- *
- * \ingroup DepResolver
- */
- class CompositeNestAtom :
- public NestAtom,
- public virtual Composite<NestAtom, CompositeNestAtom>
- {
- private:
- std::list<NestAtom::ConstPointer> _children;
-
- protected:
- /**
- * Constructor.
- */
- CompositeNestAtom();
-
- public:
- /**
- * Append a child to our collection.
- */
- virtual void add_child(NestAtom::ConstPointer);
-
- /**
- * Iterator for iterating over our children.
- */
- typedef std::list<NestAtom::ConstPointer>::const_iterator Iterator;
-
- /**
- * Iterator to the start of our children.
- */
- Iterator begin() const
- {
- return _children.begin();
- }
-
- /**
- * Iterator to past the end of our children.
- */
- Iterator end() const
- {
- return _children.end();
- }
-
- typedef CountedPtr<CompositeNestAtom, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const CompositeNestAtom, count_policy::InternalCountTag> ConstPointer;
- };
-
- /**
- * Represents a ( first second third ) or top level group of nest
- * atoms.
- *
- * \ingroup DepResolver
- */
- class AllNestAtom :
- public CompositeNestAtom,
- public Visitable<AllNestAtom, NestAtomVisitorTypes>
- {
- public:
- /**
- * Constructor.
- */
- AllNestAtom();
- };
-
- /**
- * Represents a use? ( ) dependency atom.
- *
- * \ingroup DepResolver
- */
- class UseNestAtom :
- public CompositeNestAtom,
- public Visitable<UseNestAtom, NestAtomVisitorTypes>
- {
- private:
- const UseFlagName _flag;
- const bool _inverse;
-
- public:
- /**
- * Constructor.
- */
- UseNestAtom(const UseFlagName &, bool);
-
- /**
- * Fetch our use flag name.
- */
- const UseFlagName & flag() const
- {
- return _flag;
- }
-
- /**
- * Fetch whether we are a ! flag.
- */
- bool inverse() const
- {
- return _inverse;
- }
-
- virtual const UseNestAtom * as_use_nest_atom() const PALUDIS_ATTRIBUTE((pure));
- };
-
- /**
- * A TextNestAtom represents a text entry (for example, a URL for
- * SRC_URI).
- *
- * \ingroup DepResolver
- */
- class TextNestAtom :
- public NestAtom,
- public Visitable<TextNestAtom, NestAtomVisitorTypes>
- {
- private:
- std::string _text;
-
- public:
- TextNestAtom(const std::string & text);
-
- /**
- * Destructor.
- */
- ~TextNestAtom();
-
- /**
- * Fetch the package name.
- */
- const std::string & text() const
- {
- return _text;
- }
-
- typedef CountedPtr<TextNestAtom, count_policy::InternalCountTag> Pointer;
- typedef CountedPtr<const TextNestAtom, count_policy::InternalCountTag> ConstPointer;
- };
-
-}
-
-#endif
diff --git a/paludis/nest_parser.cc b/paludis/nest_parser.cc
deleted file mode 100644
index c18e70a..0000000
--- a/paludis/nest_parser.cc
+++ /dev/null
@@ -1,212 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include "exception.hh"
-#include "stringify.hh"
-#include "nest_atom.hh"
-#include "nest_parser.hh"
-#include "dep_lexer.hh"
-#include <stack>
-
-using namespace paludis;
-
-NestStringParseError::NestStringParseError(const std::string & d,
- const std::string & m) throw () :
- DepStringError(d, "in nest parse phase: " + m)
-{
-}
-
-NestStringNestingError::NestStringNestingError(const std::string & dep_string) throw () :
- NestStringParseError(dep_string, "improperly balanced parentheses")
-{
-}
-
-enum NestParserState
-{
- nps_initial,
- nps_had_paren,
- nps_had_use_flag,
- nps_had_use_flag_space
-};
-
-CompositeNestAtom::ConstPointer
-NestParser::parse(const std::string & s)
-{
- Context context("When parsing nest string '" + s + "':");
-
- std::stack<CompositeNestAtom::Pointer> stack;
- stack.push(CompositeNestAtom::Pointer(new AllNestAtom));
-
- NestParserState state(nps_initial);
- DepLexer lexer(s);
- DepLexer::Iterator i(lexer.begin()), i_end(lexer.end());
-
- for ( ; i != i_end ; ++i)
- {
- Context context("When handling lexer token '" + i->second +
- "' (" + stringify(i->first) + "):");
- do
- {
- switch (state)
- {
- case nps_initial:
- do
- {
- switch (i->first)
- {
- case dpl_whitespace:
- continue;
-
- case dpl_text:
- {
- if (i->second.empty())
- throw NestStringParseError(i->second, "Empty item name");
- stack.top()->add_child(NestAtom::Pointer(
- new TextNestAtom(i->second)));
- }
- continue;
-
- case dpl_open_paren:
- {
- CompositeNestAtom::Pointer a(new AllNestAtom);
- stack.top()->add_child(a);
- stack.push(a);
- state = nps_had_paren;
- }
- continue;
-
- case dpl_close_paren:
- if (stack.empty())
- throw NestStringNestingError(s);
- stack.pop();
- if (stack.empty())
- throw NestStringNestingError(s);
- state = nps_had_paren;
- continue;
-
- case dpl_double_bar:
- throw NestStringParseError(s, "|| not allowed");
-
- case dpl_use_flag:
- {
- std::string f(i->second);
- bool inv(f.length() && ('!' == f.at(0)));
- if (inv)
- f.erase(0, 1);
-
- if (f.empty())
- throw NestStringParseError(s,
- "Bad use flag name '" + i->second + "'");
- if ('?' != f.at(f.length() - 1))
- throw NestStringParseError(s,
- "Use flag name '" + i->second + "' missing '?'");
-
- f.erase(f.length() - 1);
- CompositeNestAtom::Pointer a(
- new UseNestAtom(UseFlagName(f), inv));
- stack.top()->add_child(a);
- stack.push(a);
- state = nps_had_use_flag;
- }
- continue;
-
- }
- throw InternalError(PALUDIS_HERE,
- "nps_initial: i->first is " + stringify(i->first));
-
- } while (0);
- continue;
-
- case nps_had_paren:
- do
- {
- switch (i->first)
- {
- case dpl_whitespace:
- state = nps_initial;
- continue;
-
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_open_paren:
- case dpl_close_paren:
- throw NestStringParseError(s, "Expected space after '(' or ')'");
- }
- throw InternalError(PALUDIS_HERE,
- "nps_had_paren: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case nps_had_use_flag:
- do
- {
- switch (i->first)
- {
- case dpl_whitespace:
- state = nps_had_use_flag_space;
- continue;
-
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_open_paren:
- case dpl_close_paren:
- throw NestStringParseError(s, "Expected space after use flag");
- }
- throw InternalError(PALUDIS_HERE,
- "nps_had_use_flag: i->first is " + stringify(i->first));
- } while (0);
- continue;
-
- case nps_had_use_flag_space:
- do
- {
- switch (i->first)
- {
- case dpl_open_paren:
- state = nps_had_paren;
- continue;
-
- case dpl_whitespace:
- case dpl_text:
- case dpl_use_flag:
- case dpl_double_bar:
- case dpl_close_paren:
- throw NestStringParseError(s, "Expected '(' after use flag");
- }
- throw InternalError(PALUDIS_HERE,
- "nps_had_use_flag_space: i->first is " + stringify(i->first));
- } while (0);
- continue;
- }
- throw InternalError(PALUDIS_HERE,
- "state is " + stringify(state));
-
- } while (0);
- }
-
- if (stack.empty())
- throw NestStringNestingError(s);
- CompositeNestAtom::Pointer result(stack.top());
- stack.pop();
- if (! stack.empty())
- throw NestStringNestingError(s);
- return result;
-}
diff --git a/paludis/nest_parser.hh b/paludis/nest_parser.hh
deleted file mode 100644
index 1554393..0000000
--- a/paludis/nest_parser.hh
+++ /dev/null
@@ -1,85 +0,0 @@
-/* vim: set sw=4 sts=4 et foldmethod=syntax : */
-
-/*
- * Copyright (c) 2005, 2006 Ciaran McCreesh <ciaranm@gentoo.org>
- *
- * This file is part of the Paludis package manager. Paludis is free software;
- * you can redistribute it and/or modify it under the terms of the GNU General
- * Public License version 2, as published by the Free Software Foundation.
- *
- * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- * details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef PALUDIS_GUARD_PALUDIS_NEST_PARSER_HH
-#define PALUDIS_GUARD_PALUDIS_NEST_PARSER_HH 1
-
-#include <paludis/nest_atom.hh>
-#include <paludis/counted_ptr.hh>
-#include <paludis/instantiation_policy.hh>
-#include <paludis/exception.hh>
-#include <paludis/dep_lexer.hh>
-#include <string>
-
-/** \file
- * Declarations for the NestParser class.
- *
- * \ingroup DepResolver
- * \ingroup Exception
- */
-
-namespace paludis
-{
- /**
- * A NestStringParseError is thrown if an error is encountered when parsing
- * a dependency string.
- *
- * \ingroup Exception
- * \ingroup DepResolver
- */
- class NestStringParseError : public DepStringError
- {
- public:
- /**
- * Constructor.
- */
- NestStringParseError(const std::string & dep_string,
- const std::string & message) throw ();
- };
-
- /**
- * A NestStringNestingError is thrown if a dependency string does not have
- * properly balanced parentheses.
- */
- class NestStringNestingError : public NestStringParseError
- {
- public:
- /**
- * Constructor.
- */
- NestStringNestingError(const std::string & dep_string) throw ();
- };
-
- /**
- * The NestParser converts string representations of a reduced nested
- * string specification into a NestAtom instance.
- */
- class NestParser :
- private InstantiationPolicy<NestParser, instantiation_method::NonInstantiableTag>
- {
- public:
- /**
- * Parse a given dependency string, and return an appropriate
- * NestAtom tree.
- */
- static CompositeNestAtom::ConstPointer parse(const std::string & s);
- };
-}
-
-#endif
diff --git a/paludis/qa/dep_any_check.cc b/paludis/qa/dep_any_check.cc
index 7882a8f..c43a839 100644
--- a/paludis/qa/dep_any_check.cc
+++ b/paludis/qa/dep_any_check.cc
@@ -76,10 +76,18 @@ namespace
std::for_each(u->begin(), u->end(), accept_visitor(this));
}
+ void visit(const PlainTextDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+
void visit(const BlockDepAtom * const)
{
}
};
+
+ void Checker::visit(const PlainTextDepAtom * const t)
+ {
+ throw InternalError(PALUDIS_HERE, "Found unexpected PlainTextDepAtom '"
+ + t->text() + "'");
+ }
}
DepAnyCheck::DepAnyCheck()
diff --git a/paludis/qa/dep_flags_check.cc b/paludis/qa/dep_flags_check.cc
index 9372ad6..62dda03 100644
--- a/paludis/qa/dep_flags_check.cc
+++ b/paludis/qa/dep_flags_check.cc
@@ -20,8 +20,7 @@
#include "dep_flags_check.hh"
#include <paludis/dep_parser.hh>
#include <paludis/dep_atom.hh>
-#include <paludis/nest_parser.hh>
-#include <paludis/nest_atom.hh>
+#include <paludis/dep_parser.hh>
using namespace paludis;
using namespace paludis::qa;
@@ -29,8 +28,7 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- DepAtomVisitorTypes::ConstVisitor,
- NestAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor
{
CheckResult & result;
const std::string role;
@@ -65,8 +63,14 @@ namespace
if (env->package_database()->fetch_repository(env->package_database()->
favourite_repository())->is_arch_flag(u->flag()))
{
- if (u->inverse())
- result << Message(qal_maybe, "Inverse arch flag '" + stringify(u->flag()) +
+ if (role == "DEPEND" || role == "RDEPEND" || role == "PDEPEND")
+ {
+ if (u->inverse())
+ result << Message(qal_maybe, "Inverse arch flag '" + stringify(u->flag()) +
+ "' in " + role);
+ }
+ else if (role != "SRC_URI")
+ result << Message(qal_major, "Arch flag '" + stringify(u->flag()) +
"' in " + role);
}
else if (env->package_database()->fetch_repository(env->package_database()->
@@ -80,37 +84,12 @@ namespace
std::for_each(u->begin(), u->end(), accept_visitor(this));
}
- void visit(const BlockDepAtom * const)
+ void visit(const PlainTextDepAtom * const)
{
}
- void visit(const TextNestAtom * const)
- {
- }
-
- void visit(const AllNestAtom * const a)
- {
- std::for_each(a->begin(), a->end(), accept_visitor(this));
- }
-
- void visit(const UseNestAtom * const u)
+ void visit(const BlockDepAtom * const)
{
- if (env->package_database()->fetch_repository(env->package_database()->
- favourite_repository())->is_arch_flag(u->flag()))
- {
- if (role != "SRC_URI")
- result << Message(qal_major, "Arch flag '" + stringify(u->flag()) +
- "' in " + role);
- }
- else if (env->package_database()->fetch_repository(env->package_database()->
- favourite_repository())->is_expand_flag(u->flag()))
- {
- }
- else if (iuse.end() == iuse.find(u->flag()))
- result << Message(qal_major, "Conditional flag '" + stringify(u->flag()) +
- "' in " + role + " not in IUSE");
-
- std::for_each(u->begin(), u->end(), accept_visitor(this));
}
};
}
@@ -150,15 +129,15 @@ DepFlagsCheck::operator() (const EbuildCheckData & e) const
Checker provide_checker(result, "PROVIDE", e.get<ecd_environment>(), iuse);
std::string provide(metadata->get(vmk_provide));
- NestParser::parse(provide)->accept(&provide_checker);
+ DepParser::parse(provide, DepParserPolicy<PackageDepAtom, false>::get_instance())->accept(&provide_checker);
Checker license_checker(result, "LICENSE", e.get<ecd_environment>(), iuse);
std::string license(metadata->get(vmk_license));
- NestParser::parse(license)->accept(&license_checker);
+ DepParser::parse(license, DepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&license_checker);
Checker src_uri_checker(result, "SRC_URI", e.get<ecd_environment>(), iuse);
std::string src_uri(metadata->get(vmk_src_uri));
- NestParser::parse(src_uri)->accept(&src_uri_checker);
+ DepParser::parse(src_uri, DepParserPolicy<PlainTextDepAtom, true>::get_instance())->accept(&src_uri_checker);
}
catch (const InternalError &)
{
diff --git a/paludis/qa/dep_packages_check.cc b/paludis/qa/dep_packages_check.cc
index 886e8ee..002f558 100644
--- a/paludis/qa/dep_packages_check.cc
+++ b/paludis/qa/dep_packages_check.cc
@@ -62,6 +62,10 @@ namespace
std::for_each(u->begin(), u->end(), accept_visitor(this));
}
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
+
void visit(const BlockDepAtom * const)
{
}
diff --git a/paludis/qa/deps_exist_check.cc b/paludis/qa/deps_exist_check.cc
index fdcccfa..0ae6149 100644
--- a/paludis/qa/deps_exist_check.cc
+++ b/paludis/qa/deps_exist_check.cc
@@ -79,6 +79,10 @@ namespace
result << Message(qal_maybe, "No match for " + role + " block '!"
+ stringify(*b->blocked_atom()) + "'");
}
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
};
}
diff --git a/paludis/qa/deps_visible_check.cc b/paludis/qa/deps_visible_check.cc
index b5e96f4..8a10e75 100644
--- a/paludis/qa/deps_visible_check.cc
+++ b/paludis/qa/deps_visible_check.cc
@@ -76,6 +76,10 @@ namespace
void visit(const BlockDepAtom * const)
{
}
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
};
}
diff --git a/paludis/qa/license_check.cc b/paludis/qa/license_check.cc
index d09856b..2e6a050 100644
--- a/paludis/qa/license_check.cc
+++ b/paludis/qa/license_check.cc
@@ -18,8 +18,8 @@
*/
#include "license_check.hh"
-#include <paludis/nest_atom.hh>
-#include <paludis/nest_parser.hh>
+#include <paludis/dep_atom.hh>
+#include <paludis/dep_parser.hh>
#include <paludis/tokeniser.hh>
using namespace paludis;
@@ -28,7 +28,7 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- NestAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor
{
CheckResult & result;
const Environment * const env;
@@ -39,23 +39,43 @@ namespace
{
}
- void visit(const TextNestAtom * const a)
+ void visit(const PlainTextDepAtom * const a)
{
if (! env->package_database()->fetch_repository(
env->package_database()->favourite_repository())->is_license(a->text()))
result << Message(qal_major, "Item '" + a->text() + "' is not a licence");
}
- void visit(const AllNestAtom * const a)
+ void visit(const AllDepAtom * const a)
{
std::for_each(a->begin(), a->end(), accept_visitor(this));
}
- void visit(const UseNestAtom * const u)
+ void visit(const AnyDepAtom * const a)
+ {
+ std::for_each(a->begin(), a->end(), accept_visitor(this));
+ }
+
+ void visit(const UseDepAtom * const u)
{
std::for_each(u->begin(), u->end(), accept_visitor(this));
}
+
+ void visit(const BlockDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const PackageDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
};
+
+ void
+ Checker::visit(const BlockDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected BlockDepAtom");
+ }
+
+ void
+ Checker::visit(const PackageDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected PackageDepAtom");
+ }
}
LicenseCheck::LicenseCheck()
@@ -79,10 +99,11 @@ LicenseCheck::operator() (const EbuildCheckData & e) const
std::string license(metadata->get(vmk_license));
- NestAtom::ConstPointer license_parts(0);
+ DepAtom::ConstPointer license_parts(0);
try
{
- license_parts = NestParser::parse(license);
+ license_parts = DepParser::parse(license,
+ DepParserPolicy<PlainTextDepAtom, true>::get_instance());
Checker checker(result, e.get<ecd_environment>());
license_parts->accept(&checker);
diff --git a/paludis/qa/pdepend_overlap_check.cc b/paludis/qa/pdepend_overlap_check.cc
index 840e632..88aa070 100644
--- a/paludis/qa/pdepend_overlap_check.cc
+++ b/paludis/qa/pdepend_overlap_check.cc
@@ -59,6 +59,10 @@ namespace
void visit(const BlockDepAtom * const)
{
}
+
+ void visit(const PlainTextDepAtom * const)
+ {
+ }
};
}
diff --git a/paludis/qa/src_uri_check.cc b/paludis/qa/src_uri_check.cc
index 12501a9..e18506c 100644
--- a/paludis/qa/src_uri_check.cc
+++ b/paludis/qa/src_uri_check.cc
@@ -18,8 +18,8 @@
*/
#include "src_uri_check.hh"
-#include <paludis/nest_atom.hh>
-#include <paludis/nest_parser.hh>
+#include <paludis/dep_atom.hh>
+#include <paludis/dep_parser.hh>
#include <paludis/tokeniser.hh>
using namespace paludis;
@@ -28,7 +28,7 @@ using namespace paludis::qa;
namespace
{
struct Checker :
- NestAtomVisitorTypes::ConstVisitor
+ DepAtomVisitorTypes::ConstVisitor
{
CheckResult & result;
bool fetch_restrict;
@@ -39,7 +39,7 @@ namespace
{
}
- void visit(const TextNestAtom * const a)
+ void visit(const PlainTextDepAtom * const a)
{
if (a->text().empty())
return;
@@ -66,16 +66,37 @@ namespace
result << Message(qal_major, "Unreliable host for '" + a->text() + "'");
}
- void visit(const AllNestAtom * const a)
+ void visit(const AllDepAtom * const a)
{
std::for_each(a->begin(), a->end(), accept_visitor(this));
}
- void visit(const UseNestAtom * const u)
+ void visit(const UseDepAtom * const u)
{
std::for_each(u->begin(), u->end(), accept_visitor(this));
}
+
+ void visit(const AnyDepAtom * const u)
+ {
+ result << Message(qal_major, "Unexpected || dep block");
+ std::for_each(u->begin(), u->end(), accept_visitor(this));
+ }
+
+ void visit(const BlockDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
+ void visit(const PackageDepAtom * const) PALUDIS_ATTRIBUTE((noreturn));
};
+
+ void
+ Checker::visit(const BlockDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected BlockDepAtom");
+ }
+
+ void
+ Checker::visit(const PackageDepAtom * const)
+ {
+ throw InternalError(PALUDIS_HERE, "Unexpected PackageDepAtom");
+ }
}
SrcUriCheck::SrcUriCheck()
@@ -99,10 +120,11 @@ SrcUriCheck::operator() (const EbuildCheckData & e) const
std::string src_uri(metadata->get(vmk_src_uri));
- NestAtom::ConstPointer src_uri_parts(0);
+ DepAtom::ConstPointer src_uri_parts(0);
try
{
- src_uri_parts = NestParser::parse(src_uri);
+ src_uri_parts = DepParser::parse(src_uri,
+ DepParserPolicy<PlainTextDepAtom, false>::get_instance());
std::set<std::string> restricts;
Tokeniser<delim_kind::AnyOfTag, delim_mode::DelimiterTag> tokeniser(" \t\n");