aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-09 18:21:37 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-09 18:21:37 +0000
commit0b0c861333c94df393b0b12677867fb850c5ff9d (patch)
tree95fa5a2bb4eeb523ca841fbacbed99431e136b86
parent0083f4e56d78bfff25782cb2af63ece6f47efee6 (diff)
downloadpaludis-0b0c861333c94df393b0b12677867fb850c5ff9d.tar.gz
paludis-0b0c861333c94df393b0b12677867fb850c5ff9d.tar.xz
Make QAMessage::with_associated_key take the PackageID as well as the MetadataKey.
-rw-r--r--paludis/qa.cc5
-rwxr-xr-x[-rw-r--r--]paludis/qa.sr4
-rw-r--r--paludis/repositories/e/qa/extractors.cc6
-rw-r--r--paludis/repositories/e/qa/homepage_key.cc4
-rw-r--r--paludis/repositories/e/qa/metadata_keys.cc2
-rw-r--r--paludis/repositories/e/qa/qa_controller.cc2
-rw-r--r--paludis/repositories/e/qa/short_description_key.cc10
-rw-r--r--paludis/repositories/e/qa/spec_keys.cc28
-rw-r--r--paludis/repositories/e/qa/visibility.cc6
-rw-r--r--src/clients/qualudis/qualudis.cc13
10 files changed, 39 insertions, 41 deletions
diff --git a/paludis/qa.cc b/paludis/qa.cc
index e640742..6c5ccd6 100644
--- a/paludis/qa.cc
+++ b/paludis/qa.cc
@@ -54,9 +54,10 @@ QAMessage::with_associated_id(const tr1::shared_ptr<const PackageID> & id)
}
QAMessage &
-QAMessage::with_associated_key(const tr1::shared_ptr<const MetadataKey> & k)
+QAMessage::with_associated_key(const tr1::shared_ptr<const PackageID> & id,
+ const tr1::shared_ptr<const MetadataKey> & k)
{
- associated_keys->push_back(k);
+ associated_keys->push_back(std::make_pair(id, k));
return *this;
}
diff --git a/paludis/qa.sr b/paludis/qa.sr
index 12d8314..fb4290d 100644..100755
--- a/paludis/qa.sr
+++ b/paludis/qa.sr
@@ -5,7 +5,7 @@ make_class_QAMessage()
{
visible
- typedef "Sequence<tr1::shared_ptr<const MetadataKey> > KeysSequence"
+ typedef "Sequence<std::pair<tr1::shared_ptr<const PackageID>, tr1::shared_ptr<const MetadataKey> > > KeysSequence"
key entry "FSEntry"
key level "QAMessageLevel"
@@ -18,7 +18,7 @@ make_class_QAMessage()
static tr1::shared_ptr<PackageIDSet> default_associated_ids();
static tr1::shared_ptr<KeysSequence> default_associated_keys();
QAMessage & with_associated_id(const tr1::shared_ptr<const PackageID> &);
- QAMessage & with_associated_key(const tr1::shared_ptr<const MetadataKey> &);
+ QAMessage & with_associated_key(const tr1::shared_ptr<const PackageID> &, const tr1::shared_ptr<const MetadataKey> &);
END
allow_named_args
diff --git a/paludis/repositories/e/qa/extractors.cc b/paludis/repositories/e/qa/extractors.cc
index e072372..b567d4c 100644
--- a/paludis/repositories/e/qa/extractors.cc
+++ b/paludis/repositories/e/qa/extractors.cc
@@ -274,7 +274,7 @@ paludis::erepository::extractors_check(
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->fetches_key()));
+ .with_associated_key(id, id->fetches_key()));
continue;
}
@@ -387,7 +387,7 @@ paludis::erepository::extractors_check(
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->fetches_key()));
+ .with_associated_key(id, id->fetches_key()));
}
}
}
@@ -397,7 +397,7 @@ paludis::erepository::extractors_check(
"Caught exception '" + stringify(e.message()) + "' ("
+ stringify(e.what()) + ") when handling key '" + id->fetches_key()->raw_name() + "'")
.with_associated_id(id)
- .with_associated_key(id->fetches_key()));
+ .with_associated_key(id, id->fetches_key()));
}
}
diff --git a/paludis/repositories/e/qa/homepage_key.cc b/paludis/repositories/e/qa/homepage_key.cc
index f16507c..a6b1f42 100644
--- a/paludis/repositories/e/qa/homepage_key.cc
+++ b/paludis/repositories/e/qa/homepage_key.cc
@@ -68,7 +68,7 @@ namespace
if (! found_one)
reporter.message(QAMessage(entry, qaml_normal, name, "Homepage specifies no URIs")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
void visit_leaf(const SimpleURIDepSpec & u)
@@ -81,7 +81,7 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name,
"Homepage uses no or unknown protocol in part '" + u.text() + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
};
}
diff --git a/paludis/repositories/e/qa/metadata_keys.cc b/paludis/repositories/e/qa/metadata_keys.cc
index 803b45c..a1cc102 100644
--- a/paludis/repositories/e/qa/metadata_keys.cc
+++ b/paludis/repositories/e/qa/metadata_keys.cc
@@ -167,7 +167,7 @@ paludis::erepository::metadata_keys_check(
"Caught exception '" + stringify(e.message()) + "' ("
+ stringify(e.what()) + ") when handling key '" + (*it)->raw_name() + "'")
.with_associated_id(id)
- .with_associated_key(*it));
+ .with_associated_key(id, *it));
}
}
diff --git a/paludis/repositories/e/qa/qa_controller.cc b/paludis/repositories/e/qa/qa_controller.cc
index 2c205d2..2c8cb44 100644
--- a/paludis/repositories/e/qa/qa_controller.cc
+++ b/paludis/repositories/e/qa/qa_controller.cc
@@ -302,7 +302,7 @@ QAController::_check_id(const tr1::shared_ptr<const PackageID> & i)
QAMessage(_imp->repo->layout()->package_file(*i), qaml_severe, "check_id",
"Couldn't get file contents for ID '" + stringify(*i) + ")")
.with_associated_id(i)
- .with_associated_key(i->fs_location_key()));
+ .with_associated_key(i, i->fs_location_key()));
else
std::find_if(
QAChecks::get_instance()->package_id_file_contents_checks_group()->begin(),
diff --git a/paludis/repositories/e/qa/short_description_key.cc b/paludis/repositories/e/qa/short_description_key.cc
index e4ebb2b..85fa3ee 100644
--- a/paludis/repositories/e/qa/short_description_key.cc
+++ b/paludis/repositories/e/qa/short_description_key.cc
@@ -41,25 +41,25 @@ paludis::erepository::short_description_key_check(
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->short_description_key()));
+ .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->short_description_key()));
+ .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->short_description_key()));
+ .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->short_description_key()));
+ .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->short_description_key()));
+ .with_associated_key(id, id->short_description_key()));
return true;
}
diff --git a/paludis/repositories/e/qa/spec_keys.cc b/paludis/repositories/e/qa/spec_keys.cc
index 3e9b766..7374774 100644
--- a/paludis/repositories/e/qa/spec_keys.cc
+++ b/paludis/repositories/e/qa/spec_keys.cc
@@ -121,7 +121,7 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name, "Package '" + stringify(p)
+ "' blacklisted in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
}
@@ -131,7 +131,7 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name, "'|| ( )' with block child '!"
+ stringify(*b.blocked_spec()) + "' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
void visit_leaf(const SimpleURIDepSpec &)
@@ -171,14 +171,14 @@ namespace
"'|| ( )' with 'use? ( )' child in '"
+ stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
if (uses.count(u.flag()))
reporter.message(QAMessage(entry, qaml_normal, name,
"Recursive use of flag '" + stringify(u.flag()) + "' in '"
+ stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
Save<unsigned> save_level(&level, level + 1);
Save<bool> save_child_of_any(&child_of_any, false);
@@ -188,7 +188,7 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name,
"Empty 'use? ( )' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
else
std::for_each(cur, end, accept_visitor(*this));
}
@@ -205,7 +205,7 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name,
"Empty '( )' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
else
std::for_each(cur, end, accept_visitor(*this));
@@ -221,14 +221,14 @@ namespace
reporter.message(QAMessage(entry, qaml_normal, name,
"Empty '|| ( )' in '" + stringify(key->raw_name()) + "'")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
else if (next(cur) == end)
{
cur->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(key));
+ .with_associated_key(id, key));
}
else
std::for_each(cur, end, accept_visitor(*this));
@@ -333,7 +333,7 @@ namespace
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(key));
+ .with_associated_key(id, key));
}
}
@@ -350,7 +350,7 @@ namespace
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(key));
+ .with_associated_key(id, key));
}
}
@@ -367,7 +367,7 @@ namespace
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(key));
+ .with_associated_key(id, key));
}
}
@@ -384,7 +384,7 @@ namespace
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(key));
+ .with_associated_key(id, key));
}
}
@@ -401,7 +401,7 @@ namespace
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(key));
+ .with_associated_key(id, key));
}
}
@@ -418,7 +418,7 @@ namespace
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(key));
+ .with_associated_key(id, key));
}
}
};
diff --git a/paludis/repositories/e/qa/visibility.cc b/paludis/repositories/e/qa/visibility.cc
index 5d18fa8..87736cc 100644
--- a/paludis/repositories/e/qa/visibility.cc
+++ b/paludis/repositories/e/qa/visibility.cc
@@ -146,7 +146,7 @@ namespace
+ stringify(profile->path) + "' (" + stringify(profile->arch) + "." + stringify(profile->status)
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
else
{
@@ -192,7 +192,7 @@ namespace
+ stringify(profile->path) + "' (" + stringify(profile->arch) + "." + stringify(profile->status)
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
}
@@ -239,7 +239,7 @@ namespace
+ stringify(profile->path) + "' (" + stringify(profile->arch) + "." + stringify(profile->status)
+ (unstable ? ".unstable" : ".stable") + ")")
.with_associated_id(id)
- .with_associated_key(key));
+ .with_associated_key(id, key));
}
}
}
diff --git a/src/clients/qualudis/qualudis.cc b/src/clients/qualudis/qualudis.cc
index 5f6f34b..039717e 100644
--- a/src/clients/qualudis/qualudis.cc
+++ b/src/clients/qualudis/qualudis.cc
@@ -35,6 +35,7 @@
#include <cstdlib>
#include <iostream>
#include <algorithm>
+#include <map>
#include <set>
#include "qualudis_command_line.hh"
@@ -173,7 +174,7 @@ namespace
std::string previous_name;
bool show_keys, show_keys_once;
- std::set<const MetadataKey *> printed_keys;
+ std::map<tr1::shared_ptr<const PackageID>, std::set<std::string>, PackageIDSetComparator> printed_keys;
QualudisReporter(const std::string & show_associated_keys) :
previous_entry("/NONE"),
@@ -241,17 +242,13 @@ namespace
for (QAMessage::KeysSequence::ConstIterator i(msg.associated_keys->begin()),
i_end(msg.associated_keys->end()) ; i != i_end ; ++i)
{
- if (show_keys_once)
- {
- if (printed_keys.end() != printed_keys.find(&**i))
- continue;
- printed_keys.insert(&**i);
- }
+ if (show_keys_once && ! printed_keys[i->first].insert(i->second->raw_name()).second)
+ continue;
try
{
MetadataKeyPrettyPrinter pp;
- (*i)->accept(pp);
+ i->second->accept(pp);
std::cout << " " << pp.stream.str();
}
catch (const Exception &)