aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-23 00:14:01 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2008-08-23 00:14:01 +0100
commit33fd8ae2939ecc7f82788d7892936cb64089e700 (patch)
treea8a72674d85c289e332a4fd489edee54d38ee5e4
parentc0467d2f53a5929b225621ccf975dcc186146434 (diff)
downloadpaludis-33fd8ae2939ecc7f82788d7892936cb64089e700.tar.gz
paludis-33fd8ae2939ecc7f82788d7892936cb64089e700.tar.xz
stderr goes into a metadata key
Fixes: ticket:634
-rw-r--r--paludis/repositories/e/ebuild.cc18
-rw-r--r--paludis/repositories/e/ebuild.hh1
-rw-r--r--paludis/repositories/e/ebuild_id.cc9
-rw-r--r--paludis/repositories/e/ebuild_id.hh1
4 files changed, 25 insertions, 4 deletions
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 1870c4b..233a9aa 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -284,8 +284,7 @@ EbuildMetadataCommand::extend_command(const Command & cmd)
{
return Command(cmd)
.with_uid_gid(params.environment()->reduced_uid(), params.environment()->reduced_gid())
- .with_stderr_prefix(stringify(params.package_id()->name().package) + "-" +
- stringify(params.package_id()->version()) + "> ");
+ ;
}
namespace
@@ -309,9 +308,9 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
{
Context context("When running ebuild command to generate metadata for '" + stringify(*params.package_id()) + "':");
- std::stringstream prog;
+ std::stringstream prog, prog_err;
Command real_cmd(cmd);
- int exit_status(run_command(real_cmd.with_captured_stdout_stream(&prog)));
+ int exit_status(run_command(real_cmd.with_captured_stdout_stream(&prog).with_captured_stderr_stream(&prog_err)));
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
@@ -322,6 +321,8 @@ EbuildMetadataCommand::do_run_command(const Command & cmd)
std::copy(f.begin(), f.end(), keys->inserter());
if (0 == exit_status)
ok = true;
+
+ captured_stderr = prog_err.str();
}
catch (const InternalError &)
{
@@ -371,6 +372,10 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
Log::get_instance()->message("e.ebuild.preload_eapi.unsupported", ll_debug, lc_context)
<< "ID pre-load EAPI '" << id->eapi()->name() << "' not supported";
id->set_slot(SlotName("UNKNOWN"));
+
+ if (! captured_stderr.empty())
+ id->load_captured_stderr("STDERR", "Captured stderr", mkt_normal, captured_stderr);
+
return;
}
else
@@ -388,12 +393,17 @@ EbuildMetadataCommand::load(const std::tr1::shared_ptr<const EbuildID> & id)
Log::get_instance()->message("e.ebuild.postload_eapi.unsupported", ll_debug, lc_context)
<< "ID post-load EAPI '" << id->eapi()->name() << "' not supported";
id->set_slot(SlotName("UNKNOWN"));
+ if (! captured_stderr.empty())
+ id->load_captured_stderr("STDERR", "Captured stderr", mkt_normal, captured_stderr);
return;
}
else
Log::get_instance()->message("e.ebuild.postload_eapi.supported", ll_debug, lc_context)
<< "ID post-load EAPI '" << id->eapi()->name() << "' is supported";
+ if (! captured_stderr.empty())
+ id->load_captured_stderr("STDERR", "Captured stderr", mkt_internal, captured_stderr);
+
const EAPIEbuildMetadataVariables & m(*id->eapi()->supported()->ebuild_metadata_variables());
if (! m.short_description().name().empty())
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index ad27411..160495d 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -614,6 +614,7 @@ namespace paludis
{
private:
std::tr1::shared_ptr<Map<std::string, std::string> > keys;
+ std::string captured_stderr;
public:
EbuildMetadataCommand(const EbuildCommandParams &);
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 0cbef27..5abe2ca 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -75,6 +75,7 @@ namespace paludis
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<FSEntry> > fs_location;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > short_description;
mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > long_description;
+ mutable std::tr1::shared_ptr<const LiteralMetadataValueKey<std::string> > captured_stderr_key;
mutable std::tr1::shared_ptr<const EDependenciesKey> build_dependencies;
mutable std::tr1::shared_ptr<const EDependenciesKey> run_dependencies;
mutable std::tr1::shared_ptr<const EDependenciesKey> post_dependencies;
@@ -654,6 +655,14 @@ EbuildID::e_repository() const
}
void
+EbuildID::load_captured_stderr(const std::string & r, const std::string & h, const MetadataKeyType t, const std::string & v) const
+{
+ Lock l(_imp->mutex);
+ _imp->captured_stderr_key.reset(new LiteralMetadataValueKey<std::string> (r, h, t, v));
+ add_metadata_key(_imp->captured_stderr_key);
+}
+
+void
EbuildID::load_short_description(const std::string & r, const std::string & h, const std::string & v) const
{
Lock l(_imp->mutex);
diff --git a/paludis/repositories/e/ebuild_id.hh b/paludis/repositories/e/ebuild_id.hh
index df76ca4..f2f3032 100644
--- a/paludis/repositories/e/ebuild_id.hh
+++ b/paludis/repositories/e/ebuild_id.hh
@@ -107,6 +107,7 @@ namespace paludis
void set_slot(const SlotName &) const;
void load_short_description(const std::string &, const std::string &, const std::string &) const;
+ void load_captured_stderr(const std::string &, const std::string &, const MetadataKeyType, const std::string &) const;
void load_build_depend(const std::string &, const std::string &, const std::string &) const;
void load_run_depend(const std::string &, const std::string &, const std::string &) const;
void load_post_depend(const std::string &, const std::string &, const std::string &) const;