aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-08-05 17:56:23 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-08-05 17:56:23 +0100
commita8482df055d2233fabd142ec5bcf8ea748adc888 (patch)
tree9ad7dcda4e490d5ab93d264c4d9cee4abbf93fd0
parent426a01ee4256e2c8fc9135a43a156846a6d593cc (diff)
downloadpaludis-a8482df055d2233fabd142ec5bcf8ea748adc888.tar.gz
paludis-a8482df055d2233fabd142ec5bcf8ea748adc888.tar.xz
build_options: preserve_work is now work=preserve
Fixes: ticket:1252
-rw-r--r--doc/configuration/use.html.part.in9
-rw-r--r--doc/faq/different.html.part2
-rw-r--r--paludis/elike_choices-fwd.hh2
-rw-r--r--paludis/elike_choices.cc260
-rw-r--r--paludis/elike_choices.hh33
-rw-r--r--paludis/elike_choices.se12
-rw-r--r--paludis/repositories/e/do_install_action.cc74
-rw-r--r--paludis/repositories/e/ebuild_id.cc4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc6
10 files changed, 296 insertions, 110 deletions
diff --git a/doc/configuration/use.html.part.in b/doc/configuration/use.html.part.in
index d34a785..981eef0 100644
--- a/doc/configuration/use.html.part.in
+++ b/doc/configuration/use.html.part.in
@@ -66,10 +66,11 @@ default <code>VIDEO_CARDS</code> from your profile, you will need to use <code>*
(using <code>set -x</code>). Not generally a good idea, but can be handy to track down why an ebuild is
misbehaving.</dd>
- <dt>preserve_work</dt>
- <dd>If set, Paludis will not delete temporary working directories used during the build, and will perform a
- non-destructive merge that leaves the image directory intact. This will result in the 'tidyup' phase being
- skipped, but not the 'killold' phase.</dd>
+ <dt>work</dt>
+ <dd>Controls whether Paludis deletes temporary working directories used during the build. If set to
+ <code>preserve</code>, the working directory is always kept (and a non-destructive merge is performed). If set to
+ <code>tidyup</code>, the working directory is removed after a successful build. If set to <code>remove</code>,
+ the working directory is always removed, even after a failed build.</dd>
<dt>jobs</dt>
<dd>If set to an unsigned integer, specifies the number of jobs to run in parallel when build systems
diff --git a/doc/faq/different.html.part b/doc/faq/different.html.part
index ebbfb4f..5931c7a 100644
--- a/doc/faq/different.html.part
+++ b/doc/faq/different.html.part
@@ -28,7 +28,7 @@ a rather ugly way of handling things. We do have equivalents to most values:</p>
<dd>See <a href="howdoi.html#distcc">Use <code>distcc</code></a>.</dd>
<dt>keepwork, keeptemp, noclean</dt>
- <dd>You can use <code>BUILD_OPTIONS: preserve_work</code> for a similar effect.</dd>
+ <dd>You can use <code>BUILD_OPTIONS: work=preserve</code> for a similar effect.</dd>
<dt>nodoc, noinfo, noman</dt>
<dd>You could write a hook that removes the relevant directories from
diff --git a/paludis/elike_choices-fwd.hh b/paludis/elike_choices-fwd.hh
index 9e146a3..bb0bae6 100644
--- a/paludis/elike_choices-fwd.hh
+++ b/paludis/elike_choices-fwd.hh
@@ -33,8 +33,8 @@ namespace paludis
struct ELikeExpensiveTestsChoiceValue;
struct ELikeJobsChoiceValue;
struct ELikeTraceChoiceValue;
- struct ELikePreserveWorkChoiceValue;
struct ELikeSymbolsChoiceValue;
+ struct ELikeWorkChoiceValue;
const ChoicePrefixName canonical_build_options_prefix() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
const std::string canonical_build_options_raw_name() PALUDIS_VISIBLE PALUDIS_ATTRIBUTE((warn_unused_result));
diff --git a/paludis/elike_choices.cc b/paludis/elike_choices.cc
index 23cab36..e994655 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -47,10 +47,15 @@ namespace
const std::shared_ptr<Map<std::string, std::string> > permitted_symbols;
const std::shared_ptr<const PermittedChoiceValueParameterEnumValue> permitted_symbols_values;
+ const std::shared_ptr<Map<std::string, std::string> > permitted_work;
+ const std::shared_ptr<const PermittedChoiceValueParameterEnumValue> permitted_work_values;
+
CommonValues() :
permitted_jobs_values(std::make_shared<PermittedChoiceValueParameterIntegerValue>(1, std::numeric_limits<int>::max())),
permitted_symbols(std::make_shared<Map<std::string, std::string> >()),
- permitted_symbols_values(std::make_shared<PermittedChoiceValueParameterEnumValue>(permitted_symbols))
+ permitted_symbols_values(std::make_shared<PermittedChoiceValueParameterEnumValue>(permitted_symbols)),
+ permitted_work(std::make_shared<Map<std::string, std::string> >()),
+ permitted_work_values(std::make_shared<PermittedChoiceValueParameterEnumValue>(permitted_work))
{
for (EnumIterator<ELikeSymbolsChoiceValueParameter> e, e_end(last_escvp) ;
e != e_end ; ++e)
@@ -75,6 +80,30 @@ namespace
throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
}
+
+ for (EnumIterator<ELikeWorkChoiceValueParameter> e, e_end(last_ewcvp) ;
+ e != e_end ; ++e)
+ {
+ switch (*e)
+ {
+ case ewcvp_tidyup:
+ permitted_work->insert("tidyup", "Tidy up work directory after a successful build");
+ continue;
+ case ewcvp_preserve:
+ permitted_work->insert("preserve", "Perserve the working directory");
+ continue;
+ case ewcvp_remove:
+ permitted_work->insert("remove", "Always remove the working directory");
+ continue;
+ case ewcvp_leave:
+ permitted_work->insert("leave", "Do not remove, but allow destructive merges");
+ continue;
+ case last_ewcvp:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeWorkChoiceValueParameter");
+ }
}
};
}
@@ -487,234 +516,313 @@ ELikeTraceChoiceValue::permitted_parameter_values() const
return make_null_shared_ptr();
}
-const UnprefixedChoiceName
-ELikePreserveWorkChoiceValue::canonical_unprefixed_name()
+namespace
{
- return UnprefixedChoiceName("preserve_work");
-}
+ ELikeSymbolsChoiceValueParameter get_symbols(const std::shared_ptr<const PackageID> & id,
+ const std::string & env_value)
+ {
+ if (env_value.empty())
+ return escvp_split;
-const ChoiceNameWithPrefix
-ELikePreserveWorkChoiceValue::canonical_name_with_prefix()
-{
- return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" +
- stringify(canonical_unprefixed_name()));
+ try
+ {
+ return destringify<ELikeSymbolsChoiceValueParameter>(env_value);
+ }
+ catch (const DestringifyError &)
+ {
+ Context context("When getting value of the symbols option for '" + stringify(*id) + "':");
+ Log::get_instance()->message("elike_symbols_choice_value.invalid", ll_warning, lc_context)
+ << "Value '" << env_value << "' is not a legal value, using \"split\" instead";
+ return escvp_split;
+ }
+ }
}
-ELikePreserveWorkChoiceValue::ELikePreserveWorkChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice,
- const Tribool forced_value) :
- _enabled(forced_value.is_indeterminate() ? env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_true() :
- forced_value.is_true() ? true : false),
- _forced(! forced_value.is_indeterminate())
+ELikeSymbolsChoiceValue::ELikeSymbolsChoiceValue(const std::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::shared_ptr<const Choice> & choice, const ELikeSymbolsChoiceValueParameter _force) :
+ _enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false()),
+ _param(_force != last_escvp ? _force : get_symbols(id, env->value_for_choice_parameter(id, choice, canonical_unprefixed_name())))
{
}
const UnprefixedChoiceName
-ELikePreserveWorkChoiceValue::unprefixed_name() const
+ELikeSymbolsChoiceValue::unprefixed_name() const
{
return canonical_unprefixed_name();
}
const ChoiceNameWithPrefix
-ELikePreserveWorkChoiceValue::name_with_prefix() const
+ELikeSymbolsChoiceValue::name_with_prefix() const
{
return canonical_name_with_prefix();
}
bool
-ELikePreserveWorkChoiceValue::enabled() const
+ELikeSymbolsChoiceValue::enabled() const
{
return _enabled;
}
bool
-ELikePreserveWorkChoiceValue::enabled_by_default() const
+ELikeSymbolsChoiceValue::enabled_by_default() const
{
- return false;
+ return true;
}
bool
-ELikePreserveWorkChoiceValue::locked() const
+ELikeSymbolsChoiceValue::locked() const
{
return false;
}
const std::string
-ELikePreserveWorkChoiceValue::description() const
+ELikeSymbolsChoiceValue::description() const
{
- return "Do not remove build directories, and do not modify the image when merging";
+ return "How to handle debug symbols in installed files";
}
ChoiceOrigin
-ELikePreserveWorkChoiceValue::origin() const
+ELikeSymbolsChoiceValue::origin() const
{
return co_special;
}
const std::string
-ELikePreserveWorkChoiceValue::parameter() const
+ELikeSymbolsChoiceValue::parameter() const
{
- return "";
+ return stringify(_param);
}
const std::shared_ptr<const PermittedChoiceValueParameterValues>
-ELikePreserveWorkChoiceValue::permitted_parameter_values() const
+ELikeSymbolsChoiceValue::permitted_parameter_values() const
{
- return make_null_shared_ptr();
+ return CommonValues::get_instance()->permitted_symbols_values;
+}
+
+const UnprefixedChoiceName
+ELikeSymbolsChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("symbols");
+}
+
+const ChoiceNameWithPrefix
+ELikeSymbolsChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
+}
+
+bool
+ELikeSymbolsChoiceValue::should_split(const std::string & v)
+{
+ switch (destringify<ELikeSymbolsChoiceValueParameter>(v))
+ {
+ case escvp_split:
+ case escvp_compress:
+ return true;
+
+ case escvp_preserve:
+ case escvp_strip:
+ return false;
+
+ case last_escvp:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
+}
+
+bool
+ELikeSymbolsChoiceValue::should_strip(const std::string & v)
+{
+ switch (destringify<ELikeSymbolsChoiceValueParameter>(v))
+ {
+ case escvp_split:
+ case escvp_compress:
+ case escvp_strip:
+ return true;
+
+ case escvp_preserve:
+ return false;
+
+ case last_escvp:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
+}
+
+bool
+ELikeSymbolsChoiceValue::should_compress(const std::string & v)
+{
+ switch (destringify<ELikeSymbolsChoiceValueParameter>(v))
+ {
+ case escvp_compress:
+ return true;
+
+ case escvp_split:
+ case escvp_preserve:
+ case escvp_strip:
+ return false;
+
+ case last_escvp:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
}
namespace
{
- ELikeSymbolsChoiceValueParameter get_symbols(const std::shared_ptr<const PackageID> & id,
+ ELikeWorkChoiceValueParameter get_work(const std::shared_ptr<const PackageID> & id,
const std::string & env_value)
{
if (env_value.empty())
- return escvp_split;
+ return ewcvp_tidyup;
try
{
- return destringify<ELikeSymbolsChoiceValueParameter>(env_value);
+ return destringify<ELikeWorkChoiceValueParameter>(env_value);
}
catch (const DestringifyError &)
{
Context context("When getting value of the symbols option for '" + stringify(*id) + "':");
- Log::get_instance()->message("elike_symbols_choice_value.invalid", ll_warning, lc_context)
- << "Value '" << env_value << "' is not a legal value, using \"split\" instead";
- return escvp_split;
+ Log::get_instance()->message("elike_work_choice_value.invalid", ll_warning, lc_context)
+ << "Value '" << env_value << "' is not a legal value, using \"tidyup\" instead";
+ return ewcvp_tidyup;
}
}
}
-ELikeSymbolsChoiceValue::ELikeSymbolsChoiceValue(const std::shared_ptr<const PackageID> & id,
- const Environment * const env, const std::shared_ptr<const Choice> & choice, const ELikeSymbolsChoiceValueParameter _force) :
+ELikeWorkChoiceValue::ELikeWorkChoiceValue(const std::shared_ptr<const PackageID> & id,
+ const Environment * const env, const std::shared_ptr<const Choice> & choice, const ELikeWorkChoiceValueParameter _force) :
_enabled(! env->want_choice_enabled(id, choice, canonical_unprefixed_name()).is_false()),
- _param(_force != last_escvp ? _force : get_symbols(id, env->value_for_choice_parameter(id, choice, canonical_unprefixed_name())))
+ _param(_force != last_ewcvp ? _force : get_work(id, env->value_for_choice_parameter(id, choice, canonical_unprefixed_name())))
{
}
const UnprefixedChoiceName
-ELikeSymbolsChoiceValue::unprefixed_name() const
+ELikeWorkChoiceValue::unprefixed_name() const
{
return canonical_unprefixed_name();
}
const ChoiceNameWithPrefix
-ELikeSymbolsChoiceValue::name_with_prefix() const
+ELikeWorkChoiceValue::name_with_prefix() const
{
return canonical_name_with_prefix();
}
bool
-ELikeSymbolsChoiceValue::enabled() const
+ELikeWorkChoiceValue::enabled() const
{
return _enabled;
}
bool
-ELikeSymbolsChoiceValue::enabled_by_default() const
+ELikeWorkChoiceValue::enabled_by_default() const
{
return true;
}
bool
-ELikeSymbolsChoiceValue::locked() const
+ELikeWorkChoiceValue::locked() const
{
return false;
}
const std::string
-ELikeSymbolsChoiceValue::description() const
+ELikeWorkChoiceValue::description() const
{
- return "How to handle debug symbols in installed files";
+ return "Whether to preserve or remove working directories";
}
ChoiceOrigin
-ELikeSymbolsChoiceValue::origin() const
+ELikeWorkChoiceValue::origin() const
{
return co_special;
}
const std::string
-ELikeSymbolsChoiceValue::parameter() const
+ELikeWorkChoiceValue::parameter() const
{
return stringify(_param);
}
const std::shared_ptr<const PermittedChoiceValueParameterValues>
-ELikeSymbolsChoiceValue::permitted_parameter_values() const
+ELikeWorkChoiceValue::permitted_parameter_values() const
{
- return CommonValues::get_instance()->permitted_symbols_values;
+ return CommonValues::get_instance()->permitted_work_values;
}
const UnprefixedChoiceName
-ELikeSymbolsChoiceValue::canonical_unprefixed_name()
+ELikeWorkChoiceValue::canonical_unprefixed_name()
{
- return UnprefixedChoiceName("symbols");
+ return UnprefixedChoiceName("work");
}
const ChoiceNameWithPrefix
-ELikeSymbolsChoiceValue::canonical_name_with_prefix()
+ELikeWorkChoiceValue::canonical_name_with_prefix()
{
return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" + stringify(canonical_unprefixed_name()));
}
bool
-ELikeSymbolsChoiceValue::should_split(const std::string & v)
+ELikeWorkChoiceValue::should_remove(const std::string & v)
{
- switch (destringify<ELikeSymbolsChoiceValueParameter>(v))
+ switch (destringify<ELikeWorkChoiceValueParameter>(v))
{
- case escvp_split:
- case escvp_compress:
+ case ewcvp_tidyup:
+ case ewcvp_remove:
return true;
- case escvp_preserve:
- case escvp_strip:
+ case ewcvp_preserve:
+ case ewcvp_leave:
return false;
- case last_escvp:
+ case last_ewcvp:
break;
}
- throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeWorkChoiceValueParameter");
}
bool
-ELikeSymbolsChoiceValue::should_strip(const std::string & v)
+ELikeWorkChoiceValue::should_merge_nondestructively(const std::string & v)
{
- switch (destringify<ELikeSymbolsChoiceValueParameter>(v))
+ switch (destringify<ELikeWorkChoiceValueParameter>(v))
{
- case escvp_split:
- case escvp_compress:
- case escvp_strip:
+ case ewcvp_preserve:
return true;
- case escvp_preserve:
+ case ewcvp_tidyup:
+ case ewcvp_remove:
+ case ewcvp_leave:
return false;
- case last_escvp:
+ case last_ewcvp:
break;
}
- throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeWorkChoiceValueParameter");
}
bool
-ELikeSymbolsChoiceValue::should_compress(const std::string & v)
+ELikeWorkChoiceValue::should_remove_on_failure(const std::string & v)
{
- switch (destringify<ELikeSymbolsChoiceValueParameter>(v))
+ switch (destringify<ELikeWorkChoiceValueParameter>(v))
{
- case escvp_compress:
+ case ewcvp_remove:
return true;
- case escvp_split:
- case escvp_preserve:
- case escvp_strip:
+ case ewcvp_tidyup:
+ case ewcvp_preserve:
+ case ewcvp_leave:
return false;
- case last_escvp:
+ case last_ewcvp:
break;
}
- throw InternalError(PALUDIS_HERE, "Unhandled ELikeSymbolsChoiceValueParameter");
+ throw InternalError(PALUDIS_HERE, "Unhandled ELikeWorkChoiceValueParameter");
}
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index e994597..950804b 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -161,22 +161,17 @@ namespace paludis
static const ChoiceNameWithPrefix canonical_name_with_prefix() PALUDIS_ATTRIBUTE((warn_unused_result));
};
- class PALUDIS_VISIBLE ELikePreserveWorkChoiceValue :
+ class PALUDIS_VISIBLE ELikeSymbolsChoiceValue :
public ChoiceValue
{
private:
const bool _enabled;
- const bool _forced;
+ const ELikeSymbolsChoiceValueParameter _param;
public:
- /**
- * \since 0.51.0
- */
- ELikePreserveWorkChoiceValue(
- const std::shared_ptr<const PackageID> &,
- const Environment * const env,
- const std::shared_ptr<const Choice> &,
- const Tribool forced_value);
+ ELikeSymbolsChoiceValue(const std::shared_ptr<const PackageID> &,
+ const Environment * const env, const std::shared_ptr<const Choice> &,
+ const ELikeSymbolsChoiceValueParameter _force);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -191,19 +186,23 @@ 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));
+
+ static bool should_split(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ static bool should_strip(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ static bool should_compress(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
};
- class PALUDIS_VISIBLE ELikeSymbolsChoiceValue :
+ class PALUDIS_VISIBLE ELikeWorkChoiceValue :
public ChoiceValue
{
private:
const bool _enabled;
- const ELikeSymbolsChoiceValueParameter _param;
+ const ELikeWorkChoiceValueParameter _param;
public:
- ELikeSymbolsChoiceValue(const std::shared_ptr<const PackageID> &,
+ ELikeWorkChoiceValue(const std::shared_ptr<const PackageID> &,
const Environment * const env, const std::shared_ptr<const Choice> &,
- const ELikeSymbolsChoiceValueParameter _force);
+ const ELikeWorkChoiceValueParameter force);
virtual const UnprefixedChoiceName unprefixed_name() const PALUDIS_ATTRIBUTE((warn_unused_result));
virtual const ChoiceNameWithPrefix name_with_prefix() const PALUDIS_ATTRIBUTE((warn_unused_result));
@@ -219,9 +218,9 @@ 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));
- static bool should_split(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
- static bool should_strip(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
- static bool should_compress(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ static bool should_remove(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ static bool should_remove_on_failure(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
+ static bool should_merge_nondestructively(const std::string &) PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/elike_choices.se b/paludis/elike_choices.se
index 1aefa5c..7ebb0a5 100644
--- a/paludis/elike_choices.se
+++ b/paludis/elike_choices.se
@@ -13,3 +13,15 @@ make_enum_ELikeSymbolsChoiceValueParameter()
want_destringify
}
+make_enum_ELikeWorkChoiceValueParameter()
+{
+ prefix ewcvp
+
+ key ewcvp_preserve "Always preserve"
+ key ewcvp_leave "Do not remove, but allow destructive merges"
+ key ewcvp_tidyup "Tidy up after a successful build"
+ key ewcvp_remove "Always remove"
+
+ want_destringify
+}
+
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index 5b05c82..c51d3a9 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -216,7 +216,7 @@ paludis::erepository::do_install_action(
}
auto choices(id->choices_key()->parse_value());
- std::shared_ptr<const ChoiceValue> preserve_work_choice(choices->find_by_name_with_prefix(ELikePreserveWorkChoiceValue::canonical_name_with_prefix()));
+ auto work_choice(choices->find_by_name_with_prefix(ELikeWorkChoiceValue::canonical_name_with_prefix()));
EAPIPhases phases(id->eapi()->supported()->ebuild_phases()->ebuild_install());
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
@@ -253,7 +253,7 @@ paludis::erepository::do_install_action(
continue;
}
- if (phase->option("tidyup") && preserve_work_choice && preserve_work_choice->enabled())
+ if (phase->option("tidyup") && work_choice && ! ELikeWorkChoiceValue::should_remove(work_choice->parameter()))
{
output_manager->stdout_stream() << "--- Skipping " << phase->equal_option("skipname")
<< " phase to preserve work" << std::endl;
@@ -268,7 +268,7 @@ paludis::erepository::do_install_action(
+ "' because destination does not provide destination_interface");
MergerOptions extra_merger_options;
- if (preserve_work_choice && preserve_work_choice->enabled())
+ if (work_choice && ELikeWorkChoiceValue::should_merge_nondestructively(work_choice->parameter()))
extra_merger_options += mo_nondestructive;
Timestamp build_start_time(FSPath(package_builddir / "temp" / "build_start_time").stat().mtim());
@@ -400,7 +400,73 @@ paludis::erepository::do_install_action(
));
EbuildInstallCommand cmd(command_params, install_params);
- cmd();
+ try
+ {
+ cmd();
+ }
+ catch (const ActionFailedError & e)
+ {
+ if (work_choice && ELikeWorkChoiceValue::should_remove_on_failure(work_choice->parameter()))
+ {
+ for (EAPIPhases::ConstIterator tidyup_phase(phases.begin_phases()), tidyup_phase_end(phases.end_phases()) ;
+ tidyup_phase != tidyup_phase_end ; ++tidyup_phase)
+ {
+ if (! tidyup_phase->option("tidyup"))
+ continue;
+
+ EbuildCommandParams tidyup_command_params(make_named_values<EbuildCommandParams>(
+ n::builddir() = repo->params().builddir(),
+ n::clearenv() = tidyup_phase->option("clearenv"),
+ n::commands() = join(tidyup_phase->begin_commands(), tidyup_phase->end_commands(), " "),
+ n::distdir() = repo->params().distdir(),
+ n::ebuild_dir() = repo->layout()->package_directory(id->name()),
+ n::ebuild_file() = id->fs_location_key()->parse_value(),
+ n::eclassdirs() = repo->params().eclassdirs(),
+ n::environment() = env,
+ n::exlibsdirs() = exlibsdirs,
+ n::files_dir() = repo->layout()->package_directory(id->name()) / "files",
+ n::maybe_output_manager() = output_manager,
+ n::package_builddir() = package_builddir,
+ n::package_id() = id,
+ n::permitted_directories() = permitted_directories,
+ n::portdir() =
+ (repo->params().master_repositories() && ! repo->params().master_repositories()->empty()) ?
+ (*repo->params().master_repositories()->begin())->params().location() : repo->params().location(),
+ n::root() = install_action.options.destination()->installed_root_key() ?
+ stringify(install_action.options.destination()->installed_root_key()->parse_value()) :
+ "/",
+ n::sandbox() = tidyup_phase->option("sandbox"),
+ n::sydbox() = tidyup_phase->option("sydbox"),
+ n::userpriv() = tidyup_phase->option("userpriv") && userpriv_ok
+ ));
+
+ EbuildInstallCommandParams tidyup_install_params(
+ make_named_values<EbuildInstallCommandParams>(
+ n::a() = archives,
+ n::aa() = all_archives,
+ n::accept_license() = accept_license,
+ n::config_protect() = repo->environment_updated_profile_variable("CONFIG_PROTECT"),
+ n::config_protect_mask() = repo->environment_updated_profile_variable("CONFIG_PROTECT_MASK"),
+ n::destination() = install_action.options.destination(),
+ n::expand_vars() = expand_vars,
+ n::is_from_pbin() = id->eapi()->supported()->is_pbin(),
+ n::loadsaveenv_dir() = package_builddir / "temp",
+ n::profiles() = repo->params().profiles(),
+ n::profiles_with_parents() = repo->profile()->profiles_with_parents(),
+ n::replacing_ids() = install_action.options.replacing(),
+ n::slot() = id->slot_key() ? stringify(id->slot_key()->parse_value()) : "",
+ n::use() = use,
+ n::use_expand() = join(repo->profile()->use_expand()->begin(), repo->profile()->use_expand()->end(), " "),
+ n::use_expand_hidden() = join(repo->profile()->use_expand_hidden()->begin(), repo->profile()->use_expand_hidden()->end(), " ")
+ ));
+
+ EbuildInstallCommand tidyup_cmd(tidyup_command_params, tidyup_install_params);
+ tidyup_cmd();
+ }
+ }
+
+ throw;
+ }
}
}
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index f2dc1ad..4522a4a 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1700,8 +1700,8 @@ EbuildID::add_build_options(const std::shared_ptr<Choices> & choices) const
shared_from_this(), _imp->environment, build_options));
/* preserve_work */
- build_options->add(std::make_shared<ELikePreserveWorkChoiceValue>(
- shared_from_this(), _imp->environment, build_options, indeterminate));
+ build_options->add(std::make_shared<ELikeWorkChoiceValue>(
+ shared_from_this(), _imp->environment, build_options, last_ewcvp));
}
}
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 5c312b8..8bdd59c 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -366,7 +366,7 @@ UnpackagedID::perform_action(Action & action) const
auto choices(choices_key()->parse_value());
auto symbols_choice(choices->find_by_name_with_prefix(ELikeSymbolsChoiceValue::canonical_name_with_prefix()));
- auto preserve_work_choice(choices->find_by_name_with_prefix(ELikePreserveWorkChoiceValue::canonical_name_with_prefix()));
+ auto work_choice(choices->find_by_name_with_prefix(ELikeWorkChoiceValue::canonical_name_with_prefix()));
std::string used_config_protect;
@@ -400,7 +400,7 @@ UnpackagedID::perform_action(Action & action) const
}
MergerOptions extra_merger_options;
- if (preserve_work_choice && preserve_work_choice->enabled())
+ if (work_choice && ELikeWorkChoiceValue::should_merge_nondestructively(work_choice->parameter()))
extra_merger_options += mo_nondestructive;
MergeParams merge_params(make_named_values<MergeParams>(
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 024d6d4..457604a 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -171,11 +171,11 @@ UnpackagedChoicesKey::parse_value() const
build_options->add(std::make_shared<ELikeSymbolsChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options,
strip.is_true() ? escvp_strip : strip.is_false() ? escvp_preserve : last_escvp));
- Tribool preserve_work(indeterminate);
+ ELikeWorkChoiceValueParameter preserve_work(last_ewcvp);
if (_imp->id->preserve_work_key())
- preserve_work = _imp->id->preserve_work_key()->parse_value();
+ preserve_work = _imp->id->preserve_work_key()->parse_value() ? ewcvp_preserve : ewcvp_leave;
- build_options->add(std::make_shared<ELikePreserveWorkChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, preserve_work));
+ build_options->add(std::make_shared<ELikeWorkChoiceValue>(_imp->id->shared_from_this(), _imp->env, build_options, preserve_work));
_imp->value->add(build_options);
}