aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-26 23:55:45 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-08-26 23:55:45 +0100
commit33b601103aa5a842db15342a9e364c6409287c75 (patch)
treeff267ad64356809af4b47d0833da0f6077a7ee24
parentbf188f4a5cbdda5378f5568dc13661b41b3fd19b (diff)
downloadpaludis-33b601103aa5a842db15342a9e364c6409287c75.tar.gz
paludis-33b601103aa5a842db15342a9e364c6409287c75.tar.xz
build_options: trace
-rw-r--r--doc/configuration/use.html.part.in5
-rw-r--r--paludis/elike_choices.cc67
-rw-r--r--paludis/elike_choices.hh23
-rw-r--r--paludis/repositories/e/ebuild.cc13
-rwxr-xr-xpaludis/repositories/e/ebuild/ebuild.bash2
-rw-r--r--paludis/repositories/e/ebuild_id.cc4
6 files changed, 113 insertions, 1 deletions
diff --git a/doc/configuration/use.html.part.in b/doc/configuration/use.html.part.in
index e3d1202..1c198e1 100644
--- a/doc/configuration/use.html.part.in
+++ b/doc/configuration/use.html.part.in
@@ -68,6 +68,11 @@ default <code>VIDEO_CARDS</code> from your profile, you will need to use <code>*
only be set by package maintainers, since tests marked as expensive are probably too painful in terms
of CPU time or disk space requirements to run on user systems.</dd>
+ <dt>trace</dt>
+ <dd>If set, Paludis will ask bash to display extremely verbose information about what an ebuild or exheres is doing
+ (using <code>set -x</code>). Not generally a good idea, but can be handy to track down why an ebuild is
+ misbehaving.</dd>
+
<dt>jobs</dt>
<dd>If set to an unsigned integer, specifies the number of jobs to run in parallel when build systems
support this (e.g. <code>BUILD_OPTIONS: jobs=4</code> would imply <code>make -j4</code>).</dd>
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index d611cd4..e70180c 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -464,3 +464,70 @@ ELikeJobsChoiceValue::parameter() const
return _parameter;
}
+const UnprefixedChoiceName
+ELikeTraceChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("trace");
+}
+
+const ChoiceNameWithPrefix
+ELikeTraceChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" +
+ stringify(canonical_unprefixed_name()));
+}
+
+ELikeTraceChoiceValue::ELikeTraceChoiceValue(const std::tr1::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> & choice) :
+ _enabled(env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true())
+{
+}
+
+const UnprefixedChoiceName
+ELikeTraceChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikeTraceChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikeTraceChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikeTraceChoiceValue::enabled_by_default() const
+{
+ return false;
+}
+
+bool
+ELikeTraceChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikeTraceChoiceValue::description() const
+{
+ return "Trace actions executed by the package (very noisy, for debugging broken builds only)";
+}
+
+bool
+ELikeTraceChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const std::string
+ELikeTraceChoiceValue::parameter() const
+{
+ return "";
+}
+
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index e8d6670..dbdecd9 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -166,6 +166,29 @@ namespace paludis
static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
};
+
+ class PALUDIS_VISIBLE ELikeTraceChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikeTraceChoiceValue(const std::tr1::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::tr1::shared_ptr<const Choice> &);
+
+ virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool enabled_by_default() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool locked() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string description() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual bool explicitly_listed() const PALUDIS_ATTRIBUTE((warn_unused_result));
+ virtual const std::string parameter() const PALUDIS_ATTRIBUTE((warn_unused_result));
+
+ static const UnprefixedChoiceName canonical_unprefixed_name() PALUDIS_ATTRIBUTE((warn_unused_result));
+ static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
+ };
}
#endif
diff --git a/paludis/repositories/e/ebuild.cc b/paludis/repositories/e/ebuild.cc
index 96381aa..6ad8101 100644
--- a/paludis/repositories/e/ebuild.cc
+++ b/paludis/repositories/e/ebuild.cc
@@ -103,6 +103,15 @@ namespace
else
return "";
}
+
+ bool get_trace(const std::tr1::shared_ptr<const PackageID> & id)
+ {
+ std::tr1::shared_ptr<const ChoiceValue> choice;
+ if (id->choices_key())
+ choice = id->choices_key()->value()->find_by_name_with_prefix(
+ ELikeTraceChoiceValue::canonical_name_with_prefix());
+ return choice && choice->enabled();
+ }
}
bool
@@ -297,6 +306,9 @@ EbuildCommand::operator() ()
.with_setenv(params.package_id()->eapi()->supported()->ebuild_environment_variables()->env_jobs(),
get_jobs(params.package_id()));
+ cmd
+ .with_setenv("PALUDIS_TRACE", get_trace(params.package_id()) ? "yes" : "");
+
if (params.package_id()->eapi()->supported()->ebuild_options()->want_portage_emulation_vars())
cmd = add_portage_vars(cmd);
@@ -1322,4 +1334,3 @@ EbuildFetchExtraCommand::EbuildFetchExtraCommand(const EbuildCommandParams & p,
{
}
-
diff --git a/paludis/repositories/e/ebuild/ebuild.bash b/paludis/repositories/e/ebuild/ebuild.bash
index 0f6ebdd..c147612 100755
--- a/paludis/repositories/e/ebuild/ebuild.bash
+++ b/paludis/repositories/e/ebuild/ebuild.bash
@@ -23,6 +23,8 @@
unalias -a
set +C
+[[ -n "${PALUDIS_TRACE}" ]] && set -x
+
ebuild_sanitise_envvars()
{
# Force a few more things into PATH, since some users have crazy setups.
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 10470af..b14a813 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1430,6 +1430,10 @@ EbuildID::add_build_options(const std::tr1::shared_ptr<Choices> & choices) const
build_options->add(make_shared_ptr(new ELikeStripChoiceValue(shared_from_this(), _imp->environment, build_options)));
}
+ /* trace */
+ build_options->add(make_shared_ptr(new ELikeTraceChoiceValue(
+ shared_from_this(), _imp->environment, build_options)));
+
/* jobs */
if (! eapi()->supported()->ebuild_environment_variables()->env_jobs().empty())
{