aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-22 17:06:57 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-02-22 17:40:59 +0000
commite5c1faf7cfe38630d1e7d1bb430fe2d841af94a3 (patch)
tree6c1983942423fd1f97a8161a447344da4bf8646d /paludis/repositories
parent39050ab76715bebb2a800a7d53bc4bad7795d027 (diff)
downloadpaludis-e5c1faf7cfe38630d1e7d1bb430fe2d841af94a3.tar.gz
paludis-e5c1faf7cfe38630d1e7d1bb430fe2d841af94a3.tar.xz
Let merges uninstall things
Diffstat (limited to 'paludis/repositories')
-rw-r--r--paludis/repositories/accounts/accounts_id.cc32
-rw-r--r--paludis/repositories/e/e_installed_repository.hh3
-rw-r--r--paludis/repositories/e/e_installed_repository_id.cc3
-rw-r--r--paludis/repositories/e/e_repository_TEST.cc12
-rw-r--r--paludis/repositories/e/e_repository_TEST_ever.cc7
-rw-r--r--paludis/repositories/e/e_repository_TEST_exlibs.cc3
-rw-r--r--paludis/repositories/e/ebuild_entries.cc27
-rw-r--r--paludis/repositories/e/exndbam_repository.cc11
-rw-r--r--paludis/repositories/e/exndbam_repository.hh3
-rw-r--r--paludis/repositories/e/exndbam_repository_TEST.cc14
-rw-r--r--paludis/repositories/e/vdb_repository.cc15
-rw-r--r--paludis/repositories/e/vdb_repository.hh3
-rw-r--r--paludis/repositories/e/vdb_repository_TEST.cc33
-rw-r--r--paludis/repositories/unpackaged/installed_repository_TEST.cc13
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc27
-rw-r--r--paludis/repositories/unpackaged/unpackaged_repository_TEST.cc4
16 files changed, 120 insertions, 90 deletions
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index b1d10bfc9..a89cc840f 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -421,6 +421,19 @@ AccountsID::supports_action(const SupportsActionTestBase & test) const
return simple_visitor_cast<const SupportsActionTest<InstallAction> >(test);
}
+namespace
+{
+ std::tr1::shared_ptr<OutputManager> this_output_manager(const std::tr1::shared_ptr<OutputManager> & o, const Action &)
+ {
+ return o;
+ }
+
+ void used_this_for_config_protect(std::string & s, const std::string & v)
+ {
+ s = v;
+ }
+}
+
void
AccountsID::perform_action(Action & action) const
{
@@ -436,6 +449,8 @@ AccountsID::perform_action(Action & action) const
std::tr1::shared_ptr<OutputManager> output_manager(install_action->options.make_output_manager()(
*install_action));
+ std::string used_config_protect;
+
switch (install_action->options.want_phase()("merge"))
{
case wp_yes:
@@ -447,7 +462,9 @@ AccountsID::perform_action(Action & action) const
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
value_for<n::output_manager>(output_manager),
value_for<n::package_id>(shared_from_this()),
- value_for<n::used_this_for_config_protect>(install_action->options.used_this_for_config_protect())
+ 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))
));
}
break;
@@ -462,8 +479,6 @@ AccountsID::perform_action(Action & action) const
throw InternalError(PALUDIS_HERE, "bad WantPhase");
}
- output_manager->succeeded();
-
for (PackageIDSequence::ConstIterator i(install_action->options.replacing()->begin()), i_end(install_action->options.replacing()->end()) ;
i != i_end ; ++i)
{
@@ -472,7 +487,16 @@ AccountsID::perform_action(Action & action) const
&& (*i)->name() == name())
continue;
else
- install_action->options.perform_uninstall()(*i);
+ {
+ UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
+ value_for<n::config_protect>(used_config_protect),
+ value_for<n::is_overwrite>(false),
+ value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, output_manager, std::tr1::placeholders::_1))
+ ));
+ install_action->options.perform_uninstall()(*i, uo);
+ }
}
+
+ output_manager->succeeded();
}
diff --git a/paludis/repositories/e/e_installed_repository.hh b/paludis/repositories/e/e_installed_repository.hh
index 1368de1fb..ca1adbace 100644
--- a/paludis/repositories/e/e_installed_repository.hh
+++ b/paludis/repositories/e/e_installed_repository.hh
@@ -99,8 +99,7 @@ namespace paludis
virtual void perform_uninstall(
const std::tr1::shared_ptr<const erepository::ERepositoryID> & id,
- const UninstallAction &,
- bool reinstalling) const = 0;
+ const UninstallAction &) const = 0;
virtual void perform_config(
const std::tr1::shared_ptr<const erepository::ERepositoryID> & id,
diff --git a/paludis/repositories/e/e_installed_repository_id.cc b/paludis/repositories/e/e_installed_repository_id.cc
index 5cac0e355..d7c8e3ed5 100644
--- a/paludis/repositories/e/e_installed_repository_id.cc
+++ b/paludis/repositories/e/e_installed_repository_id.cc
@@ -876,8 +876,7 @@ namespace
void visit(const UninstallAction & a)
{
- std::tr1::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_uninstall(
- id, a, false);
+ std::tr1::static_pointer_cast<const EInstalledRepository>(id->repository())->perform_uninstall(id, a);
}
void visit(const InstalledAction &)
diff --git a/paludis/repositories/e/e_repository_TEST.cc b/paludis/repositories/e/e_repository_TEST.cc
index 5bf166558..402107590 100644
--- a/paludis/repositories/e/e_repository_TEST.cc
+++ b/paludis/repositories/e/e_repository_TEST.cc
@@ -58,7 +58,7 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
{
if (id)
throw InternalError(PALUDIS_HERE, "cannot uninstall");
@@ -79,10 +79,6 @@ namespace
return mm->second;
}
- void dummy_used_this_for_config_protect(const std::string &)
- {
- }
-
WantPhase want_all_phases(const std::string &)
{
return wp_yes;
@@ -1114,7 +1110,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -1372,7 +1367,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -1469,7 +1463,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -1596,7 +1589,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -1804,7 +1796,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -2389,7 +2380,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
diff --git a/paludis/repositories/e/e_repository_TEST_ever.cc b/paludis/repositories/e/e_repository_TEST_ever.cc
index 71320c725..830cba84b 100644
--- a/paludis/repositories/e/e_repository_TEST_ever.cc
+++ b/paludis/repositories/e/e_repository_TEST_ever.cc
@@ -58,7 +58,7 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
{
if (id)
throw InternalError(PALUDIS_HERE, "cannot uninstall");
@@ -79,10 +79,6 @@ namespace
return mm->second;
}
- void dummy_used_this_for_config_protect(const std::string &)
- {
- }
-
WantPhase want_all_phases(const std::string &)
{
return wp_yes;
@@ -154,7 +150,6 @@ namespace
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
diff --git a/paludis/repositories/e/e_repository_TEST_exlibs.cc b/paludis/repositories/e/e_repository_TEST_exlibs.cc
index 20fa8f39d..1dbead3e0 100644
--- a/paludis/repositories/e/e_repository_TEST_exlibs.cc
+++ b/paludis/repositories/e/e_repository_TEST_exlibs.cc
@@ -58,7 +58,7 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
{
if (id)
throw InternalError(PALUDIS_HERE, "cannot uninstall");
@@ -144,7 +144,6 @@ namespace
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index 1c78c5434..c8a0e231e 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -534,6 +534,16 @@ namespace
else
return ! b->slot_key();
}
+
+ void used_this_for_config_protect(std::string & s, const std::string & v)
+ {
+ s = v;
+ }
+
+ std::tr1::shared_ptr<OutputManager> this_output_manager(const std::tr1::shared_ptr<OutputManager> & o, const Action &)
+ {
+ return o;
+ }
}
void
@@ -639,6 +649,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
FSEntry package_builddir(_imp->params.builddir() / (stringify(id->name().category()) + "-" +
stringify(id->name().package()) + "-" + stringify(id->version())));
+ std::string used_config_protect;
+
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)
@@ -688,7 +700,9 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
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::used_this_for_config_protect>(install_action.options.used_this_for_config_protect())
+ 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"))
@@ -791,8 +805,6 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
}
}
- output_manager->succeeded();
-
for (PackageIDSequence::ConstIterator i(install_action.options.replacing()->begin()), i_end(install_action.options.replacing()->end()) ;
i != i_end ; ++i)
{
@@ -804,8 +816,15 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
if ((*i)->name() == id->name() && slot_is_same(*i, id))
continue;
- install_action.options.perform_uninstall()(*i);
+ UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
+ value_for<n::config_protect>(used_config_protect),
+ value_for<n::is_overwrite>(false),
+ value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, output_manager, std::tr1::placeholders::_1))
+ ));
+ install_action.options.perform_uninstall()(*i, uo);
}
+
+ output_manager->succeeded();
}
void
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 67821f831..f50db3620 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -412,9 +412,10 @@ ExndbamRepository::merge(const MergeParams & m)
{
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
+ value_for<n::is_overwrite>(true),
value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, m.output_manager(), std::tr1::placeholders::_1))
));
- perform_uninstall(std::tr1::static_pointer_cast<const ERepositoryID>(if_overwritten_id), uo, true);
+ m.perform_uninstall()(if_overwritten_id, uo);
}
if (std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id())
@@ -429,9 +430,10 @@ ExndbamRepository::merge(const MergeParams & m)
{
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, m.output_manager(), std::tr1::placeholders::_1))
));
- perform_uninstall(candidate, uo, false);
+ m.perform_uninstall()(candidate, uo);
}
}
}
@@ -447,10 +449,9 @@ ExndbamRepository::merge(const MergeParams & m)
void
ExndbamRepository::perform_uninstall(
const std::tr1::shared_ptr<const ERepositoryID> & id,
- const UninstallAction & a,
- bool replace) const
+ const UninstallAction & a) const
{
- Context context("When uninstalling '" + stringify(*id) + (replace ? "' for a reinstall:" : "':"));
+ Context context("When uninstalling '" + stringify(*id) + (a.options.is_overwrite() ? "' for an overwrite:" : "':"));
if (! _imp->params.root().is_directory())
throw InstallActionError("Couldn't uninstall '" + stringify(*id) +
diff --git a/paludis/repositories/e/exndbam_repository.hh b/paludis/repositories/e/exndbam_repository.hh
index f5212ff47..609f5ed5a 100644
--- a/paludis/repositories/e/exndbam_repository.hh
+++ b/paludis/repositories/e/exndbam_repository.hh
@@ -117,8 +117,7 @@ namespace paludis
void perform_uninstall(
const std::tr1::shared_ptr<const erepository::ERepositoryID> & id,
- const UninstallAction &,
- bool reinstalling) const;
+ const UninstallAction &) const;
///\}
diff --git a/paludis/repositories/e/exndbam_repository_TEST.cc b/paludis/repositories/e/exndbam_repository_TEST.cc
index 9608cfa8f..d03bd5f2e 100644
--- a/paludis/repositories/e/exndbam_repository_TEST.cc
+++ b/paludis/repositories/e/exndbam_repository_TEST.cc
@@ -40,10 +40,10 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void do_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions & u)
{
- if (id)
- throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ UninstallAction a(u);
+ id->perform_action(a);
}
std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
@@ -61,10 +61,6 @@ namespace
return mm->second;
}
- void dummy_used_this_for_config_protect(const std::string &)
- {
- }
-
WantPhase want_all_phases(const std::string &)
{
return wp_yes;
@@ -136,14 +132,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(exndbam_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 6a83bad65..c0007b290 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -375,10 +375,9 @@ VDBRepositoryKeyReadError::VDBRepositoryKeyReadError(
void
VDBRepository::perform_uninstall(
const std::tr1::shared_ptr<const ERepositoryID> & id,
- const UninstallAction & a,
- bool reinstalling) const
+ const UninstallAction & a) const
{
- Context context("When uninstalling '" + stringify(*id) + (reinstalling ? "' for a reinstall:" : "':"));
+ Context context("When uninstalling '" + stringify(*id) + (a.options.is_overwrite() ? "' for an overwrite:" : "':"));
if (! _imp->params.root().is_directory())
throw InstallActionError("Couldn't uninstall '" + stringify(*id) +
@@ -386,7 +385,7 @@ VDBRepository::perform_uninstall(
std::tr1::shared_ptr<OutputManager> output_manager(a.options.make_output_manager()(a));
- std::string reinstalling_str(reinstalling ? "-reinstalling-" : "");
+ std::string reinstalling_str(a.options.is_overwrite() ? "-reinstalling-" : "");
std::tr1::shared_ptr<FSEntrySequence> eclassdirs(new FSEntrySequence);
eclassdirs->push_back(FSEntry(_imp->params.location() / stringify(id->name().category()) /
@@ -484,7 +483,7 @@ VDBRepository::perform_uninstall(
FSEntry(*d).unlink();
pkg_dir.rmdir();
- if (! reinstalling)
+ if (! a.options.is_overwrite())
{
std::tr1::shared_ptr<const PackageIDSequence> ids(package_ids(id->name()));
bool only(true);
@@ -918,9 +917,10 @@ VDBRepository::merge(const MergeParams & m)
{
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
+ value_for<n::is_overwrite>(true),
value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, m.output_manager(), std::tr1::placeholders::_1))
));
- perform_uninstall(is_replace, uo, true);
+ m.perform_uninstall()(is_replace, uo);
}
if (std::tr1::static_pointer_cast<const ERepositoryID>(m.package_id())
@@ -935,9 +935,10 @@ VDBRepository::merge(const MergeParams & m)
{
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, m.output_manager(), std::tr1::placeholders::_1))
));
- perform_uninstall(candidate, uo, false);
+ m.perform_uninstall()(candidate, uo);
}
}
}
diff --git a/paludis/repositories/e/vdb_repository.hh b/paludis/repositories/e/vdb_repository.hh
index f5f042121..971c59ac3 100644
--- a/paludis/repositories/e/vdb_repository.hh
+++ b/paludis/repositories/e/vdb_repository.hh
@@ -121,8 +121,7 @@ namespace paludis
virtual void perform_uninstall(
const std::tr1::shared_ptr<const erepository::ERepositoryID> & id,
- const UninstallAction &,
- bool reinstalling) const;
+ const UninstallAction &) const;
/* RepositoryProvidesInterface */
diff --git a/paludis/repositories/e/vdb_repository_TEST.cc b/paludis/repositories/e/vdb_repository_TEST.cc
index b8d95b714..d703fec8d 100644
--- a/paludis/repositories/e/vdb_repository_TEST.cc
+++ b/paludis/repositories/e/vdb_repository_TEST.cc
@@ -51,10 +51,10 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void do_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions & u)
{
- if (id)
- throw InternalError(PALUDIS_HERE, "cannot uninstall");
+ UninstallAction a(u);
+ id->perform_action(a);
}
std::tr1::shared_ptr<OutputManager> make_standard_output_manager(const Action &)
@@ -72,10 +72,6 @@ namespace
return mm->second;
}
- void dummy_used_this_for_config_protect(const std::string &)
- {
- }
-
WantPhase want_all_phases(const std::string &)
{
return wp_yes;
@@ -350,14 +346,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
@@ -478,14 +474,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
@@ -606,14 +602,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
@@ -1006,14 +1002,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
@@ -1247,9 +1243,8 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
@@ -1341,14 +1336,14 @@ namespace test_cases
InstallAction install_action(make_named_values<InstallActionOptions>(
value_for<n::destination>(vdb_repo),
value_for<n::make_output_manager>(&make_standard_output_manager),
- value_for<n::perform_uninstall>(&cannot_uninstall),
+ value_for<n::perform_uninstall>(&do_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
UninstallAction uninstall_action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
diff --git a/paludis/repositories/unpackaged/installed_repository_TEST.cc b/paludis/repositories/unpackaged/installed_repository_TEST.cc
index 202d7567e..a677a0cc8 100644
--- a/paludis/repositories/unpackaged/installed_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/installed_repository_TEST.cc
@@ -44,7 +44,7 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
{
if (id)
throw InternalError(PALUDIS_HERE, "cannot uninstall");
@@ -80,10 +80,6 @@ namespace
}
};
- void dummy_used_this_for_config_protect(const std::string &)
- {
- }
-
WantPhase want_all_phases(const std::string &)
{
return wp_yes;
@@ -266,6 +262,7 @@ namespace test_cases
UninstallAction action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
id->perform_action(action);
@@ -318,6 +315,7 @@ namespace test_cases
UninstallAction action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
id->perform_action(action);
@@ -405,7 +403,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
(*env[selection::RequireExactlyOne(generator::InRepository(RepositoryName("unpackaged")))]->begin())->perform_action(action);
@@ -463,7 +460,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
(*env[selection::RequireExactlyOne(generator::InRepository(RepositoryName("unpackaged")))]->begin())->perform_action(action);
@@ -524,7 +520,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
(*env[selection::RequireExactlyOne(generator::InRepository(RepositoryName("unpackaged")))]->begin())->perform_action(action);
@@ -566,6 +561,7 @@ namespace test_cases
UninstallAction action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
(*env[selection::RequireExactlyOne(generator::Matches(
@@ -609,6 +605,7 @@ namespace test_cases
UninstallAction action(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(""),
+ value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(&make_standard_output_manager)
));
(*env[selection::RequireExactlyOne(generator::Matches(
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index ced8e4875..77c8f1032 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -294,6 +294,16 @@ namespace
else
return ! b->slot_key();
}
+
+ void used_this_for_config_protect(std::string & s, const std::string & v)
+ {
+ s = v;
+ }
+
+ std::tr1::shared_ptr<OutputManager> this_output_manager(const std::tr1::shared_ptr<OutputManager> & o, const Action &)
+ {
+ return o;
+ }
}
void
@@ -327,6 +337,8 @@ UnpackagedID::perform_action(Action & action) const
std::tr1::shared_ptr<const ChoiceValue> split_choice(choices_key()->value()->find_by_name_with_prefix(
ELikeSplitChoiceValue::canonical_name_with_prefix()));
+ std::string used_config_protect;
+
switch (install_action->options.want_phase()("strip"))
{
case wp_yes:
@@ -365,7 +377,9 @@ UnpackagedID::perform_action(Action & action) const
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
value_for<n::output_manager>(output_manager),
value_for<n::package_id>(shared_from_this()),
- value_for<n::used_this_for_config_protect>(install_action->options.used_this_for_config_protect())
+ 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))
));
}
break;
@@ -380,8 +394,6 @@ UnpackagedID::perform_action(Action & action) const
throw InternalError(PALUDIS_HERE, "bad WantPhase");
}
- output_manager->succeeded();
-
for (PackageIDSequence::ConstIterator i(install_action->options.replacing()->begin()), i_end(install_action->options.replacing()->end()) ;
i != i_end ; ++i)
{
@@ -389,8 +401,15 @@ UnpackagedID::perform_action(Action & action) const
if ((*i)->name() == name() && (*i)->version() == version() && slot_is_same(*i, this))
continue;
- install_action->options.perform_uninstall()(*i);
+ UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
+ value_for<n::config_protect>(used_config_protect),
+ value_for<n::is_overwrite>(false),
+ value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, output_manager, std::tr1::placeholders::_1))
+ ));
+ install_action->options.perform_uninstall()(*i, uo);
}
+
+ output_manager->succeeded();
}
void
diff --git a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
index 2a030c1f3..f663d8d91 100644
--- a/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
+++ b/paludis/repositories/unpackaged/unpackaged_repository_TEST.cc
@@ -42,7 +42,7 @@ using namespace paludis;
namespace
{
- void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id)
+ void cannot_uninstall(const std::tr1::shared_ptr<const PackageID> & id, const UninstallActionOptions &)
{
if (id)
throw InternalError(PALUDIS_HERE, "cannot uninstall");
@@ -245,7 +245,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
id->perform_action(action);
@@ -302,7 +301,6 @@ namespace test_cases
value_for<n::make_output_manager>(&make_standard_output_manager),
value_for<n::perform_uninstall>(&cannot_uninstall),
value_for<n::replacing>(make_shared_ptr(new PackageIDSequence)),
- value_for<n::used_this_for_config_protect>(&dummy_used_this_for_config_protect),
value_for<n::want_phase>(&want_all_phases)
));
id->perform_action(action);