aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-16 20:16:44 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2009-10-16 20:42:11 +0100
commitd5b735e63bb052b1378dd4cbf3cdf70e2c268ecd (patch)
treeaf7f9a80fbf5bf5e6ef44a1f76d3d5614f3f233e
parent987ee3f9c64be9a429dc478e47bdca405a4579cf (diff)
downloadpaludis-d5b735e63bb052b1378dd4cbf3cdf70e2c268ecd.tar.gz
paludis-d5b735e63bb052b1378dd4cbf3cdf70e2c268ecd.tar.xz
Make mtime preservation work for old phase order
-rw-r--r--paludis/merger.cc19
-rw-r--r--paludis/merger.hh16
-rw-r--r--paludis/merger_TEST.cc4
-rw-r--r--paludis/ndbam_merger.cc1
-rw-r--r--paludis/ndbam_merger.hh2
-rw-r--r--paludis/repositories/accounts/accounts_id.cc6
-rw-r--r--paludis/repositories/e/ebuild_entries.cc11
-rw-r--r--paludis/repositories/e/exndbam_repository.cc7
-rw-r--r--paludis/repositories/e/vdb_merger.cc1
-rw-r--r--paludis/repositories/e/vdb_merger.hh2
-rw-r--r--paludis/repositories/e/vdb_merger_TEST.cc2
-rw-r--r--paludis/repositories/e/vdb_repository.cc7
-rw-r--r--paludis/repositories/unpackaged/installed_repository.cc1
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc2
-rw-r--r--paludis/repository.hh9
15 files changed, 50 insertions, 40 deletions
diff --git a/paludis/merger.cc b/paludis/merger.cc
index 63828a6..475f56e 100644
--- a/paludis/merger.cc
+++ b/paludis/merger.cc
@@ -63,13 +63,10 @@ namespace paludis
bool result;
bool skip_dir;
- std::tr1::shared_ptr<FSEntrySet> merged_entries;
-
Implementation(const MergerParams & p) :
params(p),
result(true),
- skip_dir(false),
- merged_entries(new FSEntrySet)
+ skip_dir(false)
{
}
};
@@ -1244,34 +1241,28 @@ Merger::try_to_copy_xattrs(const FSEntry &, int, MergeStatusFlags &)
void
Merger::track_install_file(const FSEntry & src, const FSEntry & dst_dir, const std::string & dst_name, const MergeStatusFlags & flags)
{
- _imp->merged_entries->insert(dst_dir / dst_name);
+ _imp->params.merged_entries()->insert(dst_dir / dst_name);
record_install_file(src, dst_dir, dst_name, flags);
}
void
Merger::track_install_dir(const FSEntry & src, const FSEntry & dst_dir, const MergeStatusFlags & flags)
{
- _imp->merged_entries->insert(dst_dir / src.basename());
+ _imp->params.merged_entries()->insert(dst_dir / src.basename());
record_install_dir(src, dst_dir, flags);
}
void
Merger::track_install_under_dir(const FSEntry & dst, const MergeStatusFlags & flags)
{
- _imp->merged_entries->insert(dst);
+ _imp->params.merged_entries()->insert(dst);
record_install_under_dir(dst, flags);
}
void
Merger::track_install_sym(const FSEntry & src, const FSEntry & dst_dir, const MergeStatusFlags & flags)
{
- _imp->merged_entries->insert(dst_dir / src.basename());
+ _imp->params.merged_entries()->insert(dst_dir / src.basename());
record_install_sym(src, dst_dir, flags);
}
-const std::tr1::shared_ptr<const FSEntrySet>
-Merger::merged_entries() const
-{
- return _imp->merged_entries;
-}
-
diff --git a/paludis/merger.hh b/paludis/merger.hh
index fb08d66..021bb3e 100644
--- a/paludis/merger.hh
+++ b/paludis/merger.hh
@@ -52,6 +52,7 @@ namespace paludis
struct get_new_ids_or_minus_one;
struct image;
struct install_under;
+ struct merged_entries;
struct no_chown;
struct options;
struct root;
@@ -71,6 +72,14 @@ namespace paludis
NamedValue<n::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> > get_new_ids_or_minus_one;
NamedValue<n::image, FSEntry> image;
NamedValue<n::install_under, FSEntry> install_under;
+
+ /**
+ * We record things we merged here.
+ *
+ * \since 0.41
+ */
+ NamedValue<n::merged_entries, std::tr1::shared_ptr<FSEntrySet> > merged_entries;
+
NamedValue<n::no_chown, bool> no_chown;
NamedValue<n::options, MergerOptions> options;
NamedValue<n::root, FSEntry> root;
@@ -240,13 +249,6 @@ namespace paludis
* Perform the merge.
*/
virtual void merge();
-
- /**
- * Every FSEntry (final path) that we merged.
- *
- * \since 0.40
- */
- const std::tr1::shared_ptr<const FSEntrySet> merged_entries() const PALUDIS_ATTRIBUTE((warn_unused_result));
};
}
diff --git a/paludis/merger_TEST.cc b/paludis/merger_TEST.cc
index 96575f8..9f8bcc6 100644
--- a/paludis/merger_TEST.cc
+++ b/paludis/merger_TEST.cc
@@ -24,6 +24,8 @@
#include <paludis/util/dir_iterator.hh>
#include <paludis/util/make_named_values.hh>
#include <paludis/util/safe_ifstream.hh>
+#include <paludis/util/set.hh>
+#include <paludis/util/make_shared_ptr.hh>
#include <paludis/hook.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -167,6 +169,7 @@ namespace
value_for<n::get_new_ids_or_minus_one>(&get_new_ids_or_minus_one),
value_for<n::image>(image_dir),
value_for<n::install_under>(FSEntry("/")),
+ value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
value_for<n::no_chown>(true),
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
value_for<n::root>(root_dir)
@@ -184,6 +187,7 @@ namespace
value_for<n::get_new_ids_or_minus_one>(&get_new_ids_or_minus_one),
value_for<n::image>(image_dir),
value_for<n::install_under>(FSEntry("/")),
+ value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
value_for<n::no_chown>(true),
value_for<n::options>(o),
value_for<n::root>(root_dir)
diff --git a/paludis/ndbam_merger.cc b/paludis/ndbam_merger.cc
index 166468c..2a2d5d0 100644
--- a/paludis/ndbam_merger.cc
+++ b/paludis/ndbam_merger.cc
@@ -72,6 +72,7 @@ NDBAMMerger::NDBAMMerger(const NDBAMMergerParams & p) :
value_for<n::get_new_ids_or_minus_one>(p.get_new_ids_or_minus_one()),
value_for<n::image>(p.image()),
value_for<n::install_under>(p.install_under()),
+ value_for<n::merged_entries>(p.merged_entries()),
value_for<n::no_chown>(! getenv_with_default("PALUDIS_NO_CHOWN", "").empty()),
value_for<n::options>(p.options()),
value_for<n::root>(p.root())
diff --git a/paludis/ndbam_merger.hh b/paludis/ndbam_merger.hh
index bad12bc..b41258e 100644
--- a/paludis/ndbam_merger.hh
+++ b/paludis/ndbam_merger.hh
@@ -37,6 +37,7 @@ namespace paludis
struct get_new_ids_or_minus_one;
struct image;
struct install_under;
+ struct merged_entries;
struct options;
struct output_manager;
struct package_id;
@@ -52,6 +53,7 @@ namespace paludis
NamedValue<n::get_new_ids_or_minus_one, std::tr1::function<std::pair<uid_t, gid_t> (const FSEntry &)> > get_new_ids_or_minus_one;
NamedValue<n::image, FSEntry> image;
NamedValue<n::install_under, FSEntry> install_under;
+ NamedValue<n::merged_entries, std::tr1::shared_ptr<FSEntrySet> > merged_entries;
NamedValue<n::options, MergerOptions> options;
NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index c1fd160..ab8e48b 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -457,10 +457,6 @@ namespace
{
return false;
}
-
- void installed_this(const FSEntry &)
- {
- }
}
void
@@ -488,7 +484,7 @@ AccountsID::perform_action(Action & action) const
make_named_values<MergeParams>(
value_for<n::environment_file>(FSEntry("/dev/null")),
value_for<n::image_dir>(fs_location_key()->value()),
- value_for<n::installed_this>(&installed_this),
+ value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
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()),
diff --git a/paludis/repositories/e/ebuild_entries.cc b/paludis/repositories/e/ebuild_entries.cc
index d186412..2d23407 100644
--- a/paludis/repositories/e/ebuild_entries.cc
+++ b/paludis/repositories/e/ebuild_entries.cc
@@ -625,9 +625,10 @@ namespace
{
}
- bool ignore_nothing(const FSEntry &)
+ bool ignore_merged(const std::tr1::shared_ptr<const FSEntrySet> & s,
+ const FSEntry & f)
{
- return false;
+ return s->end() != s->find(f);
}
}
@@ -735,6 +736,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
stringify(id->name().package()) + "-" + stringify(id->version())));
std::string used_config_protect;
+ std::tr1::shared_ptr<FSEntrySet> merged_entries(new FSEntrySet);
EAPIPhases phases(id->eapi()->supported()->ebuild_phases()->ebuild_install());
for (EAPIPhases::ConstIterator phase(phases.begin_phases()), phase_end(phases.end_phases()) ;
@@ -782,7 +784,7 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
make_named_values<MergeParams>(
value_for<n::environment_file>(package_builddir / "temp" / "loadsaveenv"),
value_for<n::image_dir>(package_builddir / "image"),
- value_for<n::installed_this>(&installed_this),
+ value_for<n::merged_entries>(merged_entries),
value_for<n::options>(id->eapi()->supported()->merger_options()),
value_for<n::output_manager>(output_manager),
value_for<n::package_id>(id),
@@ -915,7 +917,8 @@ EbuildEntries::install(const std::tr1::shared_ptr<const ERepositoryID> & id,
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(used_config_protect),
value_for<n::if_for_install_id>(id),
- value_for<n::ignore_for_unmerge>(&ignore_nothing),
+ value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merged_entries,
+ std::tr1::placeholders::_1)),
value_for<n::is_overwrite>(false),
value_for<n::make_output_manager>(std::tr1::bind(&this_output_manager, output_manager, std::tr1::placeholders::_1))
));
diff --git a/paludis/repositories/e/exndbam_repository.cc b/paludis/repositories/e/exndbam_repository.cc
index 1b13e18..5390110 100644
--- a/paludis/repositories/e/exndbam_repository.cc
+++ b/paludis/repositories/e/exndbam_repository.cc
@@ -397,6 +397,8 @@ ExndbamRepository::merge(const MergeParams & m)
{
}
+ const std::tr1::shared_ptr<FSEntrySet> merged_entries(new FSEntrySet);
+
NDBAMMerger merger(
make_named_values<NDBAMMergerParams>(
value_for<n::config_protect>(config_protect),
@@ -406,6 +408,7 @@ ExndbamRepository::merge(const MergeParams & m)
value_for<n::get_new_ids_or_minus_one>(std::tr1::bind(&get_new_ids_or_minus_one, _imp->params.environment(), std::tr1::placeholders::_1)),
value_for<n::image>(m.image_dir()),
value_for<n::install_under>(FSEntry("/")),
+ value_for<n::merged_entries>(merged_entries),
value_for<n::options>(m.options()),
value_for<n::output_manager>(m.output_manager()),
value_for<n::package_id>(m.package_id()),
@@ -432,7 +435,7 @@ ExndbamRepository::merge(const MergeParams & m)
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
value_for<n::if_for_install_id>(m.package_id()),
- value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merger.merged_entries(),
+ value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merged_entries,
std::tr1::placeholders::_1)),
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))
@@ -453,7 +456,7 @@ ExndbamRepository::merge(const MergeParams & m)
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
value_for<n::if_for_install_id>(m.package_id()),
- value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merger.merged_entries(),
+ value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merged_entries,
std::tr1::placeholders::_1)),
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))
diff --git a/paludis/repositories/e/vdb_merger.cc b/paludis/repositories/e/vdb_merger.cc
index 60e309c..da48eae 100644
--- a/paludis/repositories/e/vdb_merger.cc
+++ b/paludis/repositories/e/vdb_merger.cc
@@ -84,6 +84,7 @@ VDBMerger::VDBMerger(const VDBMergerParams & p) :
value_for<n::get_new_ids_or_minus_one>(std::tr1::bind(&get_new_ids_or_minus_one, p.environment(), std::tr1::placeholders::_1)),
value_for<n::image>(p.image()),
value_for<n::install_under>(FSEntry("/")),
+ value_for<n::merged_entries>(p.merged_entries()),
value_for<n::no_chown>(! getenv_with_default("PALUDIS_NO_CHOWN", "").empty()),
value_for<n::options>(p.options()),
value_for<n::root>(p.root())
diff --git a/paludis/repositories/e/vdb_merger.hh b/paludis/repositories/e/vdb_merger.hh
index 880b9d5..2167dab 100644
--- a/paludis/repositories/e/vdb_merger.hh
+++ b/paludis/repositories/e/vdb_merger.hh
@@ -36,6 +36,7 @@ namespace paludis
struct contents_file;
struct environment;
struct image;
+ struct merged_entries;
struct options;
struct output_manager;
struct package_id;
@@ -58,6 +59,7 @@ namespace paludis
NamedValue<n::contents_file, FSEntry> contents_file;
NamedValue<n::environment, Environment *> environment;
NamedValue<n::image, FSEntry> image;
+ NamedValue<n::merged_entries, std::tr1::shared_ptr<FSEntrySet> > merged_entries;
NamedValue<n::options, MergerOptions> options;
NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;
NamedValue<n::package_id, std::tr1::shared_ptr<const PackageID> > package_id;
diff --git a/paludis/repositories/e/vdb_merger_TEST.cc b/paludis/repositories/e/vdb_merger_TEST.cc
index 9bcb1bb..893278d 100644
--- a/paludis/repositories/e/vdb_merger_TEST.cc
+++ b/paludis/repositories/e/vdb_merger_TEST.cc
@@ -24,6 +24,7 @@
#include <paludis/util/make_named_values.hh>
#include <paludis/util/make_shared_ptr.hh>
#include <paludis/util/safe_ifstream.hh>
+#include <paludis/util/set.hh>
#include <paludis/standard_output_manager.hh>
#include <test/test_framework.hh>
#include <test/test_runner.hh>
@@ -84,6 +85,7 @@ namespace
value_for<n::contents_file>(FSEntry::cwd() / "vdb_merger_TEST_dir/CONTENTS" / what),
value_for<n::environment>(&env),
value_for<n::image>(FSEntry::cwd() / "vdb_merger_TEST_dir" / what / "image"),
+ value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
value_for<n::output_manager>(make_shared_ptr(new StandardOutputManager)),
value_for<n::package_id>(std::tr1::shared_ptr<PackageID>()),
diff --git a/paludis/repositories/e/vdb_repository.cc b/paludis/repositories/e/vdb_repository.cc
index 9df0917..ca6de71 100644
--- a/paludis/repositories/e/vdb_repository.cc
+++ b/paludis/repositories/e/vdb_repository.cc
@@ -913,6 +913,8 @@ VDBRepository::merge(const MergeParams & m)
vdb_dir /= stringify(m.package_id()->name().category());
vdb_dir /= (stringify(m.package_id()->name().package()) + "-" + stringify(m.package_id()->version()));
+
+ const std::tr1::shared_ptr<FSEntrySet> merged_entries(new FSEntrySet);
VDBMerger merger(
make_named_values<VDBMergerParams>(
value_for<n::config_protect>(config_protect),
@@ -920,6 +922,7 @@ VDBRepository::merge(const MergeParams & m)
value_for<n::contents_file>(vdb_dir / "CONTENTS"),
value_for<n::environment>(_imp->params.environment()),
value_for<n::image>(m.image_dir()),
+ value_for<n::merged_entries>(merged_entries),
value_for<n::options>(m.options()),
value_for<n::output_manager>(m.output_manager()),
value_for<n::package_id>(m.package_id()),
@@ -978,7 +981,7 @@ VDBRepository::merge(const MergeParams & m)
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
value_for<n::if_for_install_id>(m.package_id()),
- value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merger.merged_entries(),
+ value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merged_entries,
std::tr1::placeholders::_1)),
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))
@@ -999,7 +1002,7 @@ VDBRepository::merge(const MergeParams & m)
UninstallActionOptions uo(make_named_values<UninstallActionOptions>(
value_for<n::config_protect>(config_protect),
value_for<n::if_for_install_id>(m.package_id()),
- value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merger.merged_entries(),
+ value_for<n::ignore_for_unmerge>(std::tr1::bind(&ignore_merged, merged_entries,
std::tr1::placeholders::_1)),
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))
diff --git a/paludis/repositories/unpackaged/installed_repository.cc b/paludis/repositories/unpackaged/installed_repository.cc
index 8b8f3c0..88fa758 100644
--- a/paludis/repositories/unpackaged/installed_repository.cc
+++ b/paludis/repositories/unpackaged/installed_repository.cc
@@ -354,6 +354,7 @@ InstalledUnpackagedRepository::merge(const MergeParams & m)
_imp->params.environment(), rewrite_ids_over_to_root, _1)),
value_for<n::image>(m.image_dir()),
value_for<n::install_under>(install_under),
+ value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
value_for<n::options>(MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs),
value_for<n::output_manager>(m.output_manager()),
value_for<n::package_id>(m.package_id()),
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index 4c3a1ac..cb8af6f 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -401,7 +401,7 @@ UnpackagedID::perform_action(Action & action) const
make_named_values<MergeParams>(
value_for<n::environment_file>(FSEntry("/dev/null")),
value_for<n::image_dir>(fs_location_key()->value()),
- value_for<n::installed_this>(&installed_this),
+ value_for<n::merged_entries>(make_shared_ptr(new FSEntrySet)),
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()),
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 9e8f6b2..55193d1 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -62,9 +62,9 @@ namespace paludis
struct environment_file;
struct environment_variable_interface;
struct image_dir;
- struct installed_this;
struct make_virtuals_interface;
struct manifest_interface;
+ struct merged_entries;
struct mirrors_interface;
struct options;
struct output_manager;
@@ -161,11 +161,10 @@ namespace paludis
NamedValue<n::image_dir, FSEntry> image_dir;
/**
- * Some callers need to know what we merged.
- *
- * \since 0.38
+ * We record things we merged here.
+ * \since 0.41
*/
- NamedValue<n::installed_this, std::tr1::function<void (const FSEntry &)> > installed_this;
+ NamedValue<n::merged_entries, std::tr1::shared_ptr<FSEntrySet> > merged_entries;
NamedValue<n::options, MergerOptions> options;
NamedValue<n::output_manager, std::tr1::shared_ptr<OutputManager> > output_manager;