aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-08-05 19:49:57 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-08-05 19:49:57 +0100
commit151cfa6b0a01bc49a6cf6497a6c5e63fe580a3fc (patch)
treeb0f2e8ccde741663ef2e75622f31fcbae77ddfe4
parent0906210f523f19a18143b5352734082ee482c443 (diff)
downloadpaludis-151cfa6b0a01bc49a6cf6497a6c5e63fe580a3fc.tar.gz
paludis-151cfa6b0a01bc49a6cf6497a6c5e63fe580a3fc.tar.xz
Allow skipping uninstall phases.
Fixes: ticket:1251
-rw-r--r--paludis/action.hh5
-rw-r--r--paludis/repositories/accounts/accounts_id.cc6
-rw-r--r--paludis/repositories/e/do_install_action.cc6
-rw-r--r--paludis/repositories/e/eapis/0.conf2
-rw-r--r--paludis/repositories/e/eapis/exheres-0.conf2
-rw-r--r--paludis/repositories/e/eapis/paludis-1.conf2
-rw-r--r--paludis/repositories/e/exndbam_repository.cc30
-rw-r--r--paludis/repositories/e/vdb_repository.cc31
-rw-r--r--paludis/repositories/e/vdb_repository_TEST_cache.cc3
-rw-r--r--paludis/repositories/e/vdb_repository_TEST_eapis.cc6
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc6
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc12
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc6
-rw-r--r--paludis/repository.hh8
-rw-r--r--python/action.cc3
-rw-r--r--ruby/action.cc3
-rw-r--r--src/clients/cave/cmd_perform.cc4
17 files changed, 110 insertions, 25 deletions
diff --git a/paludis/action.hh b/paludis/action.hh
index ae82ce8..039ba6d 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -235,6 +235,11 @@ namespace paludis
* \since 0.61
*/
NamedValue<n::override_contents, std::shared_ptr<const Contents> > override_contents;
+
+ /**
+ * \since 0.77
+ */
+ NamedValue<n::want_phase, std::function<WantPhase (const std::string &)> > want_phase;
};
/**
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index a0e7c1f..d6d496d 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -481,7 +481,8 @@ AccountsID::perform_action(Action & action) const
n::permit_destination() = std::bind(return_literal_function(true)),
n::replacing() = install_action->options.replacing(),
n::used_this_for_config_protect() = std::bind(
- &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1)
+ &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1),
+ n::want_phase() = install_action->options.want_phase()
));
switch (install_action->options.want_phase()("check_merge"))
@@ -538,7 +539,8 @@ AccountsID::perform_action(Action & action) const
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = install_action->options.want_phase()
));
install_action->options.perform_uninstall()(*i, uo);
}
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index c51d3a9..0e429ec 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -286,7 +286,8 @@ paludis::erepository::do_install_action(
n::permit_destination() = std::bind(&PermittedDirectories::permit, permitted_directories, std::placeholders::_1),
n::replacing() = install_action.options.replacing(),
n::used_this_for_config_protect() = std::bind(
- &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1)
+ &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1),
+ n::want_phase() = install_action.options.want_phase()
));
}
else if (phase->option("strip"))
@@ -490,7 +491,8 @@ paludis::erepository::do_install_action(
std::placeholders::_1),
n::is_overwrite() = false,
n::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = install_action.options.want_phase()
));
install_action.options.perform_uninstall()(*i, uo);
}
diff --git a/paludis/repositories/e/eapis/0.conf b/paludis/repositories/e/eapis/0.conf
index 56623c1..2de6468 100644
--- a/paludis/repositories/e/eapis/0.conf
+++ b/paludis/repositories/e/eapis/0.conf
@@ -126,7 +126,7 @@ ebuild_install = \
ebuild_uninstall = \
skipname=killold : killold ; \
skipname=prerm : initmisc prerm saveenv ; \
- unmerge : ; \
+ skipname=unmerge unmerge : ; \
skipname=postrm clearenv : loadenv postrm ; \
skipname=tidyup clearenv : loadenv tidyup
diff --git a/paludis/repositories/e/eapis/exheres-0.conf b/paludis/repositories/e/eapis/exheres-0.conf
index bc80c0c..45ed0b3 100644
--- a/paludis/repositories/e/eapis/exheres-0.conf
+++ b/paludis/repositories/e/eapis/exheres-0.conf
@@ -161,7 +161,7 @@ ebuild_install = \
ebuild_uninstall = \
skipname=killold skipifno=prerm,postrm : killold ; \
skipname=prerm skipifno=prerm,postrm sydbox : initmisc prerm saveenv ; \
- unmerge : ; \
+ skipname=unmerge unmerge : ; \
skipname=postrm skipifno=prerm,postrm sydbox clearenv : loadenv postrm ; \
skipname=tidyup skipifno=prerm,postrm tidyup clearenv : loadenv tidyup
diff --git a/paludis/repositories/e/eapis/paludis-1.conf b/paludis/repositories/e/eapis/paludis-1.conf
index 088054f..ca066eb 100644
--- a/paludis/repositories/e/eapis/paludis-1.conf
+++ b/paludis/repositories/e/eapis/paludis-1.conf
@@ -127,7 +127,7 @@ ebuild_install = \
ebuild_uninstall = \
skipname=killold skipifno=prerm,postrm : killold ; \
skipname=prerm skipifno=prerm,postrm sandbox : initmisc prerm saveenv ; \
- unmerge : ; \
+ skipname=unmerge unmerge : ; \
skipname=postrm skipifno=prerm,postrm sandbox clearenv : loadenv postrm ; \
skipname=tidyup skipifno=prerm,postrm tidyup clearenv : loadenv tidyup
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 4b249a7..f415354 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -472,7 +472,8 @@ ExndbamRepository::merge(const MergeParams & m)
std::placeholders::_1),
n::is_overwrite() = true,
n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = m.want_phase()
));
m.perform_uninstall()(if_overwritten_id, uo);
}
@@ -494,7 +495,8 @@ ExndbamRepository::merge(const MergeParams & m)
std::placeholders::_1),
n::is_overwrite() = false,
n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = m.want_phase()
));
m.perform_uninstall()(candidate, uo);
}
@@ -535,6 +537,30 @@ ExndbamRepository::perform_uninstall(
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
+ bool skip(false);
+ do
+ {
+ switch (a.options.want_phase()(phase->equal_option("skipname")))
+ {
+ case wp_yes:
+ continue;
+
+ case wp_skip:
+ skip = true;
+ continue;
+
+ case wp_abort:
+ throw ActionAbortedError("Told to abort install");
+
+ case last_wp:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "bad want_phase");
+ } while (false);
+
+ if (skip)
+ continue;
if (can_skip_phase(_imp->params.environment(), id, *phase))
{
output_manager->stdout_stream() << "--- No need to do anything for " <<
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 21c3838..d6dd99a 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -408,6 +408,31 @@ VDBRepository::perform_uninstall(
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
phase != phase_end ; ++phase)
{
+ bool skip(false);
+ do
+ {
+ switch (a.options.want_phase()(phase->equal_option("skipname")))
+ {
+ case wp_yes:
+ continue;
+
+ case wp_skip:
+ skip = true;
+ continue;
+
+ case wp_abort:
+ throw ActionAbortedError("Told to abort install");
+
+ case last_wp:
+ break;
+ }
+
+ throw InternalError(PALUDIS_HERE, "bad want_phase");
+ } while (false);
+
+ if (skip)
+ continue;
+
if (can_skip_phase(_imp->params.environment(), id, *phase))
{
output_manager->stdout_stream() << "--- No need to do anything for " << phase->equal_option("skipname") << " phase" << std::endl;
@@ -733,7 +758,8 @@ VDBRepository::merge(const MergeParams & m)
std::placeholders::_1),
n::is_overwrite() = true,
n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
- n::override_contents() = is_replace_contents
+ n::override_contents() = is_replace_contents,
+ n::want_phase() = m.want_phase()
));
m.perform_uninstall()(is_replace, uo);
}
@@ -755,7 +781,8 @@ VDBRepository::merge(const MergeParams & m)
std::placeholders::_1),
n::is_overwrite() = false,
n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = m.want_phase()
));
m.perform_uninstall()(candidate, uo);
}
diff --git a/paludis/repositories/e/vdb_repository_TEST_cache.cc b/paludis/repositories/e/vdb_repository_TEST_cache.cc
index 64b3118..835db40 100644
--- a/paludis/repositories/e/vdb_repository_TEST_cache.cc
+++ b/paludis/repositories/e/vdb_repository_TEST_cache.cc
@@ -167,7 +167,8 @@ TEST(NamesCache, Incremental)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
{
diff --git a/paludis/repositories/e/vdb_repository_TEST_eapis.cc b/paludis/repositories/e/vdb_repository_TEST_eapis.cc
index 090ac07..b4bc85b 100644
--- a/paludis/repositories/e/vdb_repository_TEST_eapis.cc
+++ b/paludis/repositories/e/vdb_repository_TEST_eapis.cc
@@ -144,7 +144,8 @@ TEST_P(PhasesTest, Works)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
InfoActionOptions info_action_options(make_named_values<InfoActionOptions>(
@@ -270,7 +271,8 @@ TEST_P(VarsTest, Works)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
InfoActionOptions info_action_options(make_named_values<InfoActionOptions>(
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc
index b1cc70c..99a961c 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -233,7 +233,8 @@ UnavailableRepositoryID::perform_action(Action & action) const
n::permit_destination() = std::bind(return_literal_function(true)),
n::replacing() = install_action->options.replacing(),
n::used_this_for_config_protect() = std::bind(
- &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1)
+ &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1),
+ n::want_phase() = install_action->options.want_phase()
));
switch (install_action->options.want_phase()("check_merge"))
@@ -287,7 +288,8 @@ UnavailableRepositoryID::perform_action(Action & action) const
n::is_overwrite() = false,
n::make_output_manager() = std::bind(
&this_output_manager, output_manager, std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = install_action->options.want_phase()
));
install_action->options.perform_uninstall()(*i, uo);
}
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 70f047f..197b9e9 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -248,7 +248,8 @@ TEST(InstalledRepository, UninstallLast)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
id->perform_action(action);
@@ -295,7 +296,8 @@ TEST(InstalledRepository, UninstallNotLast)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
id->perform_action(action);
@@ -530,7 +532,8 @@ TEST(InstalledRepository, MultipleOps)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
(*env[selection::RequireExactlyOne(generator::Matches(
parse_user_package_dep_spec("cat/pkg4a",
@@ -575,7 +578,8 @@ TEST(InstalledRepository, MultipleOps)
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
(*env[selection::RequireExactlyOne(generator::Matches(
parse_user_package_dep_spec("cat/pkg4b",
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 8bdd59c..b670d7f 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -417,7 +417,8 @@ UnpackagedID::perform_action(Action & action) const
n::permit_destination() = std::bind(return_literal_function(true)),
n::replacing() = install_action->options.replacing(),
n::used_this_for_config_protect() = std::bind(
- &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1)
+ &used_this_for_config_protect, std::ref(used_config_protect), std::placeholders::_1),
+ n::want_phase() = install_action->options.want_phase()
));
switch (install_action->options.want_phase()("check_merge"))
@@ -471,7 +472,8 @@ UnpackagedID::perform_action(Action & action) const
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = install_action->options.want_phase()
));
install_action->options.perform_uninstall()(*i, uo);
}
diff --git a/paludis/repository.hh b/paludis/repository.hh
index a86386d..6da5cae 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -77,6 +77,7 @@ namespace paludis
typedef Name<struct name_replacing> replacing;
typedef Name<struct name_status> status;
typedef Name<struct name_used_this_for_config_protect> used_this_for_config_protect;
+ typedef Name<struct name_want_phase> want_phase;
}
/**
@@ -153,6 +154,13 @@ namespace paludis
NamedValue<n::replacing, std::shared_ptr<const PackageIDSequence> > replacing;
NamedValue<n::used_this_for_config_protect, std::function<void (const std::string &)> > used_this_for_config_protect;
+
+ /**
+ * Sometimes merging runs phase functions, possibly via perform_uninstall.
+ *
+ * \since 0.77
+ */
+ NamedValue<n::want_phase, std::function<WantPhase (const std::string &)> > want_phase;
};
/**
diff --git a/python/action.cc b/python/action.cc
index 581491a..650f280 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -93,7 +93,8 @@ namespace
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
}
diff --git a/ruby/action.cc b/ruby/action.cc
index f19fa46..15c19f7 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -729,7 +729,8 @@ namespace
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = &make_standard_output_manager,
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = &want_all_phases
));
VALUE tdata(Data_Wrap_Struct(self, 0, &Common<UninstallActionOptions>::free, ptr));
diff --git a/src/clients/cave/cmd_perform.cc b/src/clients/cave/cmd_perform.cc
index fd8be0b..4981e41 100644
--- a/src/clients/cave/cmd_perform.cc
+++ b/src/clients/cave/cmd_perform.cc
@@ -588,13 +588,15 @@ PerformCommand::run(
return EXIT_SUCCESS;
OutputManagerFromIPCOrEnvironment output_manager_holder(env.get(), cmdline, id);
+ WantInstallPhase want_phase(cmdline, output_manager_holder);
UninstallActionOptions options(make_named_values<UninstallActionOptions>(
n::config_protect() = cmdline.a_config_protect.argument(),
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
n::make_output_manager() = std::ref(output_manager_holder),
- n::override_contents() = make_null_shared_ptr()
+ n::override_contents() = make_null_shared_ptr(),
+ n::want_phase() = want_phase
));
UninstallAction uninstall_action(options);
execute(env, cmdline, id, action, uninstall_action, output_manager_holder);