aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-09-02 18:42:59 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-09-02 18:42:59 +0000
commitd4e6b01a56f4222e274d14633f363eb22fc6e370 (patch)
tree8b2b3831808f9ad5ce948f2f1002f1496d4a58c4
parentaacf415f9ebb785f313f66a7dcf09192580adc58 (diff)
downloadpaludis-d4e6b01a56f4222e274d14633f363eb22fc6e370.tar.gz
paludis-d4e6b01a56f4222e274d14633f363eb22fc6e370.tar.xz
Report an error for a malformed dep string.
-rw-r--r--src/clients/instruo/instruo.cc98
1 files changed, 97 insertions, 1 deletions
diff --git a/src/clients/instruo/instruo.cc b/src/clients/instruo/instruo.cc
index 2c0fafc..53cabb1 100644
--- a/src/clients/instruo/instruo.cc
+++ b/src/clients/instruo/instruo.cc
@@ -117,6 +117,85 @@ namespace
{
}
};
+
+ struct KeyValidator :
+ ConstVisitor<MetadataKeyVisitorTypes>
+ {
+ void visit(const MetadataStringKey & k)
+ {
+ const std::string & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
+ void visit(const MetadataPackageIDKey & k)
+ {
+ const 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 MetadataContentsKey & k)
+ {
+ const tr1::shared_ptr<const Contents> & PALUDIS_ATTRIBUTE((unused)) c(k.value());
+ }
+
+ void visit(const MetadataRepositoryMaskInfoKey & k)
+ {
+ const tr1::shared_ptr<const RepositoryMaskInfo> & PALUDIS_ATTRIBUTE((unused)) i(k.value());
+ }
+
+ void visit(const MetadataSpecTreeKey<RestrictSpecTree> & k)
+ {
+ const tr1::shared_ptr<RestrictSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
+ void visit(const MetadataSpecTreeKey<ProvideSpecTree> & k)
+ {
+ const tr1::shared_ptr<ProvideSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
+ void visit(const MetadataSpecTreeKey<URISpecTree> & k)
+ {
+ const tr1::shared_ptr<URISpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
+ void visit(const MetadataSpecTreeKey<LicenseSpecTree> & k)
+ {
+ const tr1::shared_ptr<LicenseSpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
+ void visit(const MetadataSpecTreeKey<DependencySpecTree> & k)
+ {
+ const tr1::shared_ptr<DependencySpecTree::ConstItem> & PALUDIS_ATTRIBUTE((unused)) t(k.value());
+ }
+
+ void visit(const MetadataSetKey<PackageIDSequence> & k)
+ {
+ const tr1::shared_ptr<const PackageIDSequence> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
+ void visit(const MetadataSetKey<InheritedSet> & k)
+ {
+ const tr1::shared_ptr<const InheritedSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
+ void visit(const MetadataSetKey<KeywordNameSet> & k)
+ {
+ const tr1::shared_ptr<const KeywordNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
+ void visit(const MetadataSetKey<IUseFlagSet> & k)
+ {
+ const tr1::shared_ptr<const IUseFlagSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+
+ void visit(const MetadataSetKey<UseFlagNameSet> & k)
+ {
+ const tr1::shared_ptr<const UseFlagNameSet> & PALUDIS_ATTRIBUTE((unused)) s(k.value());
+ }
+ };
}
int
@@ -254,7 +333,24 @@ main(int argc, char *argv[])
continue;
}
- ++success;
+ bool metadata_errors(false);
+ KeyValidator v;
+ for (PackageID::MetadataIterator m((*i)->begin_metadata()),
+ m_end((*i)->end_metadata()); m_end != m; ++m)
+ {
+ try
+ {
+ (*m)->accept(v);
+ }
+ catch (const Exception & e)
+ {
+ results.insert(std::make_pair(*i, "Exception in metadata key '" + (*m)->raw_name() + "': '" + e.message() + "' (" + e.what() + ")"));
+ metadata_errors = true;
+ }
+ }
+
+ if (! metadata_errors)
+ ++success;
}
catch (const Exception & e)
{