aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-21 13:32:37 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-21 13:32:37 +0100
commita5d2a831ee32cb5fa1c111c4a9d1f21dbe7c7a3c (patch)
tree4d5d739572feb6c087390038c6a920b248728d21
parent7831d5e9fd75301156f72f7da4c8360ae29ed460 (diff)
downloadpaludis-a5d2a831ee32cb5fa1c111c4a9d1f21dbe7c7a3c.tar.gz
paludis-a5d2a831ee32cb5fa1c111c4a9d1f21dbe7c7a3c.tar.xz
cave verify wildcards
-rw-r--r--src/clients/cave/cmd_verify.cc40
-rw-r--r--src/clients/cave/formats.cc8
-rw-r--r--src/clients/cave/formats.hh1
3 files changed, 36 insertions, 13 deletions
diff --git a/src/clients/cave/cmd_verify.cc b/src/clients/cave/cmd_verify.cc
index 1ea19ea..196f12b 100644
--- a/src/clients/cave/cmd_verify.cc
+++ b/src/clients/cave/cmd_verify.cc
@@ -87,15 +87,26 @@ namespace
struct Verifier
{
+ const std::tr1::shared_ptr<const PackageID> id;
+
int exit_status;
+ bool done_heading;
- Verifier() :
- exit_status(0)
+ Verifier(const std::tr1::shared_ptr<const PackageID> & i) :
+ id(i),
+ exit_status(0),
+ done_heading(false)
{
}
void message(const FSEntry & path, const std::string & text)
{
+ if (! done_heading)
+ {
+ done_heading = true;
+ cout << format_general_s(f::verify_package(), stringify(*id));
+ }
+
exit_status |= 1;
cout << format_general_sr(f::verify_error(), text, stringify(path));
}
@@ -193,7 +204,7 @@ VerifyCommand::run(
throw args::DoHelp("verify takes exactly one parameter");
PackageDepSpec spec(parse_user_package_dep_spec(*cmdline.begin_parameters(), env.get(),
- UserPackageDepSpecOptions(), filter::InstalledAtRoot(env->root())));
+ UserPackageDepSpecOptions() + updso_allow_wildcards, filter::InstalledAtRoot(env->root())));
std::tr1::shared_ptr<const PackageIDSequence> entries(
(*env)[selection::AllVersionsSorted(generator::Matches(spec, MatchPackageOptions()) | filter::InstalledAtRoot(env->root()))]);
@@ -201,16 +212,21 @@ VerifyCommand::run(
if (entries->empty())
throw NothingMatching(spec);
- const std::tr1::shared_ptr<const PackageID> id(*entries->last());
- if (! id->contents_key())
- throw BadIDForCommand(spec, id, "does not support listing contents");
-
- Verifier v;
- std::for_each(indirect_iterator(id->contents_key()->value()->begin()),
- indirect_iterator(id->contents_key()->value()->end()),
- accept_visitor(v));
+ int exit_status(0);
+ for (PackageIDSequence::ConstIterator i(entries->begin()), i_end(entries->end()) ;
+ i != i_end ; ++i)
+ {
+ if (! (*i)->contents_key())
+ continue;
+
+ Verifier v(*i);
+ std::for_each(indirect_iterator((*i)->contents_key()->value()->begin()),
+ indirect_iterator((*i)->contents_key()->value()->end()),
+ accept_visitor(v));
+ exit_status |= v.exit_status;
+ }
- return v.exit_status;
+ return exit_status;
}
std::tr1::shared_ptr<args::ArgsHandler>
diff --git a/src/clients/cave/formats.cc b/src/clients/cave/formats.cc
index 5a3cd89..0cd515c 100644
--- a/src/clients/cave/formats.cc
+++ b/src/clients/cave/formats.cc
@@ -676,8 +676,14 @@ paludis::cave::f::executables_file()
}
const std::string
+paludis::cave::f::verify_package()
+{
+ return c::bold_blue_or_pink() + "%s" + c::normal() + "\\n";
+}
+
+const std::string
paludis::cave::f::verify_error()
{
- return c::bold_red() + "%s:" + c::normal() + "%{column 30}%r\\n";
+ return c::bold_red() + " %s:" + c::normal() + "%{column 32}%r\\n";
}
diff --git a/src/clients/cave/formats.hh b/src/clients/cave/formats.hh
index 1926296..66ade0f 100644
--- a/src/clients/cave/formats.hh
+++ b/src/clients/cave/formats.hh
@@ -170,6 +170,7 @@ namespace paludis
const std::string executables_file();
+ const std::string verify_package();
const std::string verify_error();
}
}