aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 14:08:53 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2011-04-12 14:08:53 +0100
commit271074eb112e276d5ba25f91785431911ee3443f (patch)
tree188d64e702626d9972e7aafcc13d2e3fe814ce9a
parentf25a66dadbe4a9fbb8331e9a4f14462341b40832 (diff)
downloadpaludis-271074eb112e276d5ba25f91785431911ee3443f.tar.gz
paludis-271074eb112e276d5ba25f91785431911ee3443f.tar.xz
Make use of override_contents for VDB
-rw-r--r--paludis/repositories/e/vdb_repository.cc5
-rw-r--r--paludis/repositories/e/vdb_unmerger.cc6
-rw-r--r--paludis/repositories/e/vdb_unmerger.hh2
-rw-r--r--paludis/repositories/e/vdb_unmerger_TEST.cc8
4 files changed, 14 insertions, 7 deletions
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index f3098d5..7ccb5d5 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -467,11 +467,16 @@ VDBRepository::perform_uninstall(
std::string final_config_protect(config_protect + " " + a.options.config_protect());
+ std::shared_ptr<const Contents> contents(a.options.override_contents());
+ if (! contents)
+ contents = id->contents_key()->value();
+
/* unmerge */
VDBUnmerger unmerger(
make_named_values<VDBUnmergerOptions>(
n::config_protect() = final_config_protect,
n::config_protect_mask() = config_protect_mask,
+ n::contents() = contents,
n::environment() = _imp->params.environment(),
n::ignore() = a.options.ignore_for_unmerge(),
n::output_manager() = output_manager,
diff --git a/paludis/repositories/e/vdb_unmerger.cc b/paludis/repositories/e/vdb_unmerger.cc
index e9ed59c..9178010 100644
--- a/paludis/repositories/e/vdb_unmerger.cc
+++ b/paludis/repositories/e/vdb_unmerger.cc
@@ -191,11 +191,7 @@ namespace
void
VDBUnmerger::populate_unmerge_set()
{
- if (! _imp->options.package_id()->contents_key()->value())
- throw VDBUnmergerError("Id '" + stringify(*_imp->options.package_id()) + "' has no contents key");
-
- std::shared_ptr<const Contents> contents(_imp->options.package_id()->contents_key()->value());
- for (Contents::ConstIterator c(contents->begin()), c_end(contents->end()) ;
+ for (Contents::ConstIterator c(_imp->options.contents()->begin()), c_end(_imp->options.contents()->end()) ;
c != c_end ; ++c)
add_unmerge_entry(get_et(**c), *c);
}
diff --git a/paludis/repositories/e/vdb_unmerger.hh b/paludis/repositories/e/vdb_unmerger.hh
index ad2bd76..c3f49f9 100644
--- a/paludis/repositories/e/vdb_unmerger.hh
+++ b/paludis/repositories/e/vdb_unmerger.hh
@@ -33,6 +33,7 @@ namespace paludis
{
typedef Name<struct name_config_protect> config_protect;
typedef Name<struct name_config_protect_mask> config_protect_mask;
+ typedef Name<struct name_contents> contents;
typedef Name<struct name_environment> environment;
typedef Name<struct name_ignore> ignore;
typedef Name<struct name_output_manager> output_manager;
@@ -51,6 +52,7 @@ namespace paludis
{
NamedValue<n::config_protect, std::string> config_protect;
NamedValue<n::config_protect_mask, std::string> config_protect_mask;
+ NamedValue<n::contents, std::shared_ptr<const Contents> > contents;
NamedValue<n::environment, Environment *> environment;
NamedValue<n::ignore, const std::function<bool (const FSPath &)> > ignore;
NamedValue<n::output_manager, std::shared_ptr<OutputManager> > output_manager;
diff --git a/paludis/repositories/e/vdb_unmerger_TEST.cc b/paludis/repositories/e/vdb_unmerger_TEST.cc
index 4d7fc23..9ce2c82 100644
--- a/paludis/repositories/e/vdb_unmerger_TEST.cc
+++ b/paludis/repositories/e/vdb_unmerger_TEST.cc
@@ -38,6 +38,7 @@
#include <paludis/selection.hh>
#include <paludis/filtered_generator.hh>
#include <paludis/filter.hh>
+#include <paludis/metadata_key.hh>
#include <algorithm>
@@ -116,14 +117,17 @@ namespace
repo = VDBRepository::repository_factory_create(&env, std::bind(from_keys, keys, std::placeholders::_1));
env.add_repository(0, repo);
+ auto id(*env[selection::RequireExactlyOne(generator::Matches(
+ parse_user_package_dep_spec("cat/" + fix(what), &env, { }), make_null_shared_ptr(), { }))]->begin());
+
unmerger = std::make_shared<VDBUnmergerNoDisplay>(make_named_values<VDBUnmergerOptions>(
n::config_protect() = "/protected_file /protected_dir",
n::config_protect_mask() = "/protected_dir/unprotected_file /protected_dir/unprotected_dir",
+ n::contents() = id->contents_key()->value(),
n::environment() = &env,
n::ignore() = &ignore_nothing,
n::output_manager() = std::make_shared<StandardOutputManager>(),
- n::package_id() = *env[selection::RequireExactlyOne(generator::Matches(
- parse_user_package_dep_spec("cat/" + fix(what), &env, { }), make_null_shared_ptr(), { }))]->begin(),
+ n::package_id() = id,
n::root() = root_dir
));
}