aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/vdb_repository.cc
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/repositories/e/vdb_repository.cc')
-rw-r--r--paludis/repositories/e/vdb_repository.cc76
1 files changed, 40 insertions, 36 deletions
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 904246844..c8e19541e 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -893,44 +893,49 @@ VDBRepository::merge(const MergeParams & m)
std::shared_ptr<const ERepositoryID> is_replace(package_id_if_exists(m.package_id()->name(), m.package_id()->version()));
+ std::string config_protect, config_protect_mask;
+
FSPath tmp_vdb_dir(_imp->params.location());
- if (! tmp_vdb_dir.stat().exists())
- tmp_vdb_dir.mkdir(0755, { });
tmp_vdb_dir /= stringify(m.package_id()->name().category());
- if (! tmp_vdb_dir.stat().exists())
- tmp_vdb_dir.mkdir(0755, { });
tmp_vdb_dir /= ("-checking-" + stringify(m.package_id()->name().package()) + "-" + stringify(m.package_id()->version()));
- tmp_vdb_dir.mkdir(0755, { });
- WriteVDBEntryCommand write_vdb_entry_command(
- make_named_values<WriteVDBEntryParams>(
- n::environment() = _imp->params.environment(),
- n::environment_file() = m.environment_file(),
- n::maybe_output_manager() = m.output_manager(),
- n::output_directory() = tmp_vdb_dir,
- n::package_id() = std::static_pointer_cast<const ERepositoryID>(m.package_id())
- ));
+ if (! m.check())
+ {
+ if (! tmp_vdb_dir.dirname().dirname().stat().exists())
+ tmp_vdb_dir.dirname().dirname().mkdir(0755, { });
+ if (! tmp_vdb_dir.dirname().stat().exists())
+ tmp_vdb_dir.dirname().mkdir(0755, { });
+ tmp_vdb_dir.mkdir(0755, { });
- write_vdb_entry_command();
+ WriteVDBEntryCommand write_vdb_entry_command(
+ make_named_values<WriteVDBEntryParams>(
+ n::environment() = _imp->params.environment(),
+ n::environment_file() = m.environment_file(),
+ n::maybe_output_manager() = m.output_manager(),
+ n::output_directory() = tmp_vdb_dir,
+ n::package_id() = std::static_pointer_cast<const ERepositoryID>(m.package_id())
+ ));
- /* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb */
- std::string config_protect, config_protect_mask;
- try
- {
- SafeIFStream c(tmp_vdb_dir / "CONFIG_PROTECT");
- config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>());
- }
- catch (const SafeIFStreamError &)
- {
- }
+ write_vdb_entry_command();
- try
- {
- SafeIFStream c_m(tmp_vdb_dir / "CONFIG_PROTECT_MASK");
- config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>());
- }
- catch (const SafeIFStreamError &)
- {
+ /* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb */
+ try
+ {
+ SafeIFStream c(tmp_vdb_dir / "CONFIG_PROTECT");
+ config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>());
+ }
+ catch (const SafeIFStreamError &)
+ {
+ }
+
+ try
+ {
+ SafeIFStream c_m(tmp_vdb_dir / "CONFIG_PROTECT_MASK");
+ config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>());
+ }
+ catch (const SafeIFStreamError &)
+ {
+ }
}
FSPath vdb_dir(_imp->params.location());
@@ -957,12 +962,11 @@ VDBRepository::merge(const MergeParams & m)
(m.used_this_for_config_protect())(config_protect);
- if (! merger.check())
+ if (m.check())
{
- for (FSIterator d(tmp_vdb_dir, { fsio_include_dotfiles, fsio_inode_sort }), d_end ; d != d_end ; ++d)
- d->unlink();
- tmp_vdb_dir.rmdir();
- throw ActionFailedError("Not proceeding with install due to merge sanity check failing");
+ if (! merger.check())
+ throw ActionFailedError("Not proceeding with install due to merge sanity check failing");
+ return;
}
if (is_replace)