aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-26 17:14:57 +0100
committerAvatar Ciaran McCreesh <ciaran.mccreesh@googlemail.com> 2010-07-28 10:11:26 +0100
commitce13a6f9defe83fccd8424027ef1e24ca33b8cc2 (patch)
treebe57dccfba4c2e6a3f574f1d9000f85a2d09fe8c
parentd03893141379f242baf6ccbe0e934ebabd1ce626 (diff)
downloadpaludis-ce13a6f9defe83fccd8424027ef1e24ca33b8cc2.tar.gz
paludis-ce13a6f9defe83fccd8424027ef1e24ca33b8cc2.tar.xz
Add Merger base class
-rw-r--r--paludis/files.m41
-rw-r--r--paludis/fs_merger-fwd.hh11
-rw-r--r--paludis/fs_merger.hh9
-rw-r--r--paludis/fs_merger.se20
-rw-r--r--paludis/fs_merger_TEST.cc4
-rw-r--r--paludis/merger-fwd.hh44
-rw-r--r--paludis/merger.cc40
-rw-r--r--paludis/merger.hh43
-rw-r--r--paludis/merger.se23
-rw-r--r--paludis/ndbam_merger.hh2
-rw-r--r--paludis/repositories/accounts/accounts_id.cc2
-rw-r--r--paludis/repositories/e/e_repository.cc2
-rw-r--r--paludis/repositories/e/eapi.cc4
-rw-r--r--paludis/repositories/e/eapi.hh4
-rw-r--r--paludis/repositories/e/ebuild.hh2
-rw-r--r--paludis/repositories/e/vdb_merger.hh2
-rw-r--r--paludis/repositories/e/vdb_merger_TEST.cc2
-rw-r--r--paludis/repositories/unavailable/unavailable_repository_id.cc2
-rw-r--r--paludis/repositories/unpackaged/unpackaged_id.cc4
-rw-r--r--paludis/repository.hh4
20 files changed, 172 insertions, 53 deletions
diff --git a/paludis/files.m4 b/paludis/files.m4
index 452897a..db296a1 100644
--- a/paludis/files.m4
+++ b/paludis/files.m4
@@ -62,6 +62,7 @@ add(`linkage_checker', `hh', `cc')
add(`literal_metadata_key', `hh', `cc')
add(`mask', `hh', `cc', `fwd', `se')
add(`match_package', `hh', `cc', `se', `fwd')
+add(`merger', `hh', `cc', `se', `fwd')
add(`merger_entry_type', `hh', `cc', `se')
add(`metadata_key', `hh', `cc', `se', `fwd')
add(`metadata_key_holder', `hh', `cc', `fwd')
diff --git a/paludis/fs_merger-fwd.hh b/paludis/fs_merger-fwd.hh
index 2ccead7..804dde1 100644
--- a/paludis/fs_merger-fwd.hh
+++ b/paludis/fs_merger-fwd.hh
@@ -24,8 +24,6 @@
#include <paludis/util/attributes.hh>
#include <paludis/util/options-fwd.hh>
#include <paludis/util/fs_entry-fwd.hh>
-#include <paludis/environment-fwd.hh>
-#include <functional>
/** \file
* Forward declarations for paludis/fs_merger.hh .
@@ -39,15 +37,6 @@ namespace paludis
#include <paludis/fs_merger-se.hh>
/**
- * Boolean options for FSMerger.
- *
- * \ingroup g_repository
- * \since 0.26
- * \since 0.51 called FSMergerOptions instead of MergerOptions
- */
- typedef Options<FSMergerOption> FSMergerOptions;
-
- /**
* Status flags for Merger.
*
* \ingroup g_repository
diff --git a/paludis/fs_merger.hh b/paludis/fs_merger.hh
index e17fb3f..d1cb0b3 100644
--- a/paludis/fs_merger.hh
+++ b/paludis/fs_merger.hh
@@ -27,6 +27,7 @@
#include <paludis/util/named_value.hh>
#include <paludis/util/timestamp.hh>
#include <paludis/merger_entry_type.hh>
+#include <paludis/merger.hh>
#include <iosfwd>
#include <sys/stat.h>
#include <sys/types.h>
@@ -93,7 +94,7 @@ namespace paludis
NamedValue<n::merged_entries, std::shared_ptr<FSEntrySet> > merged_entries;
NamedValue<n::no_chown, bool> no_chown;
- NamedValue<n::options, FSMergerOptions> options;
+ NamedValue<n::options, MergerOptions> options;
NamedValue<n::root, FSEntry> root;
};
@@ -125,7 +126,8 @@ namespace paludis
* \since 0.51 called FSMerger instead of Merger
*/
class PALUDIS_VISIBLE FSMerger :
- private Pimp<FSMerger>
+ private Pimp<FSMerger>,
+ public Merger
{
private:
void track_renamed_dir_recursive(const FSEntry &);
@@ -148,9 +150,6 @@ namespace paludis
*/
void make_check_fail();
- /**
- * Allows subclasses to extend hook calls.
- */
virtual Hook extend_hook(const Hook &);
/**
diff --git a/paludis/fs_merger.se b/paludis/fs_merger.se
index 75088b5..c438e71 100644
--- a/paludis/fs_merger.se
+++ b/paludis/fs_merger.se
@@ -25,23 +25,3 @@ make_enum_FSMergerStatusFlag()
END
}
-make_enum_FSMergerOption()
-{
- prefix mo
- want_destringify
-
- key mo_rewrite_symlinks "Fix symlinks that point into the image directory (otherwise throw an error)"
- key mo_allow_empty_dirs "Allow merging empty directories"
- key mo_preserve_mtimes "Preserve mtimes \since 0.42"
- key mo_nondestructive "Don't destroy the image when merging \since 0.44"
-
- doxygen_comment << "END"
- /**
- * Boolean options for Merger, used by MergerOptions
- *
- * \ingroup g_repository
- * \since 0.26
- */
-END
-}
-
diff --git a/paludis/fs_merger_TEST.cc b/paludis/fs_merger_TEST.cc
index 8ccea37..132b18a 100644
--- a/paludis/fs_merger_TEST.cc
+++ b/paludis/fs_merger_TEST.cc
@@ -181,14 +181,14 @@ namespace
n::install_under() = FSEntry("/"),
n::merged_entries() = std::make_shared<FSEntrySet>(),
n::no_chown() = true,
- n::options() = FSMergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
+ n::options() = MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
n::root() = root_dir
))
{
}
MergerTest(const std::string & custom_test,
- const FSMergerOptions & o = FSMergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
+ const MergerOptions & o = MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
const bool fix = false) :
TestCase("merge " + custom_test + " test"),
image_dir("fs_merger_TEST_dir/" + custom_test + "/image"),
diff --git a/paludis/merger-fwd.hh b/paludis/merger-fwd.hh
new file mode 100644
index 0000000..e0c2732
--- /dev/null
+++ b/paludis/merger-fwd.hh
@@ -0,0 +1,44 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_MERGER_FWD_HH
+#define PALUDIS_GUARD_PALUDIS_MERGER_FWD_HH 1
+
+#include <iosfwd>
+#include <paludis/util/attributes.hh>
+#include <paludis/util/options-fwd.hh>
+#include <paludis/util/fs_entry-fwd.hh>
+
+namespace paludis
+{
+
+#include <paludis/merger-se.hh>
+
+ /**
+ * Boolean options for Merger.
+ *
+ * \ingroup g_repository
+ * \since 0.26
+ */
+ typedef Options<MergerOption> MergerOptions;
+
+ class Merger;
+}
+
+#endif
diff --git a/paludis/merger.cc b/paludis/merger.cc
new file mode 100644
index 0000000..70c2036
--- /dev/null
+++ b/paludis/merger.cc
@@ -0,0 +1,40 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <paludis/merger.hh>
+#include <paludis/util/stringify.hh>
+#include <paludis/util/exception.hh>
+#include <paludis/hook.hh>
+#include <istream>
+#include <ostream>
+
+using namespace paludis;
+
+#include <paludis/merger-se.cc>
+
+Merger::Merger()
+{
+}
+
+Hook
+Merger::extend_hook(const Hook & h)
+{
+ return h;
+}
+
diff --git a/paludis/merger.hh b/paludis/merger.hh
new file mode 100644
index 0000000..d160e79
--- /dev/null
+++ b/paludis/merger.hh
@@ -0,0 +1,43 @@
+/* vim: set sw=4 sts=4 et foldmethod=syntax : */
+
+/*
+ * Copyright (c) 2010 Ciaran McCreesh
+ *
+ * This file is part of the Paludis package manager. Paludis is free software;
+ * you can redistribute it and/or modify it under the terms of the GNU General
+ * Public License version 2, as published by the Free Software Foundation.
+ *
+ * Paludis is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef PALUDIS_GUARD_PALUDIS_MERGER_HH
+#define PALUDIS_GUARD_PALUDIS_MERGER_HH 1
+
+#include <paludis/merger-fwd.hh>
+#include <paludis/hook-fwd.hh>
+
+namespace paludis
+{
+ class PALUDIS_VISIBLE Merger
+ {
+ protected:
+ /**
+ * Allows subclasses to extend hook calls.
+ */
+ virtual Hook extend_hook(const Hook &);
+
+ public:
+ Merger();
+ Merger(const Merger &) = delete;
+ Merger & operator= (const Merger &) = delete;
+ };
+}
+
+#endif
diff --git a/paludis/merger.se b/paludis/merger.se
new file mode 100644
index 0000000..b748e0e
--- /dev/null
+++ b/paludis/merger.se
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+# vim: set sw=4 sts=4 et ft=sh :
+
+make_enum_MergerOption()
+{
+ prefix mo
+ want_destringify
+
+ key mo_rewrite_symlinks "Fix symlinks that point into the image directory (otherwise throw an error)"
+ key mo_allow_empty_dirs "Allow merging empty directories"
+ key mo_preserve_mtimes "Preserve mtimes \since 0.42"
+ key mo_nondestructive "Don't destroy the image when merging \since 0.44"
+
+ doxygen_comment << "END"
+ /**
+ * Boolean options for Merger, used by MergerOptions
+ *
+ * \ingroup g_repository
+ * \since 0.26
+ */
+END
+}
+
diff --git a/paludis/ndbam_merger.hh b/paludis/ndbam_merger.hh
index 4f7b09c..04ac67d 100644
--- a/paludis/ndbam_merger.hh
+++ b/paludis/ndbam_merger.hh
@@ -56,7 +56,7 @@ namespace paludis
NamedValue<n::image, FSEntry> image;
NamedValue<n::install_under, FSEntry> install_under;
NamedValue<n::merged_entries, std::shared_ptr<FSEntrySet> > merged_entries;
- NamedValue<n::options, FSMergerOptions> options;
+ NamedValue<n::options, MergerOptions> options;
NamedValue<n::output_manager, std::shared_ptr<OutputManager> > output_manager;
NamedValue<n::package_id, std::shared_ptr<const PackageID> > package_id;
NamedValue<n::root, FSEntry> root;
diff --git a/paludis/repositories/accounts/accounts_id.cc b/paludis/repositories/accounts/accounts_id.cc
index 4bf035e..baa1120 100644
--- a/paludis/repositories/accounts/accounts_id.cc
+++ b/paludis/repositories/accounts/accounts_id.cc
@@ -492,7 +492,7 @@ AccountsID::perform_action(Action & action) const
n::environment_file() = FSEntry("/dev/null"),
n::image_dir() = fs_location_key()->value(),
n::merged_entries() = std::make_shared<FSEntrySet>(),
- n::options() = FSMergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
+ n::options() = MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
n::output_manager() = output_manager,
n::package_id() = shared_from_this(),
n::perform_uninstall() = install_action->options.perform_uninstall(),
diff --git a/paludis/repositories/e/e_repository.cc b/paludis/repositories/e/e_repository.cc
index 4ae3880..c15700f 100644
--- a/paludis/repositories/e/e_repository.cc
+++ b/paludis/repositories/e/e_repository.cc
@@ -2389,7 +2389,7 @@ ERepository::install(const std::shared_ptr<const ERepositoryID> & id,
+ "' to destination '" + stringify(install_action.options.destination()->name())
+ "' because destination does not provide destination_interface");
- FSMergerOptions extra_merger_options;
+ MergerOptions extra_merger_options;
if (preserve_work_choice && preserve_work_choice->enabled())
extra_merger_options += mo_nondestructive;
diff --git a/paludis/repositories/e/eapi.cc b/paludis/repositories/e/eapi.cc
index 31d4ba6..bcbbdc2 100644
--- a/paludis/repositories/e/eapi.cc
+++ b/paludis/repositories/e/eapi.cc
@@ -305,14 +305,14 @@ namespace
version_spec_options += destringify<VersionSpecOption>(*t);
}
- FSMergerOptions merger_options;
+ MergerOptions merger_options;
{
std::list<std::string> merger_options_tokens;
tokenise_whitespace(check_get(k, "merger_options"), std::back_inserter(merger_options_tokens));
for (std::list<std::string>::const_iterator t(merger_options_tokens.begin()),
t_end(merger_options_tokens.end()) ;
t != t_end ; ++t)
- merger_options += destringify<FSMergerOption>(*t);
+ merger_options += destringify<MergerOption>(*t);
}
return std::make_shared<SupportedEAPI>(make_named_values<SupportedEAPI>(
diff --git a/paludis/repositories/e/eapi.hh b/paludis/repositories/e/eapi.hh
index 8029fec..ffee931 100644
--- a/paludis/repositories/e/eapi.hh
+++ b/paludis/repositories/e/eapi.hh
@@ -30,7 +30,7 @@
#include <paludis/util/singleton.hh>
#include <paludis/name.hh>
#include <paludis/dep_spec-fwd.hh>
-#include <paludis/fs_merger-fwd.hh>
+#include <paludis/merger-fwd.hh>
#include <memory>
namespace paludis
@@ -272,7 +272,7 @@ namespace paludis
NamedValue<n::ebuild_options, std::shared_ptr<const EAPIEbuildOptions> > ebuild_options;
NamedValue<n::ebuild_phases, std::shared_ptr<const EAPIEbuildPhases> > ebuild_phases;
NamedValue<n::iuse_flag_parse_options, IUseFlagParseOptions> iuse_flag_parse_options;
- NamedValue<n::merger_options, FSMergerOptions> merger_options;
+ NamedValue<n::merger_options, MergerOptions> merger_options;
NamedValue<n::package_dep_spec_parse_options, ELikePackageDepSpecOptions> package_dep_spec_parse_options;
NamedValue<n::pipe_commands, std::shared_ptr<const EAPIPipeCommands> > pipe_commands;
NamedValue<n::tools_options, std::shared_ptr<const EAPIToolsOptions> > tools_options;
diff --git a/paludis/repositories/e/ebuild.hh b/paludis/repositories/e/ebuild.hh
index 3964206..5c49518 100644
--- a/paludis/repositories/e/ebuild.hh
+++ b/paludis/repositories/e/ebuild.hh
@@ -303,7 +303,7 @@ namespace paludis
NamedValue<n::environment_file, FSEntry> environment_file;
NamedValue<n::image, FSEntry> image;
NamedValue<n::maybe_output_manager, std::shared_ptr<OutputManager> > maybe_output_manager;
- NamedValue<n::merger_options, FSMergerOptions> merger_options;
+ NamedValue<n::merger_options, MergerOptions> merger_options;
NamedValue<n::package_id, std::shared_ptr<const erepository::ERepositoryID> > package_id;
};
diff --git a/paludis/repositories/e/vdb_merger.hh b/paludis/repositories/e/vdb_merger.hh
index 208a2e8..8ac3e36 100644
--- a/paludis/repositories/e/vdb_merger.hh
+++ b/paludis/repositories/e/vdb_merger.hh
@@ -61,7 +61,7 @@ namespace paludis
NamedValue<n::fix_mtimes_before, Timestamp> fix_mtimes_before;
NamedValue<n::image, FSEntry> image;
NamedValue<n::merged_entries, std::shared_ptr<FSEntrySet> > merged_entries;
- NamedValue<n::options, FSMergerOptions> options;
+ NamedValue<n::options, MergerOptions> options;
NamedValue<n::output_manager, std::shared_ptr<OutputManager> > output_manager;
NamedValue<n::package_id, std::shared_ptr<const PackageID> > package_id;
NamedValue<n::root, FSEntry> root;
diff --git a/paludis/repositories/e/vdb_merger_TEST.cc b/paludis/repositories/e/vdb_merger_TEST.cc
index b294587..63f31f6 100644
--- a/paludis/repositories/e/vdb_merger_TEST.cc
+++ b/paludis/repositories/e/vdb_merger_TEST.cc
@@ -86,7 +86,7 @@ namespace
n::fix_mtimes_before() = Timestamp(0, 0),
n::image() = FSEntry::cwd() / "vdb_merger_TEST_dir" / what / "image",
n::merged_entries() = std::make_shared<FSEntrySet>(),
- n::options() = FSMergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
+ n::options() = MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs,
n::output_manager() = std::make_shared<StandardOutputManager>(),
n::package_id() = std::shared_ptr<PackageID>(),
n::root() = root_dir
diff --git a/paludis/repositories/unavailable/unavailable_repository_id.cc b/paludis/repositories/unavailable/unavailable_repository_id.cc
index fe967a9..57a93dd 100644
--- a/paludis/repositories/unavailable/unavailable_repository_id.cc
+++ b/paludis/repositories/unavailable/unavailable_repository_id.cc
@@ -208,7 +208,7 @@ UnavailableRepositoryID::perform_action(Action & action) const
n::environment_file() = FSEntry("/dev/null"),
n::image_dir() = FSEntry("/dev/null"),
n::merged_entries() = std::make_shared<FSEntrySet>(),
- n::options() = FSMergerOptions(),
+ n::options() = MergerOptions(),
n::output_manager() = output_manager,
n::package_id() = shared_from_this(),
n::perform_uninstall() = install_action->options.perform_uninstall(),
diff --git a/paludis/repositories/unpackaged/unpackaged_id.cc b/paludis/repositories/unpackaged/unpackaged_id.cc
index a2c4db0..4017b2e 100644
--- a/paludis/repositories/unpackaged/unpackaged_id.cc
+++ b/paludis/repositories/unpackaged/unpackaged_id.cc
@@ -403,7 +403,7 @@ UnpackagedID::perform_action(Action & action) const
{
case wp_yes:
{
- FSMergerOptions extra_merger_options;
+ MergerOptions extra_merger_options;
if (preserve_work_choice && preserve_work_choice->enabled())
extra_merger_options += mo_nondestructive;
(*install_action->options.destination()).destination_interface()->merge(
@@ -412,7 +412,7 @@ UnpackagedID::perform_action(Action & action) const
n::environment_file() = FSEntry("/dev/null"),
n::image_dir() = fs_location_key()->value(),
n::merged_entries() = std::make_shared<FSEntrySet>(),
- n::options() = (FSMergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs)
+ n::options() = (MergerOptions() + mo_rewrite_symlinks + mo_allow_empty_dirs)
| extra_merger_options,
n::output_manager() = output_manager,
n::package_id() = shared_from_this(),
diff --git a/paludis/repository.hh b/paludis/repository.hh
index 9e34775..e5ade90 100644
--- a/paludis/repository.hh
+++ b/paludis/repository.hh
@@ -38,7 +38,7 @@
#include <paludis/version_spec.hh>
#include <paludis/metadata_key-fwd.hh>
#include <paludis/metadata_key_holder.hh>
-#include <paludis/fs_merger-fwd.hh>
+#include <paludis/merger-fwd.hh>
#include <paludis/hook-fwd.hh>
#include <string>
#include <functional>
@@ -152,7 +152,7 @@ namespace paludis
*/
NamedValue<n::merged_entries, std::shared_ptr<FSEntrySet> > merged_entries;
- NamedValue<n::options, FSMergerOptions> options;
+ NamedValue<n::options, MergerOptions> options;
NamedValue<n::output_manager, std::shared_ptr<OutputManager> > output_manager;
NamedValue<n::package_id, std::shared_ptr<const PackageID> > package_id;