aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-22 02:01:41 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-12-22 02:01:41 +0000
commit94167fdd5fa7200cad1464a9ef5aa64dab2b7928 (patch)
tree26202b9b7c76f1380ca68b0ab1d87b3b6cc4efe5
parent299cd12ed30201b78ad4091a59edd7ba66b739a9 (diff)
downloadpaludis-94167fdd5fa7200cad1464a9ef5aa64dab2b7928.tar.gz
paludis-94167fdd5fa7200cad1464a9ef5aa64dab2b7928.tar.xz
build_options: preserve_work
-rw-r--r--NEWS3
-rw-r--r--doc/configuration/use.html.part.in4
-rw-r--r--paludis/elike_choices-fwd.hh1
-rw-r--r--paludis/elike_choices.cc67
-rw-r--r--paludis/elike_choices.hh23
-rw-r--r--paludis/merger.cc6
-rw-r--r--paludis/merger.se1
-rw-r--r--paludis/repositories/e/e_repository.cc39
-rw-r--r--paludis/repositories/e/eapis/0.conf5
-rw-r--r--paludis/repositories/e/eapis/2.conf2
-rw-r--r--paludis/repositories/e/eapis/4.conf2
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf4
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf4
-rw-r--r--paludis/repositories/e/eapis/pbin-1+0.conf2
-rw-r--r--paludis/repositories/e/eapis/pbin-1+1.conf2
-rw-r--r--paludis/repositories/e/eapis/pbin-1+exheres-0.conf2
-rw-r--r--paludis/repositories/e/eapis/pbin-1+paludis-1.conf2
-rw-r--r--paludis/repositories/e/ebuild_id.cc4
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc8
-rw-r--r--paludis/repositories/unpackaged/unpackaged_key.cc1
20 files changed, 155 insertions, 27 deletions
diff --git a/NEWS b/NEWS
index 7afa9de..fd70ddf 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,9 @@ of every change, see the ChangeLog.
for numeric values, and for compound values, a match succeeds if any item
of the key is equal to the specified pattern.
+ * build_options: preserve_work can be used to avoid removing temporary
+ working directories, and to force a non-destructive merge.
+
* Various large code cleanups and build system cleanups.
0.42.2:
diff --git a/doc/configuration/use.html.part.in b/doc/configuration/use.html.part.in
index 1c198e1..59e04f2 100644
--- a/doc/configuration/use.html.part.in
+++ b/doc/configuration/use.html.part.in
@@ -73,6 +73,10 @@ 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.</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-fwd.hh b/paludis/elike_choices-fwd.hh
index 28732a9..0ed7ef8 100644
--- a/paludis/elike_choices-fwd.hh
+++ b/paludis/elike_choices-fwd.hh
@@ -32,6 +32,7 @@ namespace paludis
struct ELikeRecommendedTestsChoiceValue;
struct ELikeExpensiveTestsChoiceValue;
struct ELikeJobsChoiceValue;
+ struct ELikePreserveWorkChoiceValue;
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 e70180c..6e35cdf 100644
--- a/paludis/elike_choices.cc
+++ b/paludis/elike_choices.cc
@@ -531,3 +531,70 @@ ELikeTraceChoiceValue::parameter() const
return "";
}
+const UnprefixedChoiceName
+ELikePreserveWorkChoiceValue::canonical_unprefixed_name()
+{
+ return UnprefixedChoiceName("preserve_work");
+}
+
+const ChoiceNameWithPrefix
+ELikePreserveWorkChoiceValue::canonical_name_with_prefix()
+{
+ return ChoiceNameWithPrefix(stringify(canonical_build_options_prefix()) + ":" +
+ stringify(canonical_unprefixed_name()));
+}
+
+ELikePreserveWorkChoiceValue::ELikePreserveWorkChoiceValue(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
+ELikePreserveWorkChoiceValue::unprefixed_name() const
+{
+ return canonical_unprefixed_name();
+}
+
+const ChoiceNameWithPrefix
+ELikePreserveWorkChoiceValue::name_with_prefix() const
+{
+ return canonical_name_with_prefix();
+}
+
+bool
+ELikePreserveWorkChoiceValue::enabled() const
+{
+ return _enabled;
+}
+
+bool
+ELikePreserveWorkChoiceValue::enabled_by_default() const
+{
+ return false;
+}
+
+bool
+ELikePreserveWorkChoiceValue::locked() const
+{
+ return false;
+}
+
+const std::string
+ELikePreserveWorkChoiceValue::description() const
+{
+ return "Do not remove build directories, and do not modify the image when merging";
+}
+
+bool
+ELikePreserveWorkChoiceValue::explicitly_listed() const
+{
+ return true;
+}
+
+const std::string
+ELikePreserveWorkChoiceValue::parameter() const
+{
+ return "";
+}
+
diff --git a/paludis/elike_choices.hh b/paludis/elike_choices.hh
index dbdecd9..21948af 100644
--- a/paludis/elike_choices.hh
+++ b/paludis/elike_choices.hh
@@ -189,6 +189,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 ELikePreserveWorkChoiceValue :
+ public ChoiceValue
+ {
+ private:
+ const bool _enabled;
+
+ public:
+ ELikePreserveWorkChoiceValue(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/merger.cc b/paludis/merger.cc
index 6653273..8d14f81 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -744,7 +744,8 @@ Merger::install_file(const FSEntry & src, const FSEntry & dst_dir, const std::st
bool do_copy(false);
- if (0 == std::rename(stringify(src).c_str(), stringify(dst_real).c_str()))
+ if ((! _imp->params.options()[mo_nondestructive]) &&
+ 0 == std::rename(stringify(src).c_str(), stringify(dst_real).c_str()))
{
result += msi_rename;
@@ -957,7 +958,8 @@ Merger::install_dir(const FSEntry & src, const FSEntry & dst_dir)
if (is_selinux_enabled())
relabel_dir_recursive(src, dst);
- if (0 == std::rename(stringify(src).c_str(), stringify(dst).c_str()))
+ if ((! _imp->params.options()[mo_nondestructive]) &&
+ 0 == std::rename(stringify(src).c_str(), stringify(dst).c_str()))
{
result += msi_rename;
track_renamed_dir_recursive(dst);
diff --git a/paludis/merger.se b/paludis/merger.se
index 8e150e7..f4fb6df 100644
--- a/paludis/merger.se
+++ b/paludis/merger.se
@@ -32,6 +32,7 @@ make_enum_MergerOption()
key mo_rewrite_symlinks "Fix symlinks that point into the image directory (otherwise throw an error)"
key mo_allow_empty_dirs "Allow merging empty directories"
key mo_preserve_mtimes "Preserve mtimes \since 0.42"
+ key mo_nondestructive "Don't destroy the image when merging \since 0.44"
doxygen_comment << "END"
/**
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 8965c72..669d616 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -2256,6 +2256,10 @@ ERepository::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
std::string used_config_protect;
std::tr1::shared_ptr<FSEntrySet> merged_entries(new FSEntrySet);
+ std::tr1::shared_ptr<const ChoiceValue> preserve_work_choice(
+ id->choices_key()->value()->find_by_name_with_prefix(
+ ELikePreserveWorkChoiceValue::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()) ;
phase != phase_end ; ++phase)
@@ -2291,6 +2295,13 @@ ERepository::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
continue;
}
+ if (phase->option("tidyup") && preserve_work_choice && preserve_work_choice->enabled())
+ {
+ output_manager->stdout_stream() << "--- Skipping " << phase->equal_option("skipname")
+ << " phase to preserve work" << std::endl;
+ continue;
+ }
+
if (phase->option("merge"))
{
if (! (*install_action.options.destination()).destination_interface())
@@ -2298,18 +2309,22 @@ ERepository::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
+ "' to destination '" + stringify(install_action.options.destination()->name())
+ "' because destination does not provide destination_interface");
- (*install_action.options.destination()).destination_interface()->merge(
- make_named_values<MergeParams>(
- value_for<n::environment_file>(package_builddir / "temp" / "loadsaveenv"),
- value_for<n::image_dir>(package_builddir / "image"),
- value_for<n::merged_entries>(merged_entries),
- value_for<n::options>(id->eapi()->supported()->merger_options()),
- value_for<n::output_manager>(output_manager),
- value_for<n::package_id>(id),
- value_for<n::perform_uninstall>(install_action.options.perform_uninstall()),
- value_for<n::used_this_for_config_protect>(std::tr1::bind(
- &used_this_for_config_protect, std::tr1::ref(used_config_protect), std::tr1::placeholders::_1))
- ));
+ MergerOptions extra_merger_options;
+ if (preserve_work_choice && preserve_work_choice->enabled())
+ extra_merger_options += mo_nondestructive;
+
+ (*install_action.options.destination()).destination_interface()->merge(
+ make_named_values<MergeParams>(
+ value_for<n::environment_file>(package_builddir / "temp" / "loadsaveenv"),
+ value_for<n::image_dir>(package_builddir / "image"),
+ value_for<n::merged_entries>(merged_entries),
+ value_for<n::options>(id->eapi()->supported()->merger_options() | extra_merger_options),
+ value_for<n::output_manager>(output_manager),
+ value_for<n::package_id>(id),
+ value_for<n::perform_uninstall>(install_action.options.perform_uninstall()),
+ value_for<n::used_this_for_config_protect>(std::tr1::bind(
+ &used_this_for_config_protect, std::tr1::ref(used_config_protect), std::tr1::placeholders::_1))
+ ));
}
else if (phase->option("strip"))
{
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index fe259b1..39739e7 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -114,13 +114,14 @@ ebuild_install = \
skipname=preinst skipifno=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst skipifno=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
ebuild_uninstall = \
skipname=killold skipifno=prerm,postrm : killold ; \
skipname=prerm skipifno=prerm,postrm : initmisc prerm saveenv ; \
unmerge : ; \
- skipname=postrm skipifno=prerm,postrm clearenv : loadenv postrm tidyup ;
+ skipname=postrm skipifno=prerm,postrm clearenv : loadenv postrm ; \
+ skipname=tidyup skipifno=prerm,postrm : tidyup
ebuild_pretend =
diff --git a/paludis/repositories/e/eapis/2.conf b/paludis/repositories/e/eapis/2.conf
index a01193f..e95d5d6 100644
--- a/paludis/repositories/e/eapis/2.conf
+++ b/paludis/repositories/e/eapis/2.conf
@@ -25,7 +25,7 @@ ebuild_install = \
skipname=preinst skipifno=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst skipifno=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
ebuild_new_upgrade_phase_order = true
diff --git a/paludis/repositories/e/eapis/4.conf b/paludis/repositories/e/eapis/4.conf
index dce56ff..4046369 100644
--- a/paludis/repositories/e/eapis/4.conf
+++ b/paludis/repositories/e/eapis/4.conf
@@ -23,7 +23,7 @@ ebuild_install = \
skipname=preinst skipifno=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst skipifno=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
ebuild_info = \
: killold ; \
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index f96807e..b214f01 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -145,14 +145,14 @@ ebuild_install = \
skipname=preinst skipifno=preinst sydbox clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst skipifno=postinst sydbox clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
ebuild_uninstall = \
skipname=killold skipifno=prerm,postrm : killold ; \
skipname=prerm skipifno=prerm,postrm sydbox : initmisc prerm saveenv ; \
unmerge : ; \
skipname=postrm skipifno=prerm,postrm sydbox clearenv : loadenv postrm ; \
- skipname=tidyup skipifno=prerm,postrm : tidyup
+ skipname=tidyup skipifno=prerm,postrm tidyup : tidyup
ebuild_pretend = \
skipname=pretend skipifno=pretend sydbox userpriv : pretend
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 4c2871a..6253ff5 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -116,14 +116,14 @@ ebuild_install = \
skipname=preinst skipifno=preinst sandbox clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst skipifno=postinst sandbox clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
ebuild_uninstall = \
skipname=killold skipifno=prerm,postrm : killold ; \
skipname=prerm skipifno=prerm,postrm sandbox : initmisc prerm saveenv ; \
unmerge : ; \
skipname=postrm skipifno=prerm,postrm sandbox clearenv : loadenv postrm ; \
- skipname=tidyup skipifno=prerm,postrm : tidyup
+ skipname=tidyup skipifno=prerm,postrm tidyup : tidyup
ebuild_pretend = \
skipname=pretend skipifno=pretend sandbox userpriv : pretend
diff --git a/paludis/repositories/e/eapis/pbin-1+0.conf b/paludis/repositories/e/eapis/pbin-1+0.conf
index 810a24e..319b7d2 100644
--- a/paludis/repositories/e/eapis/pbin-1+0.conf
+++ b/paludis/repositories/e/eapis/pbin-1+0.conf
@@ -31,7 +31,7 @@ ebuild_install = \
skipname=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
description_generated_using = Generated using
description_generated_time = Generated time
diff --git a/paludis/repositories/e/eapis/pbin-1+1.conf b/paludis/repositories/e/eapis/pbin-1+1.conf
index 74d7705..fe01a58 100644
--- a/paludis/repositories/e/eapis/pbin-1+1.conf
+++ b/paludis/repositories/e/eapis/pbin-1+1.conf
@@ -31,7 +31,7 @@ ebuild_install = \
skipname=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
description_generated_using = Generated using
description_generated_time = Generated time
diff --git a/paludis/repositories/e/eapis/pbin-1+exheres-0.conf b/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
index 0d81be0..fec47f3 100644
--- a/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
+++ b/paludis/repositories/e/eapis/pbin-1+exheres-0.conf
@@ -32,7 +32,7 @@ ebuild_install = \
skipname=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
description_generated_using = Generated using
description_generated_time = Generated time
diff --git a/paludis/repositories/e/eapis/pbin-1+paludis-1.conf b/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
index 5bf6708..ba74f78 100644
--- a/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
+++ b/paludis/repositories/e/eapis/pbin-1+paludis-1.conf
@@ -32,7 +32,7 @@ ebuild_install = \
skipname=preinst clearenv prepost : loadenv preinst saveenv ; \
skipname=merge merge : ; \
skipname=postinst clearenv prepost : loadenv postinst saveenv ; \
- skipname=tidyup : tidyup
+ skipname=tidyup tidyup : tidyup
description_generated_using = Generated using
description_generated_time = Generated time
diff --git a/paludis/repositories/e/ebuild_id.cc b/paludis/repositories/e/ebuild_id.cc
index 5239eed..d6f17c5 100644
--- a/paludis/repositories/e/ebuild_id.cc
+++ b/paludis/repositories/e/ebuild_id.cc
@@ -1426,6 +1426,10 @@ EbuildID::add_build_options(const std::tr1::shared_ptr<Choices> & choices) const
build_options->add(make_shared_ptr(new ELikeTraceChoiceValue(
shared_from_this(), _imp->environment, build_options)));
+ /* preserve_work */
+ build_options->add(make_shared_ptr(new ELikePreserveWorkChoiceValue(
+ shared_from_this(), _imp->environment, build_options)));
+
/* jobs */
if (! eapi()->supported()->ebuild_environment_variables()->env_jobs().empty())
{
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index cb8af6f..5f684f2 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -363,6 +363,8 @@ UnpackagedID::perform_action(Action & action) const
ELikeStripChoiceValue::canonical_name_with_prefix()));
std::tr1::shared_ptr<const ChoiceValue> split_choice(choices_key()->value()->find_by_name_with_prefix(
ELikeSplitChoiceValue::canonical_name_with_prefix()));
+ std::tr1::shared_ptr<const ChoiceValue> preserve_work_choice(choices_key()->value()->find_by_name_with_prefix(
+ ELikePreserveWorkChoiceValue::canonical_name_with_prefix()));
std::string used_config_protect;
@@ -397,12 +399,16 @@ UnpackagedID::perform_action(Action & action) const
{
case wp_yes:
{
+ MergerOptions extra_merger_options;
+ if (preserve_work_choice && preserve_work_choice->enabled())
+ extra_merger_options += mo_nondestructive;
(*install_action->options.destination()).destination_interface()->merge(
make_named_values<MergeParams>(
value_for<n::environment_file>(FSEntry("/dev/null")),
value_for<n::image_dir>(fs_location_key()->value()),
value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
- value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
+ value_for<n::options>((MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs)
+ | extra_merger_options),
value_for<n::output_manager>(output_manager),
value_for<n::package_id>(shared_from_this()),
value_for<n::perform_uninstall>(install_action->options.perform_uninstall()),
diff --git a/paludis/repositories/unpackaged/unpackaged_key.cc b/paludis/repositories/unpackaged/unpackaged_key.cc
index 9fbb1a1..96c7e7b 100644
--- a/paludis/repositories/unpackaged/unpackaged_key.cc
+++ b/paludis/repositories/unpackaged/unpackaged_key.cc
@@ -175,6 +175,7 @@ UnpackagedChoicesKey::value() const
)));
build_options->add(make_shared_ptr(new ELikeSplitChoiceValue(_imp->id->shared_from_this(), _imp->env, build_options)));
build_options->add(make_shared_ptr(new ELikeStripChoiceValue(_imp->id->shared_from_this(), _imp->env, build_options)));
+ build_options->add(make_shared_ptr(new ELikePreserveWorkChoiceValue(_imp->id->shared_from_this(), _imp->env, build_options)));
_imp->value->add(build_options);
}