aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2007-02-21 23:10:20 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2007-02-21 23:10:20 +0000
commitce219d257ad400a9ecd09124e70bb70a682ac0a1 (patch)
tree70a21a49dc76797958337b1d43574c6eed2a17a1
parentee50c126cfb72b062f7c0506fd08425a5b42ca80 (diff)
downloadpaludis-ce219d257ad400a9ecd09124e70bb70a682ac0a1.tar.gz
paludis-ce219d257ad400a9ecd09124e70bb70a682ac0a1.tar.xz
Make paludis --contents, --best-version etc work in merger_check_ hooks.
-rw-r--r--paludis/repositories/gentoo/vdb_repository.cc33
1 files changed, 22 insertions, 11 deletions
diff --git a/paludis/repositories/gentoo/vdb_repository.cc b/paludis/repositories/gentoo/vdb_repository.cc
index 9d7e1f0..389b5e6 100644
--- a/paludis/repositories/gentoo/vdb_repository.cc
+++ b/paludis/repositories/gentoo/vdb_repository.cc
@@ -1610,20 +1610,18 @@ VDBRepository::merge(const MergeOptions & m)
bool is_replace(has_version(m.package.name, m.package.version));
- FSEntry vdb_dir(_imp->params.location);
- vdb_dir.mkdir();
- vdb_dir /= stringify(m.package.name.category);
- vdb_dir.mkdir();
- vdb_dir /= (stringify(m.package.name.package) + "-" + stringify(m.package.version));
- if (is_replace)
- vdb_dir.rename(vdb_dir.dirname() / ("-reinstalling-" + vdb_dir.basename()));
- vdb_dir.mkdir();
+ FSEntry tmp_vdb_dir(_imp->params.location);
+ tmp_vdb_dir.mkdir();
+ tmp_vdb_dir /= stringify(m.package.name.category);
+ tmp_vdb_dir.mkdir();
+ tmp_vdb_dir /= ("-checking-" + stringify(m.package.name.package) + "-" + stringify(m.package.version));
+ tmp_vdb_dir.mkdir();
WriteVDBEntryCommand write_vdb_entry_command(
WriteVDBEntryParams::create()
.environment(_imp->params.environment)
.db_entry(m.package)
- .output_directory(vdb_dir)
+ .output_directory(tmp_vdb_dir)
.environment_file(m.environment_file));
write_vdb_entry_command();
@@ -1631,13 +1629,17 @@ VDBRepository::merge(const MergeOptions & m)
/* load CONFIG_PROTECT, CONFIG_PROTECT_MASK from vdb */
std::string config_protect, config_protect_mask;
{
- std::ifstream c(stringify(vdb_dir / "CONFIG_PROTECT").c_str());
+ std::ifstream c(stringify(tmp_vdb_dir / "CONFIG_PROTECT").c_str());
config_protect = std::string((std::istreambuf_iterator<char>(c)), std::istreambuf_iterator<char>());
- std::ifstream c_m(stringify(vdb_dir / "CONFIG_PROTECT_MASK").c_str());
+ std::ifstream c_m(stringify(tmp_vdb_dir / "CONFIG_PROTECT_MASK").c_str());
config_protect_mask = std::string((std::istreambuf_iterator<char>(c_m)), std::istreambuf_iterator<char>());
}
+ FSEntry vdb_dir(_imp->params.location);
+ vdb_dir /= stringify(m.package.name.category);
+ vdb_dir /= (stringify(m.package.name.package) + "-" + stringify(m.package.version));
+
VDBMerger merger(
VDBMergerOptions::create()
.environment(_imp->params.environment)
@@ -1649,7 +1651,16 @@ VDBRepository::merge(const MergeOptions & m)
.package(&m.package));
if (! merger.check())
+ {
+ for (DirIterator d(tmp_vdb_dir, false), d_end ; d != d_end ; ++d)
+ FSEntry(*d).unlink();
+ tmp_vdb_dir.rmdir();
throw PackageInstallActionError("Not proceeding with install due to merge sanity check failing");
+ }
+
+ if (is_replace)
+ vdb_dir.rename(vdb_dir.dirname() / ("-reinstalling-" + vdb_dir.basename()));
+ tmp_vdb_dir.rename(vdb_dir);
merger.merge();