aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 13:20:30 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2007-08-07 13:20:30 +0000
commit2d6aff791cebf7b5e7a00f32d47951e85027be32 (patch)
tree09ca76ef67ae7f27cf5b51d28cef70a2a0a875cb
parenta64f67d422afb13a94d0dd8e2653a025ee046d82 (diff)
downloadpaludis-2d6aff791cebf7b5e7a00f32d47951e85027be32.tar.gz
paludis-2d6aff791cebf7b5e7a00f32d47951e85027be32.tar.xz
More verbose messages for metadata generation failure
-rw-r--r--paludis/repositories/e/ebuild.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 37cd16d..cdc01bc 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -30,6 +30,8 @@
#include <paludis/util/sequence.hh>
#include <paludis/util/options.hh>
#include <paludis/util/map.hh>
+#include <paludis/util/join.hh>
+#include <paludis/util/tokeniser.hh>
#include <paludis/about.hh>
#include <paludis/environment.hh>
@@ -45,6 +47,8 @@
#include <libwrapiter/libwrapiter_forward_iterator.hh>
#include <libwrapiter/libwrapiter_output_iterator.hh>
+#include <list>
+
#include "config.h"
/** \file
@@ -241,18 +245,31 @@ EbuildMetadataCommand::extend_command(const Command & cmd)
stringify(params.package_id->version()) + "> ");
}
+namespace
+{
+ std::string purdy(const std::string & s)
+ {
+ std::list<std::string> tokens;
+ WhitespaceTokeniser::get_instance()->tokenise(s, std::back_inserter(tokens));
+ return join(tokens.begin(), tokens.end(), " \\n ");
+ }
+}
+
bool
EbuildMetadataCommand::do_run_command(const Command & cmd)
{
bool ok(false);
keys.reset(new Map<std::string, std::string>);
+ std::string input;
try
{
Context context("When generating metadata for '" + stringify(*params.package_id) + "':");
PStream prog(cmd);
- KeyValueConfigFile f(prog, KeyValueConfigFileOptions() + kvcfo_disallow_continuations + kvcfo_disallow_comments
+ input.assign((std::istreambuf_iterator<char>(prog)), std::istreambuf_iterator<char>());
+ std::stringstream input_stream(input);
+ KeyValueConfigFile f(input_stream, KeyValueConfigFileOptions() + kvcfo_disallow_continuations + kvcfo_disallow_comments
+ kvcfo_disallow_space_around_equals + kvcfo_disallow_unquoted_values + kvcfo_disallow_source
+ kvcfo_disallow_variables + kvcfo_preserve_whitespace);
@@ -264,7 +281,7 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
{
Log::get_instance()->message(ll_warning, lc_context, "Caught exception '" +
stringify(e.message()) + "' (" + stringify(e.what()) +
- ") when generating cache for '" + stringify(*params.package_id) + "'");
+ ") when generating cache for '" + stringify(*params.package_id) + "', input is '" + purdy(input) + "'");
}
if (ok)