aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 13:56:53 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 13:56:53 +0100
commitf25a66dadbe4a9fbb8331e9a4f14462341b40832 (patch)
tree1cbbf9a4c53862e8e74c0774830ebac83d30fac7
parent2d0feb6ef4b6b39f6322cf446d358c808b52f596 (diff)
downloadpaludis-f25a66dadbe4a9fbb8331e9a4f14462341b40832.tar.gz
paludis-f25a66dadbe4a9fbb8331e9a4f14462341b40832.tar.xz
Allow overriding options
-rw-r--r--paludis/action.hh17
-rw-r--r--paludis/repositories/accounts/accounts_id.cc3
-rw-r--r--paludis/repositories/e/do_install_action.cc4
-rw-r--r--paludis/repositories/e/exndbam_repository.cc6
-rw-r--r--paludis/repositories/e/vdb_repository.cc9
-rw-r--r--paludis/repositories/e/vdb_repository_TEST_cache.cc6
-rw-r--r--paludis/repositories/e/vdb_repository_TEST_eapis.cc6
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc3
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc12
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc3
-rw-r--r--python/action.cc3
-rw-r--r--ruby/action.cc3
-rw-r--r--src/clients/cave/cmd_perform.cc3
13 files changed, 57 insertions, 21 deletions
diff --git a/paludis/action.hh b/paludis/action.hh
index fdf1589..8e16793 100644
--- a/paludis/action.hh
+++ b/paludis/action.hh
@@ -23,6 +23,9 @@
#include <paludis/action-fwd.hh>
#include <paludis/repository-fwd.hh>
#include <paludis/package_id-fwd.hh>
+#include <paludis/contents-fwd.hh>
+#include <paludis/output_manager-fwd.hh>
+
#include <paludis/util/attributes.hh>
#include <paludis/util/visitor.hh>
#include <paludis/util/exception.hh>
@@ -31,8 +34,8 @@
#include <paludis/util/named_value.hh>
#include <paludis/util/fs_path-fwd.hh>
#include <paludis/util/options.hh>
-#include <paludis/output_manager-fwd.hh>
#include <paludis/util/type_list.hh>
+
#include <functional>
/** \file
@@ -61,6 +64,7 @@ namespace paludis
typedef Name<struct name_ignore_unfetched> ignore_unfetched;
typedef Name<struct name_is_overwrite> is_overwrite;
typedef Name<struct name_make_output_manager> make_output_manager;
+ typedef Name<struct name_override_contents> override_contents;
typedef Name<struct name_perform_uninstall> perform_uninstall;
typedef Name<struct name_replacing> replacing;
typedef Name<struct name_requires_manual_fetching> requires_manual_fetching;
@@ -219,6 +223,17 @@ namespace paludis
*/
NamedValue<n::make_output_manager, std::function<std::shared_ptr<OutputManager> (
const UninstallAction &)> > make_output_manager;
+
+ /**
+ * Sometimes we need to override the contents of an installed package,
+ * for example when doing 'overwrite' merges for VDB.
+ *
+ * Not all repositories support this, or do what you expect with it. Clients
+ * should always set this to null.
+ *
+ * \since 0.61
+ */
+ NamedValue<n::override_contents, std::shared_ptr<const Contents> > override_contents;
};
/**
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index e8a13e8..c84bf10 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -571,7 +571,8 @@ AccountsID::perform_action(Action & action) const
n::if_for_install_id() = shared_from_this(),
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::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
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 bcd550a..6ed6d2a 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -36,6 +36,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/log.hh>
#include <paludis/util/join.hh>
+#include <paludis/util/make_null_shared_ptr.hh>
#include <paludis/action.hh>
#include <paludis/dep_spec_flattener.hh>
@@ -439,7 +440,8 @@ paludis::erepository::do_install_action(
n::ignore_for_unmerge() = std::bind(&ignore_merged, merged_entries,
std::placeholders::_1),
n::is_overwrite() = false,
- n::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1)
+ n::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
install_action.options.perform_uninstall()(*i, uo);
}
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 0eed579..92e9977 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -457,7 +457,8 @@ ExndbamRepository::merge(const MergeParams & m)
n::ignore_for_unmerge() = std::bind(&ignore_merged, m.merged_entries(),
std::placeholders::_1),
n::is_overwrite() = true,
- n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1)
+ n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
m.perform_uninstall()(if_overwritten_id, uo);
}
@@ -478,7 +479,8 @@ ExndbamRepository::merge(const MergeParams & m)
n::ignore_for_unmerge() = std::bind(&ignore_merged, m.merged_entries(),
std::placeholders::_1),
n::is_overwrite() = false,
- n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1)
+ n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
m.perform_uninstall()(candidate, uo);
}
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 99209e1..f3098d5 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -964,12 +964,13 @@ VDBRepository::merge(const MergeParams & m)
return;
}
+ std::shared_ptr<const Contents> is_replace_contents;
if (is_replace)
{
/* hack: before we nuke its vdb dir, preload CONTENTS */
if (! is_replace->contents_key())
throw InternalError(PALUDIS_HERE, "No contents key in " + stringify(*is_replace) + ". How did that happen?");
- is_replace->contents_key()->value();
+ is_replace_contents = is_replace->contents_key()->value();
FSPath old_vdb_dir(_imp->params.location());
old_vdb_dir /= stringify(is_replace->name().category());
@@ -1011,7 +1012,8 @@ VDBRepository::merge(const MergeParams & m)
n::ignore_for_unmerge() = std::bind(&ignore_merged, m.merged_entries(),
std::placeholders::_1),
n::is_overwrite() = true,
- n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1)
+ n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
+ n::override_contents() = is_replace_contents
));
m.perform_uninstall()(is_replace, uo);
}
@@ -1032,7 +1034,8 @@ VDBRepository::merge(const MergeParams & m)
n::ignore_for_unmerge() = std::bind(&ignore_merged, m.merged_entries(),
std::placeholders::_1),
n::is_overwrite() = false,
- n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1)
+ n::make_output_manager() = std::bind(&this_output_manager, m.output_manager(), std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
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 9b5a5c0..0091c95 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::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
{
@@ -451,7 +452,8 @@ TEST(ProvidesCache, Incremental)
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
EXPECT_EQ("paludis-3\ninstalled\n", read_file(provides_cache));
diff --git a/paludis/repositories/e/vdb_repository_TEST_eapis.cc b/paludis/repositories/e/vdb_repository_TEST_eapis.cc
index ee0281c..e9adab4 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::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
InfoActionOptions info_action_options(make_named_values<InfoActionOptions>(
@@ -269,7 +270,8 @@ TEST_P(VarsTest, Works)
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
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 6875c5f..9623712 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -284,7 +284,8 @@ UnavailableRepositoryID::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)
+ &this_output_manager, output_manager, std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
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 31e3c55..81a5854 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -247,7 +247,8 @@ TEST(InstalledRepository, UninstallLast)
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
id->perform_action(action);
@@ -293,7 +294,8 @@ TEST(InstalledRepository, UninstallNotLast)
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
id->perform_action(action);
@@ -527,7 +529,8 @@ TEST(InstalledRepository, MultipleOps)
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
(*env[selection::RequireExactlyOne(generator::Matches(
parse_user_package_dep_spec("cat/pkg4a",
@@ -571,7 +574,8 @@ TEST(InstalledRepository, MultipleOps)
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
(*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 1eb637f..940b2f8 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -506,7 +506,8 @@ UnpackagedID::perform_action(Action & action) const
n::if_for_install_id() = shared_from_this(),
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::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1),
+ n::override_contents() = make_null_shared_ptr()
));
install_action->options.perform_uninstall()(*i, uo);
}
diff --git a/python/action.cc b/python/action.cc
index 1803b54..581491a 100644
--- a/python/action.cc
+++ b/python/action.cc
@@ -92,7 +92,8 @@ namespace
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
}
diff --git a/ruby/action.cc b/ruby/action.cc
index 3876b00..f19fa46 100644
--- a/ruby/action.cc
+++ b/ruby/action.cc
@@ -728,7 +728,8 @@ namespace
n::if_for_install_id() = make_null_shared_ptr(),
n::ignore_for_unmerge() = &ignore_nothing,
n::is_overwrite() = false,
- n::make_output_manager() = &make_standard_output_manager
+ n::make_output_manager() = &make_standard_output_manager,
+ n::override_contents() = make_null_shared_ptr()
));
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 b9d4820..fd8be0b 100644
--- a/src/clients/cave/cmd_perform.cc
+++ b/src/clients/cave/cmd_perform.cc
@@ -593,7 +593,8 @@ PerformCommand::run(
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::make_output_manager() = std::ref(output_manager_holder),
+ n::override_contents() = make_null_shared_ptr()
));
UninstallAction uninstall_action(options);
execute(env, cmdline, id, action, uninstall_action, output_manager_holder);