aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-01-14 21:27:47 +0000
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2012-01-14 21:33:27 +0000
commit95bd57bb886a5673bd690760b0041f70e1c11b11 (patch)
tree43fa58145a65d5b4bc3d3c9d1ea392e0e4bb90ce
parent77cd8163e95257f9aaf4fc40aa3ea5c42bc6cd26 (diff)
downloadpaludis-95bd57bb886a5673bd690760b0041f70e1c11b11.tar.gz
paludis-95bd57bb886a5673bd690760b0041f70e1c11b11.tar.xz
Allow some FSMerger warnings to be fatal
-rw-r--r--paludis/fs_merger-fwd.hh8
-rw-r--r--paludis/fs_merger.cc9
-rw-r--r--paludis/fs_merger.hh8
-rw-r--r--paludis/fs_merger.se9
-rw-r--r--paludis/fs_merger_TEST.cc2
-rw-r--r--paludis/ndbam_merger.cc1
-rw-r--r--paludis/ndbam_merger.hh2
-rw-r--r--paludis/repositories/e/exndbam_repository.cc1
-rw-r--r--paludis/repositories/e/vdb_merger.cc1
-rw-r--r--paludis/repositories/e/vdb_merger.hh1
-rw-r--r--paludis/repositories/e/vdb_merger_TEST.cc1
-rw-r--r--paludis/repositories/e/vdb_repository.cc1
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc1
13 files changed, 43 insertions, 2 deletions
diff --git a/paludis/fs_merger-fwd.hh b/paludis/fs_merger-fwd.hh
index 003778c..dff5233 100644
--- a/paludis/fs_merger-fwd.hh
+++ b/paludis/fs_merger-fwd.hh
@@ -44,6 +44,14 @@ namespace paludis
*/
typedef Options<FSMergerStatusFlag> FSMergerStatusFlags;
+ /**
+ * Options for FSMerger.
+ *
+ * \ingroup g_repository
+ * \since 0.71
+ */
+ typedef Options<FSMergerOption> FSMergerOptions;
+
class FSMergerParams;
class FSMergerError;
class FSMerger;
diff --git a/paludis/fs_merger.cc b/paludis/fs_merger.cc
index 883e4ea..7d30116 100644
--- a/paludis/fs_merger.cc
+++ b/paludis/fs_merger.cc
@@ -234,8 +234,13 @@ FSMerger::on_dir_over_sym(bool is_check, const FSPath & src, const FSPath & dst)
if (m == et_dir)
{
- on_warn(is_check, "Expected '" + stringify(dst / src.basename()) +
- "' to be a directory but found a symlink to a directory");
+ if (_imp->params.fs_merger_options()[fsmo_dir_over_sym_dir_is_error])
+ on_error(is_check, "Expected '" + stringify(dst / src.basename()) +
+ "' to be a directory but found a symlink to a directory");
+ else
+ on_warn(is_check, "Expected '" + stringify(dst / src.basename()) +
+ "' to be a directory but found a symlink to a directory");
+
if (! is_check)
track_install_dir(src, dst, FSMergerStatusFlags() + msi_used_existing);
}
diff --git a/paludis/fs_merger.hh b/paludis/fs_merger.hh
index 6d6036d..9843528 100644
--- a/paludis/fs_merger.hh
+++ b/paludis/fs_merger.hh
@@ -50,6 +50,7 @@ namespace paludis
{
typedef Name<struct name_environment> environment;
typedef Name<struct name_fix_mtimes_before> fix_mtimes_before;
+ typedef Name<struct name_fs_merger_options> fs_merger_options;
typedef Name<struct name_get_new_ids_or_minus_one> get_new_ids_or_minus_one;
typedef Name<struct name_image> image;
typedef Name<struct name_install_under> install_under;
@@ -82,6 +83,13 @@ namespace paludis
*/
NamedValue<n::fix_mtimes_before, Timestamp> fix_mtimes_before;
+ /**
+ * Additional options not in MergerOptions.
+ *
+ * \since 0.71
+ */
+ NamedValue<n::fs_merger_options, FSMergerOptions> fs_merger_options;
+
NamedValue<n::get_new_ids_or_minus_one, std::function<std::pair<uid_t, gid_t> (const FSPath &)> > get_new_ids_or_minus_one;
NamedValue<n::image, FSPath> image;
NamedValue<n::install_under, FSPath> install_under;
diff --git a/paludis/fs_merger.se b/paludis/fs_merger.se
index c438e71..a05cec3 100644
--- a/paludis/fs_merger.se
+++ b/paludis/fs_merger.se
@@ -25,3 +25,12 @@ make_enum_FSMergerStatusFlag()
END
}
+make_enum_FSMergerOption()
+{
+ prefix fsmo
+
+ key fsmo_dir_over_sym_dir_is_error "Merging a directory over a symlink is an error"
+
+ want_destringify
+}
+
diff --git a/paludis/fs_merger_TEST.cc b/paludis/fs_merger_TEST.cc
index d4afd41..156e1b3 100644
--- a/paludis/fs_merger_TEST.cc
+++ b/paludis/fs_merger_TEST.cc
@@ -167,6 +167,7 @@ namespace
merger(make_named_values<FSMergerParams>(
n::environment() = &env,
n::fix_mtimes_before() = Timestamp(0, 0),
+ n::fs_merger_options() = FSMergerOptions(),
n::get_new_ids_or_minus_one() = &get_new_ids_or_minus_one,
n::image() = image_dir,
n::install_under() = FSPath("/"),
@@ -189,6 +190,7 @@ namespace
merger(make_named_values<FSMergerParams>(
n::environment() = &env,
n::fix_mtimes_before() = fix ? FSPath("fs_merger_TEST_dir/reference").stat().mtim() : Timestamp(0, 0),
+ n::fs_merger_options() = FSMergerOptions(),
n::get_new_ids_or_minus_one() = &get_new_ids_or_minus_one,
n::image() = image_dir,
n::install_under() = FSPath("/"),
diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc
index ad8d14c..0dbbf12 100644
--- a/paludis/ndbam_merger.cc
+++ b/paludis/ndbam_merger.cc
@@ -75,6 +75,7 @@ NDBAMMerger::NDBAMMerger(const NDBAMMergerParams & p) :
FSMerger(make_named_values<FSMergerParams>(
n::environment() = p.environment(),
n::fix_mtimes_before() = p.fix_mtimes_before(),
+ n::fs_merger_options() = p.fs_merger_options(),
n::get_new_ids_or_minus_one() = p.get_new_ids_or_minus_one(),
n::image() = p.image(),
n::install_under() = p.install_under(),
diff --git a/paludis/ndbam_merger.hh b/paludis/ndbam_merger.hh
index d6c551e..0d885dd 100644
--- a/paludis/ndbam_merger.hh
+++ b/paludis/ndbam_merger.hh
@@ -35,6 +35,7 @@ namespace paludis
typedef Name<struct name_contents_file> contents_file;
typedef Name<struct name_environment> environment;
typedef Name<struct name_fix_mtimes_before> fix_mtimes_before;
+ typedef Name<struct name_fs_merger_options> fs_merger_options;
typedef Name<struct name_get_new_ids_or_minus_one> get_new_ids_or_minus_one;
typedef Name<struct name_image> image;
typedef Name<struct name_install_under> install_under;
@@ -53,6 +54,7 @@ namespace paludis
NamedValue<n::contents_file, FSPath> contents_file;
NamedValue<n::environment, Environment *> environment;
NamedValue<n::fix_mtimes_before, Timestamp> fix_mtimes_before;
+ NamedValue<n::fs_merger_options, FSMergerOptions> fs_merger_options;
NamedValue<n::get_new_ids_or_minus_one, std::function<std::pair<uid_t, gid_t> (const FSPath &)> > get_new_ids_or_minus_one;
NamedValue<n::image, FSPath> image;
NamedValue<n::install_under, FSPath> install_under;
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 11f0eee..d06deea 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -438,6 +438,7 @@ ExndbamRepository::merge(const MergeParams & m)
n::contents_file() = target_ver_dir / "contents",
n::environment() = _imp->params.environment(),
n::fix_mtimes_before() = fix_mtimes ? m.build_start_time() : Timestamp(0, 0),
+ n::fs_merger_options() = FSMergerOptions(),
n::get_new_ids_or_minus_one() = std::bind(&get_new_ids_or_minus_one, _imp->params.environment(), std::placeholders::_1),
n::image() = m.image_dir(),
n::install_under() = FSPath("/"),
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 8c6b23c..0247f81 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -89,6 +89,7 @@ VDBMerger::VDBMerger(const VDBMergerParams & p) :
FSMerger(make_named_values<FSMergerParams>(
n::environment() = p.environment(),
n::fix_mtimes_before() = p.fix_mtimes_before(),
+ n::fs_merger_options() = p.fs_merger_options(),
n::get_new_ids_or_minus_one() = std::bind(&get_new_ids_or_minus_one, p.environment(), std::placeholders::_1),
n::image() = p.image(),
n::install_under() = FSPath("/"),
diff --git a/paludis/repositories/e/vdb_merger.hh b/paludis/repositories/e/vdb_merger.hh
index 57374e1..16e4c68 100644
--- a/paludis/repositories/e/vdb_merger.hh
+++ b/paludis/repositories/e/vdb_merger.hh
@@ -60,6 +60,7 @@ namespace paludis
NamedValue<n::contents_file, FSPath> contents_file;
NamedValue<n::environment, Environment *> environment;
NamedValue<n::fix_mtimes_before, Timestamp> fix_mtimes_before;
+ NamedValue<n::fs_merger_options, FSMergerOptions> fs_merger_options;
NamedValue<n::image, FSPath> image;
NamedValue<n::merged_entries, std::shared_ptr<FSPathSet> > merged_entries;
NamedValue<n::options, MergerOptions> options;
diff --git a/paludis/repositories/e/vdb_merger_TEST.cc b/paludis/repositories/e/vdb_merger_TEST.cc
index 0a8f190..91bd85f 100644
--- a/paludis/repositories/e/vdb_merger_TEST.cc
+++ b/paludis/repositories/e/vdb_merger_TEST.cc
@@ -107,6 +107,7 @@ namespace
n::contents_file() = FSPath::cwd() / "vdb_merger_TEST_dir/CONTENTS" / (target + "_dir"),
n::environment() = &env,
n::fix_mtimes_before() = Timestamp(0, 0),
+ n::fs_merger_options() = FSMergerOptions(),
n::image() = FSPath::cwd() / "vdb_merger_TEST_dir" / (target + "_dir") / "image",
n::merged_entries() = std::make_shared<FSPathSet>(),
n::options() = MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 902e7c6..3bc800f 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -668,6 +668,7 @@ VDBRepository::merge(const MergeParams & m)
n::contents_file() = vdb_dir / "CONTENTS",
n::environment() = _imp->params.environment(),
n::fix_mtimes_before() = fix_mtimes ? m.build_start_time() : Timestamp(0, 0),
+ n::fs_merger_options() = FSMergerOptions(),
n::image() = m.image_dir(),
n::merged_entries() = m.merged_entries(),
n::options() = m.options(),
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 3d85034..2413e36 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -370,6 +370,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
n::contents_file() = target_ver_dir / "contents",
n::environment() = _imp->params.environment(),
n::fix_mtimes_before() = m.build_start_time(),
+ n::fs_merger_options() = FSMergerOptions(),
n::get_new_ids_or_minus_one() = std::bind(&get_new_ids_or_minus_one,
_imp->params.environment(), rewrite_ids_over_to_root, _1),
n::image() = m.image_dir(),