aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-08 19:50:41 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-12-08 20:33:47 +0000
commit1bb75d1a67d4a857a15f4fdb140cabade672214c (patch)
treead0f3703b09e6d8e62566b10db46a36147fdce7c
parentb403744d94299bf5dc4c5a1a7650a76d70d2d72c (diff)
downloadpaludis-1bb75d1a67d4a857a15f4fdb140cabade672214c.tar.gz
paludis-1bb75d1a67d4a857a15f4fdb140cabade672214c.tar.xz
Support replacing for pbin merges
-rw-r--r--paludis/repositories/e/do_install_action.cc38
-rw-r--r--paludis/repositories/e/e_repository.cc33
2 files changed, 46 insertions, 25 deletions
diff --git a/paludis/repositories/e/do_install_action.cc b/paludis/repositories/e/do_install_action.cc
index c009a44..35cd931 100644
--- a/paludis/repositories/e/do_install_action.cc
+++ b/paludis/repositories/e/do_install_action.cc
@@ -412,27 +412,29 @@ paludis::erepository::do_install_action(
}
}
- for (PackageIDSequence::ConstIterator i(install_action.options.replacing()->begin()), i_end(install_action.options.replacing()->end()) ;
- i != i_end ; ++i)
- {
- Context local_context("When cleaning '" + stringify(**i) + "':");
- if ((*i)->name() == id->name() && (*i)->version() == id->version())
- continue;
-
- if (id->eapi()->supported()->ebuild_phases()->ebuild_new_upgrade_phase_order())
- if ((*i)->name() == id->name() && slot_is_same(*i, id))
+ /* replacing for pbins is done during the merge */
+ if (install_action.options.destination()->installed_root_key())
+ for (PackageIDSequence::ConstIterator i(install_action.options.replacing()->begin()), i_end(install_action.options.replacing()->end()) ;
+ i != i_end ; ++i)
+ {
+ Context local_context("When cleaning '" + stringify(**i) + "':");
+ if ((*i)->name() == id->name() && (*i)->version() == id->version())
continue;
- UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
- n::config_protect() = used_config_protect,
- n::if_for_install_id() = id,
- n::ignore_for_unmerge() = std::bind(&ignore_merged, merged_entries,
+ if (id->eapi()->supported()->ebuild_phases()->ebuild_new_upgrade_phase_order())
+ if ((*i)->name() == id->name() && slot_is_same(*i, id))
+ continue;
+
+ UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
+ n::config_protect() = used_config_protect,
+ n::if_for_install_id() = id,
+ 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)
- ));
- install_action.options.perform_uninstall()(*i, uo);
- }
+ n::is_overwrite() = false,
+ n::make_output_manager() = std::bind(&this_output_manager, output_manager, std::placeholders::_1)
+ ));
+ install_action.options.perform_uninstall()(*i, uo);
+ }
output_manager->succeeded();
}
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 020d239..ca39d28 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -1943,29 +1943,48 @@ ERepository::merge(const MergeParams & m)
write_binary_ebuild_command();
+ std::list<std::shared_ptr<const PackageID> > replaces;
+
if (is_replace)
{
/* 0.1 replacing 00.1 etc */
if (is_replace->fs_location_key()->value() != binary_ebuild_location)
FSPath(is_replace->fs_location_key()->value()).unlink();
+ replaces.push_back(is_replace);
+ }
+
+ for (auto r(m.replacing()->begin()), r_end(m.replacing()->end()) ;
+ r != r_end ; ++r)
+ {
+ if (is_replace && (*r)->name() == is_replace->name() && (*r)->version() == is_replace->version())
+ continue;
- do
+ if ((*r)->repository()->name() != name())
+ continue;
+
+ FSPath p((*r)->fs_location_key()->value());
+ FSStat p_stat(p);
+ if (p_stat.exists())
+ p.unlink();
+
+ replaces.push_back(*r);
+ }
+
+ if (_imp->params.write_cache() != FSPath("/var/empty"))
+ for (auto r(replaces.begin()), r_end(replaces.end()) ;
+ r != r_end ; ++r)
{
FSPath cache(_imp->params.write_cache());
- if (cache == FSPath("/var/empty"))
- break;
if (_imp->params.append_repository_name_to_write_cache())
cache /= stringify(name());
- cache /= stringify(is_replace->name().category());
- cache /= (stringify(is_replace->name().package()) + "-" + stringify(is_replace->version()));
+ cache /= stringify((*r)->name().category());
+ cache /= (stringify((*r)->name().package()) + "-" + stringify((*r)->version()));
if (cache.stat().is_regular_file_or_symlink_to_regular_file())
cache.unlink();
}
- while (false);
- }
if (! has_category_named(m.package_id()->name().category()))
{